From 15dd9dfd605d5aa64f611d67e0dd9af1d510add9 Mon Sep 17 00:00:00 2001 From: = Date: Sun, 19 Jan 2025 15:32:29 -0500 Subject: [PATCH] moved podman-compose up one level --- .p00003django.env | 2 ++ Read.me | 39 +++++++++++++------- accounts/urls.py | 2 ++ podman-compose.yml | 65 ---------------------------------- project_management/settings.py | 4 +++ requirements.txt | 1 + 6 files changed, 35 insertions(+), 78 deletions(-) delete mode 100644 podman-compose.yml diff --git a/.p00003django.env b/.p00003django.env index 8d4e60e..d3a29df 100644 --- a/.p00003django.env +++ b/.p00003django.env @@ -1,6 +1,8 @@ DEBUG=1 SECRET_KEY=Express.123 DJANGO_ALLOWED_HOSTS=192.168.0.234 localhost 127.0.0.1 [::1] +DJANGO_SUPERUSER_USERNAME=admin +DJANGO_SUPERUSER_PASSWORD=GoodMorning123! POSTGRESQL_ENGINE=django.db.backends.postgresql POSTGRESQL_DATABASE=main_db POSTGRESQL_USER=admin diff --git a/Read.me b/Read.me index ea62c9b..0fead2f 100644 --- a/Read.me +++ b/Read.me @@ -1,24 +1,37 @@ Read.me -Provide code for following program -Program runs on 5 containers using podman-dockerise +Program runs on multiple containers using podman-dockercompose files and instances -First container is latest postgresql with pgadmin -Second container is latest couchdb -Third container is latest django -Fourth container is latest nodejs with latest react and latest redux -Fifth container is latest nginx which contains the landing page and serves static content +Here is the application structure +p00003 (venv) + -p00003django + -DockerFile + -.entrypoint.sh + -JenkinsFile + -main (app1 - projects) + -accounts (app2 - apis for authentication and authorization) + -project_management + -requirements.txt + -manage.py + -p00003remix + -DockerFile + -JenkinsFile + -requirements.txt + -.entrypoint.sh + -podman-compose.yml (provides hashicorp p00003vault, p00003postgres, p00003pgadmin, p00003couchDB, p00003nginx, p00003django (depends on p00003postgres_), and p00003remix (depends on p00003couchDB)) + + +Data is persisted in NFS file structure to be provided. + +Program is wrapped with nginx static pages with reflex components embeded in it. + + +Application requires an email which will require confirmation through sending and confirming email. Once email is confirmed certificates and tokens will be generated and sent to safekeep to the first registered user. This user is also given full admin access to the application environment. I don't know how hashicorp works but there needs to be a possibility to regenerate the tokens they are misplaced or forgotten. But with each regeneration there needs to be an id that can't be changed so administrator knows that it was done. -All dynamic data is stored in an external nfs server defined in a configuration file for main django application. -Initial data that containers need is stored locally. -Program starts by welcoming user and displaying login or register page served by nginx. -Registration is by email which by default is noone@nowhere.net -Program will use a certificate system to secure communication between containers where root certificate passkey is the secret in settings page of the main django application Django main application and apis it serves: Djano main application is the user directory, project directory, and RBAC definitions directory. -First time running the django application default user is admin and password is "GoodMorning123!" which has full administrative rights. First time admin login to the django application default landing page is the program configuration page which has following required fields to complete: -Company Name (only one company can exist but subsidieries can be created - 256 characters maximum) -First subsidiary name (organization unit responsible for administring the program - 256 characters maximum) diff --git a/accounts/urls.py b/accounts/urls.py index fa9b761..3de2a82 100644 --- a/accounts/urls.py +++ b/accounts/urls.py @@ -5,4 +5,6 @@ urlpatterns = [ path('api/login/', UserLoginView.as_view(), name='login'), path('api/logout/', UserLogoutView.as_view(), name='logout'), path('api/register/', UserRegistrationView.as_view(), name='welcome'), + path('api/token/', TokenObtainPairView.as_view(), name='token_obtain_pair'), + path('api/token/refresh', TokenRefreshView.as_view(), name='token_fresh'), ] \ No newline at end of file diff --git a/podman-compose.yml b/podman-compose.yml deleted file mode 100644 index 7d12fd9..0000000 --- a/podman-compose.yml +++ /dev/null @@ -1,65 +0,0 @@ -version: '3.8' - -services: - p00003postgres: - container_name: p00003postgres - image: postgres:16.6 - environment: - PUID: 1000 - PGID: 1000 - TZ: US/Eastern - ports: - - "5432:5432" - volumes: - - postgres_data:/var/lib/postgresql/data - networks: - - backend - env_file: - - ./.p00003postgres.env - - p00003pgadmin: - container_name: p00003pgadmin - image: dpage/pgadmin4:latest - environment: - PUID: 1000 - PGID: 1000 - TZ: US/Eastern - ports: - - "5080:80" - depends_on: - - p00003postgres - networks: - - backend - env_file: - - ./.p00003pgadm.env - volume: - - ./pgadmin_data:/var/lib/pgadmin - - p00003django: - container_name: p00003django - environment: - PUID: 1000 - PGID: 1000 - TZ: US/Eastern - build: ./ - volumes: - - ./:/usr/src/app/ - ports: - - "8000:8000" - depends_on: - - p00003postgres - networks: - - backend - env_file: - - ./.p00003django.env - - -volumes: - postgres_data: - pgadmin_data: - p0003django: - -networks: - backend: - driver: bridge - diff --git a/project_management/settings.py b/project_management/settings.py index 621beb9..6bc1df4 100644 --- a/project_management/settings.py +++ b/project_management/settings.py @@ -34,6 +34,7 @@ ALLOWED_HOSTS = os.environ.get("DJANGO_ALLOWED_HOSTS").split(" ") INSTALLED_APPS = [ 'rest_framework', + 'rest_framework_simplejwt', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', @@ -116,6 +117,9 @@ REST_FRAMEWORK = { # or allow read-only access for unauthenticated users. 'DEFAULT_PERMISSION_CLASSES': [ 'rest_framework.permissions.DjangoModelPermissions', + ], + 'DEFAULT_AUTHENTICATION_CLASSES': [ + 'rest_framework_simplejwt.authentication.JWTAuthentication', ] } diff --git a/requirements.txt b/requirements.txt index 80e79bf..e9756dc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,7 @@ asgiref==3.8.1 Django==5.1.1 djangorestframework==3.15.2 +djangorestframework-simplejwt==5.4.0 psycopg2-binary==2.9.10 sqlparse==0.5.1 typing_extensions==4.12.2