From babe4956393f7e16fbc82d3f8998c8179b831957 Mon Sep 17 00:00:00 2001 From: Hakan Date: Wed, 27 Mar 2024 17:38:49 +0300 Subject: [PATCH 1/3] update to start up with docker-compose --- Dockerfile | 3 ++- Pipfile | 1 + docker-compose.yml | 65 ++++++++++++++++++++++++++++++---------------- 3 files changed, 46 insertions(+), 23 deletions(-) diff --git a/Dockerfile b/Dockerfile index 948373f70..a2ce14483 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,6 @@ # unicef/etools-prp-base:latest -ARG BASE_TAG=installed +#ARG BASE_TAG=installed +ARG BASE_TAG=latest FROM unicef/datamart:$BASE_TAG ADD src /code/ diff --git a/Pipfile b/Pipfile index 19f02baf2..0f7124492 100644 --- a/Pipfile +++ b/Pipfile @@ -22,6 +22,7 @@ django-cors-headers = "*" django-crispy-forms = "*" django-countries = "*" django-deprecate-fields = "*" +django-debug-toolbar = "*" django-environ = "<0.10" django-extensions = "*" django-filter = "*" diff --git a/docker-compose.yml b/docker-compose.yml index 6d39a29e5..b45a9e851 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,9 +9,10 @@ x-datamart-defaults: &datamart_defaults volumes: - "$PWD:/code" environment: - DEBUG: 1 + DEBUG: 0 DATABASE_URL: postgis://postgres:@db:5432/etools_datamart - DATABASE_URL_ETOOLS: postgis://postgres:@db-etools:5432/etools + #DATABASE_URL_ETOOLS: postgis://postgres:@db-etools:5432/etools + DATABASE_URL_ETOOLS: postgis://postgres:@192.168.244.151:5442/etools DATABASE_URL_PRP: postgis://postgres:@db-prp:5432/prp AUTOCREATE_USERS: "admin,123" CACHE_URL: "redis://redis:6379/1" @@ -30,16 +31,15 @@ x-datamart-defaults: &datamart_defaults SESSION_COOKIE_SECURE: 0 STATIC_ROOT: /code/src/etools_datamart/apps/web/static/ GEOS_LIBRARY_PATH: "/usr/lib/libgeos_c.so.1" - GDAL_LIBRARY_PATH: "/usr/lib/libgdal.so.26" + GDAL_LIBRARY_PATH: "/usr/lib/libgdal.so" EXPORT_FILE_STORAGE: "django.core.files.storage.FileSystemStorage" - services: proxy: image: traefik:v2.1 command: --api.insecure=True --providers.docker ports: - "8083:80" - - "8080:8080" + - "8084:8080" container_name: datamart_proxy volumes: - /var/run/docker.sock:/var/run/docker.sock @@ -57,42 +57,63 @@ services: beat: container_name: datamart_beat << : *datamart_defaults - command: celery -A etools_datamart beat --loglevel=info --workdir=/code/src + working_dir: /code/src + #command: celery beat etools_datamart --loglevel=info --workdir=/code/ + #command: celery beat etools_datamart --loglevel=info + #command: celery -A etools_datamart beat --loglevel=debug + command: bash -c "celery -A etools_datamart beat --loglevel=info" + #command: celery -A etools_datamart beat --loglevel=debug --workdir /code + environment: + - BACKEND_DEBUG=False + - DJANGO_SETTINGS_MODULE='etools_datamart.config.settings' worker: container_name: datamart_worker << : *datamart_defaults - command: celery -A etools_datamart worker --loglevel=info --workdir=/code/src - + working_dir: /code/src + #command: celery worker etools_datamart --loglevel=info --workdir=/code/ + #command: celery worker etools_datamart --loglevel=info + #command: celery -A etools_datamart worker --loglevel=debug + command: celery -A etools_datamart.celery worker --loglevel=info + #command: find . -name celery.py -print + #command: ['celery', 'worker, '-A', 'etools_datamart', '-l', 'info'] + environment: + - BACKEND_DEBUG=True + - DJANGO_SETTINGS_MODULE='etools_datamart.config.settings' + db: image: postgis/postgis:12-3.2 container_name: datamart_db + ports: + - "15432:5432" environment: - POSTGRES_PASSWORD: - POSTGRES_USER: postgres + POSTGRES_HOST_AUTH_METHOD: trust + #POSTGRES_PASSWORD: + #POSTGRES_USER: postgres POSTGRES_DB: etools_datamart volumes: - "$PWD/build/db:/var/lib/postgresql/data" # Rely on etools and prp database instances running locally - db-etools: - image: postgis/postgis:12-3.2 - container_name: datamart_etools - shm_size: '1gb' - environment: - POSTGRES_USER: postgres - POSTGRES_PASSWORD: - POSTGRES_DB: etools - volumes: - - "$PWD/build/etools:/var/lib/postgresql/data" + #db-etools: + # image: postgis/postgis:12-3.2 + # container_name: datamart_etools + # shm_size: '1gb' + # environment: + # POSTGRES_USER: postgres + # POSTGRES_PASSWORD: + # POSTGRES_DB: etools + # volumes: + # - "$PWD/build/etools:/var/lib/postgresql/data" db-prp: image: postgis/postgis:12-3.2 shm_size: '1gb' container_name: datamart_prp environment: - POSTGRES_USER: postgres - POSTGRES_PASSWORD: + POSTGRES_HOST_AUTH_METHOD: trust + #POSTGRES_USER: postgres + #POSTGRES_PASSWORD: POSTGRES_DB: prp volumes: - "$PWD/build/prp:/var/lib/postgresql/data" From 5af3a3449e986dee03a7017082119b82bb252c26 Mon Sep 17 00:00:00 2001 From: Hakan Date: Thu, 28 Mar 2024 14:32:36 +0300 Subject: [PATCH 2/3] remove django-debug-toolbar from dependencies --- Pipfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Pipfile b/Pipfile index 0f7124492..19f02baf2 100644 --- a/Pipfile +++ b/Pipfile @@ -22,7 +22,6 @@ django-cors-headers = "*" django-crispy-forms = "*" django-countries = "*" django-deprecate-fields = "*" -django-debug-toolbar = "*" django-environ = "<0.10" django-extensions = "*" django-filter = "*" From 830b0779aec7104582b69cf0487e7f47bcbf470a Mon Sep 17 00:00:00 2001 From: Hakan Date: Thu, 28 Mar 2024 14:48:27 +0300 Subject: [PATCH 3/3] add instruction for environment specific config for etools db server --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index b45a9e851..937156687 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,7 +11,7 @@ x-datamart-defaults: &datamart_defaults environment: DEBUG: 0 DATABASE_URL: postgis://postgres:@db:5432/etools_datamart - #DATABASE_URL_ETOOLS: postgis://postgres:@db-etools:5432/etools + #NOTE: Please update ETOOLS DB server IP/name and port specific to your enviroment. DATABASE_URL_ETOOLS: postgis://postgres:@192.168.244.151:5442/etools DATABASE_URL_PRP: postgis://postgres:@db-prp:5432/prp AUTOCREATE_USERS: "admin,123"