fix(compose): split Django and Celery healthchecks
- This also fixes a regression with Celery not finding its broker in the worker
container, by adding a dedictad variable and assigning a separate Redis database /1.
Some issues were complaining about corruptions in the Celery database, which
might have come from reusing the same /0 database as Django cache and queue.
- Renames the celeryworker container to just worker.
This partly undoes 4ee6190cc1
This commit is contained in:
parent
91fb0a6ea0
commit
18ff708134
|
@ -1,6 +1,6 @@
|
|||
COMPOSE_BAKE=true
|
||||
|
||||
# api + celeryworker
|
||||
# api + worker
|
||||
DEBUG=True
|
||||
FORCE=True
|
||||
DEFAULT_FROM_EMAIL=hello@funkwhale.test
|
||||
|
@ -14,6 +14,7 @@ DJANGO_SETTINGS_MODULE=config.settings.local
|
|||
|
||||
DATABASE_URL=postgresql://postgres@postgres/postgres
|
||||
CACHE_URL=redis://redis:6379/0
|
||||
CELERY_BROKER_URL=redis://redis:6379/1
|
||||
EMAIL_CONFIG=smtp://mailpit.funkwhale.test:1025
|
||||
|
||||
FORCE_HTTPS_URLS=True
|
||||
|
|
|
@ -135,6 +135,3 @@ RUN --mount=type=cache,target=~/.cache/pip; \
|
|||
|
||||
ADD --chown=0:0 --chmod=0755 ./entrypoint.sh /
|
||||
ENTRYPOINT [ "/entrypoint.sh" ]
|
||||
|
||||
HEALTHCHECK --start-period=60s --interval=10s --timeout=5s --retries=3 \
|
||||
CMD curl -o /dev/null -s -w "%{http_code}" http://localhost:5000/api/v1 | grep "301" || exit 1
|
||||
|
|
|
@ -71,6 +71,3 @@ RUN poetry install --extras typesense
|
|||
|
||||
ADD --chown=0:0 --chmod=0755 ./entrypoint.sh /
|
||||
ENTRYPOINT [ "/entrypoint.sh" ]
|
||||
|
||||
HEALTHCHECK --start-period=60s --interval=10s --timeout=5s --retries=3 \
|
||||
CMD curl -o /dev/null -s -w "%{http_code}" http://localhost:5000/api/v1 | grep "301" || exit 1
|
||||
|
|
|
@ -30,7 +30,7 @@ case "${1}" in
|
|||
${0} collectstatic
|
||||
${0} uvicorn
|
||||
;;
|
||||
develop-celery)
|
||||
develop-worker)
|
||||
export CELERYD_CONCURRENCY=0
|
||||
watchmedo auto-restart \
|
||||
--patterns="*.py" \
|
||||
|
|
|
@ -24,10 +24,10 @@ services:
|
|||
service: api
|
||||
<<: *django
|
||||
|
||||
celeryworker:
|
||||
worker:
|
||||
extends:
|
||||
file: ./compose/app.django.yml
|
||||
service: celeryworker
|
||||
service: worker
|
||||
<<: *django
|
||||
|
||||
nginx:
|
||||
|
|
|
@ -26,6 +26,7 @@ x-django: &django
|
|||
|
||||
- DATABASE_URL
|
||||
- CACHE_URL
|
||||
- CELERY_BROKER_URL
|
||||
- EMAIL_CONFIG
|
||||
- TYPESENSE_API_KEY
|
||||
|
||||
|
@ -51,7 +52,27 @@ services:
|
|||
context: ../api
|
||||
dockerfile: Dockerfile.debian
|
||||
command: develop
|
||||
healthcheck:
|
||||
test:
|
||||
[
|
||||
"CMD-SHELL",
|
||||
"curl -o /dev/null -s -w '%{http_code}' http://localhost:5000/api/v1 | grep '301' || exit 1",
|
||||
]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
start_period: 60s
|
||||
|
||||
celeryworker:
|
||||
worker:
|
||||
<<: *django
|
||||
command: develop-celery
|
||||
command: develop-worker
|
||||
healthcheck:
|
||||
test:
|
||||
[
|
||||
"CMD-SHELL",
|
||||
"celery -A funkwhale_api.taskapp status | grep 'OK' || exit 1",
|
||||
]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
start_period: 30s
|
||||
|
|
|
@ -18,6 +18,6 @@ services:
|
|||
depends_on:
|
||||
minio: {}
|
||||
|
||||
celeryworker:
|
||||
worker:
|
||||
depends_on:
|
||||
minio: {}
|
||||
|
|
|
@ -283,7 +283,7 @@ Username `funkwhale` is not permitted. You need to export COMPOSE_PROJECT_NAME t
|
|||
Recycle individual containers:
|
||||
|
||||
```sh
|
||||
docker compose rm -sf api celeryworker; docker compose up -d api celeryworker
|
||||
docker compose rm -sf api worker; docker compose up -d api worker
|
||||
```
|
||||
|
||||
Once you're done with the containers, you can stop them all:
|
||||
|
|
Loading…
Reference in New Issue