From 235a42112af487df7bb4608624d8fd6cbe4a21e4 Mon Sep 17 00:00:00 2001 From: "marcel.kocisek" Date: Mon, 9 Dec 2024 13:34:23 +0100 Subject: [PATCH] - Disable celery concurency for production deployments - Disable GEVENT_WORKER for celery worker and beat - added section about server check command --- .dev.env | 1 - .prod.env | 7 +++---- development.md | 6 ++++++ docker-compose.yml | 4 ++++ 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.dev.env b/.dev.env index 1eb7e061..857b6f01 100644 --- a/.dev.env +++ b/.dev.env @@ -1,7 +1,6 @@ # Environment variables for development docker-compose.dev.yml FLASK_DEBUG=1 -GEVENT_WORKER=False # Mail SMTP connection to maildev diff --git a/.prod.env b/.prod.env index ee1c9c17..e7bccfe8 100644 --- a/.prod.env +++ b/.prod.env @@ -136,17 +136,16 @@ BROKER_TRANSPORT_OPTIONS={ 'master_name': 'mymaster' } CELERY_RESULT_BACKEND=redis://merginmaps-redis:6379/0 #CELERY_ACKS_LATE=False -CELERY_ACKS_LATE=True +#CELERY_ACKS_LATE=True # set to number of cpu -CELERYD_CONCURRENCY=2 +#CELERYD_CONCURRENCY=2 # Deprecated from 2024.7.0, use CELERYD_CONCURRENCY instead after 2024.7.0 # CELERY_WORKER_CONCURRENCY=1 - #CELERYD_PREFETCH_MULTIPLIER=4 -CELERYD_PREFETCH_MULTIPLIER=4 +#CELERYD_PREFETCH_MULTIPLIER=4 # Deprecated from 2024.7.0, use CELERYD_PREFETCH_MULTIPLIER instead after 2024.7.0 #CELERY_WORKER_PREFETCH_MULTIPLIER=4 diff --git a/development.md b/development.md index 7b11daa0..0fdfa1e5 100644 --- a/development.md +++ b/development.md @@ -74,6 +74,12 @@ docker exec -it merginmaps-server flask init-db docker exec -it merginmaps-server flask user create admin topsecret --is-admin --email admin@example.com ``` +To check if application is running, you can use following mand to verify you installation: + +```shell +docker exec -it merginmaps-server flask server check --email your@email.com +``` + In docker-compose.dev.yml is started maildev/maildev image that can be used to test emails (see [https://github.com/maildev/maildev/](https://github.com/maildev/maildev/)). In localhost:1080 you can see the emails sent by the application in web interface. ## Running tests diff --git a/docker-compose.yml b/docker-compose.yml index f38ca2dd..1fb2bfbf 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -42,6 +42,8 @@ services: restart: always env_file: - .prod.env + environment: + - GEVENT_WORKER=0 volumes: - ./server/entrypoint.sh:/app/entrypoint.sh depends_on: @@ -57,6 +59,8 @@ services: user: 901:999 env_file: - .prod.env + environment: + - GEVENT_WORKER=0 volumes: - ./projects:/data - ./server/entrypoint.sh:/app/entrypoint.sh