From 8d11b00765cd7d62b247fdf23437484ace4a453e Mon Sep 17 00:00:00 2001 From: glaubervila Date: Sat, 9 Mar 2024 02:15:00 +0000 Subject: [PATCH 1/2] Fixed memory leak --- compose/local/docker-compose-template.yml | 10 +++++++++- compose/production/docker-compose-template.yml | 9 +++++++++ compose/testing/docker-compose-template.yml | 10 +++++++++- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/compose/local/docker-compose-template.yml b/compose/local/docker-compose-template.yml index 45b9db75..38cbce2f 100644 --- a/compose/local/docker-compose-template.yml +++ b/compose/local/docker-compose-template.yml @@ -83,7 +83,15 @@ services: command: /start_worker.sh depends_on: - backend - + restart: unless-stopped + deploy: + resources: + limits: + cpus: "2.0" + memory: 200M + reservations: + cpus: "0.5" + memory: 20M # Copia do serviço backend, mas executando outro comando celery_beat: &celery_beat <<: *backend diff --git a/compose/production/docker-compose-template.yml b/compose/production/docker-compose-template.yml index cfad4231..841a8a48 100644 --- a/compose/production/docker-compose-template.yml +++ b/compose/production/docker-compose-template.yml @@ -63,6 +63,15 @@ services: command: /start_worker.sh depends_on: - backend + restart: unless-stopped + deploy: + resources: + limits: + cpus: "10.0" + memory: 16G + reservations: + cpus: "15" + memory: 1G # Celery Beat (Tarefas agendadas do backend) celery_beat: diff --git a/compose/testing/docker-compose-template.yml b/compose/testing/docker-compose-template.yml index e7b5f4f1..e9a8bb42 100644 --- a/compose/testing/docker-compose-template.yml +++ b/compose/testing/docker-compose-template.yml @@ -63,7 +63,15 @@ services: command: /start_worker.sh depends_on: - backend - + restart: unless-stopped + deploy: + resources: + limits: + cpus: "2.0" + memory: 200M + reservations: + cpus: "0.5" + memory: 20M # Celery Beat (Tarefas agendadas do backend) celery_beat: <<: *backend From 0a333f504dd1bae5e6dd7e8b997864926edf0987 Mon Sep 17 00:00:00 2001 From: glaubervila Date: Mon, 11 Mar 2024 17:13:19 +0000 Subject: [PATCH 2/2] minor fixes in env template and docker-compose files --- compose/local/docker-compose-template.yml | 5 ++--- compose/local/env-template | 13 +++++++++---- compose/production/docker-compose-template.yml | 8 ++------ compose/production/env-template | 8 ++++++++ compose/testing/docker-compose-template.yml | 9 +++------ compose/testing/env-template | 8 ++++++++ 6 files changed, 32 insertions(+), 19 deletions(-) diff --git a/compose/local/docker-compose-template.yml b/compose/local/docker-compose-template.yml index 38cbce2f..576e4516 100644 --- a/compose/local/docker-compose-template.yml +++ b/compose/local/docker-compose-template.yml @@ -56,9 +56,8 @@ services: volumes: - ${TNO_PROJ_DIR:-.}/predict_occultation:/app - ${TNO_PROJ_DIR:-.}/data/predict_occultations:/app/outputs/predict_occultations - environment: - - PARSL_ENV=local - - PREDICT_OUTPUTS=/app/outputs/predict_occultations + env_file: + - .env # Servidor Web NGINX nginx: diff --git a/compose/local/env-template b/compose/local/env-template index 5d563f34..c401835a 100644 --- a/compose/local/env-template +++ b/compose/local/env-template @@ -33,8 +33,13 @@ DJANGO_UWSGI_WORKER_THREADS=2 # DATABASE used in Django and Predict Occultation container # ------------------------------------- # Usando Localhost -# DB_ADMIN_URI=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@localhost:5432/${POSTGRES_DB} -# DB_CATALOG_URI=postgresql://untrustedprod:untrusted@localhost:3307/prod_gavo +DB_ADMIN_URI=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@localhost:5432/${POSTGRES_DB} +DB_CATALOG_URI=postgresql://untrustedprod:untrusted@localhost:3307/prod_gavo # Usando host.docker.internal -DB_ADMIN_URI=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@host.docker.internal:5432/${POSTGRES_DB} -DB_CATALOG_URI=postgresql://untrustedprod:untrusted@host.docker.internal:3307/prod_gavo +# DB_ADMIN_URI=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@host.docker.internal:5432/${POSTGRES_DB} +# DB_CATALOG_URI=postgresql://untrustedprod:untrusted@host.docker.internal:3307/prod_gavo + +# Predict Occultation Pipeline +# ------------------------------------- +PARSL_ENV=local +PREDICT_OUTPUTS=/app/outputs/predict_occultations diff --git a/compose/production/docker-compose-template.yml b/compose/production/docker-compose-template.yml index 841a8a48..110d8421 100644 --- a/compose/production/docker-compose-template.yml +++ b/compose/production/docker-compose-template.yml @@ -50,12 +50,8 @@ services: volumes: - ${TNO_PROJ_DIR:-.}:${TNO_PROJ_DIR:-.} - ${TNO_SSHKEY}:/home/app.tno/.ssh/id_rsa - environment: - - PARSL_ENV=linea - - REMOTE_PIPELINE_ROOT=${TNO_PROJ_DIR:-.} - - PREDICT_OUTPUTS=${TNO_PROJ_DIR:-.}/data/predict_occultations - - DB_ADMIN_URI=${DB_ADMIN_URI} - - DB_CATALOG_URI=${DB_CATALOG_URI} + env_file: + - .env # Celery Workers (Tarefas do backend em background) celery_worker: diff --git a/compose/production/env-template b/compose/production/env-template index a3be86ca..153dc61b 100644 --- a/compose/production/env-template +++ b/compose/production/env-template @@ -31,3 +31,11 @@ DJANGO_UWSGI_WORKER_THREADS=2 # ------------------------------------- DB_ADMIN_URI=postgresql://:@desdb4.linea.gov.br:5432/ DB_CATALOG_URI=postgresql://:@desdb4.linea.gov.br:5432/prod_gavo + +# Predict Occultation Pipeline +# ------------------------------------- +PARSL_ENV=linea +REMOTE_PIPELINE_ROOT=${TNO_PROJ_DIR:-.} +PREDICT_OUTPUTS=${TNO_PROJ_DIR:-.}/data/predict_occultations +DB_ADMIN_URI=${DB_ADMIN_URI} +DB_CATALOG_URI=${DB_CATALOG_URI} diff --git a/compose/testing/docker-compose-template.yml b/compose/testing/docker-compose-template.yml index e9a8bb42..95296f6d 100644 --- a/compose/testing/docker-compose-template.yml +++ b/compose/testing/docker-compose-template.yml @@ -50,12 +50,8 @@ services: volumes: - ${TNO_PROJ_DIR:-.}:${TNO_PROJ_DIR:-.} - ${TNO_SSHKEY}:/home/app.tno/.ssh/id_rsa - environment: - - PARSL_ENV=linea - - REMOTE_PIPELINE_ROOT=${TNO_PROJ_DIR:-.} - - PREDICT_OUTPUTS=${TNO_PROJ_DIR:-.}/data/predict_occultations - - DB_ADMIN_URI=${DB_ADMIN_URI} - - DB_CATALOG_URI=${DB_CATALOG_URI} + env_file: + - .env # Celery Workers (Tarefas do backend em background) celery_worker: @@ -72,6 +68,7 @@ services: reservations: cpus: "0.5" memory: 20M + # Celery Beat (Tarefas agendadas do backend) celery_beat: <<: *backend diff --git a/compose/testing/env-template b/compose/testing/env-template index 9f5d5813..9fbe2aca 100644 --- a/compose/testing/env-template +++ b/compose/testing/env-template @@ -31,3 +31,11 @@ DJANGO_UWSGI_WORKER_THREADS=2 # ------------------------------------- DB_ADMIN_URI=postgresql://:@desdb4.linea.gov.br:5432/ DB_CATALOG_URI=postgresql://:@desdb4.linea.gov.br:5432/prod_gavo + +# Predict Occultation Pipeline +# ------------------------------------- +PARSL_ENV=linea +REMOTE_PIPELINE_ROOT=${TNO_PROJ_DIR:-.} +PREDICT_OUTPUTS=${TNO_PROJ_DIR:-.}/data/predict_occultations +DB_ADMIN_URI=${DB_ADMIN_URI} +DB_CATALOG_URI=${DB_CATALOG_URI}