Skip to content

Commit

Permalink
- Disable celery concurency for production deployments
Browse files Browse the repository at this point in the history
- Disable GEVENT_WORKER for celery worker and beat
- added section about server check command
  • Loading branch information
MarcelGeo committed Dec 9, 2024
1 parent 428ea77 commit 235a421
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
1 change: 0 additions & 1 deletion .dev.env
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Environment variables for development docker-compose.dev.yml

FLASK_DEBUG=1
GEVENT_WORKER=False

# Mail SMTP connection to maildev

Expand Down
7 changes: 3 additions & 4 deletions .prod.env
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions development.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ services:
restart: always
env_file:
- .prod.env
environment:
- GEVENT_WORKER=0
volumes:
- ./server/entrypoint.sh:/app/entrypoint.sh
depends_on:
Expand All @@ -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
Expand Down

0 comments on commit 235a421

Please sign in to comment.