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
d9d71bccf4
commit
2bee368683
|
@ -1,4 +1,4 @@
|
||||||
# api + celeryworker
|
# api + worker
|
||||||
DEBUG=True
|
DEBUG=True
|
||||||
FORCE=True
|
FORCE=True
|
||||||
DEFAULT_FROM_EMAIL=hello@funkwhale.test
|
DEFAULT_FROM_EMAIL=hello@funkwhale.test
|
||||||
|
@ -12,6 +12,7 @@ DJANGO_SETTINGS_MODULE=config.settings.local
|
||||||
|
|
||||||
DATABASE_URL=postgresql://postgres@postgres/postgres
|
DATABASE_URL=postgresql://postgres@postgres/postgres
|
||||||
CACHE_URL=redis://redis:6379/0
|
CACHE_URL=redis://redis:6379/0
|
||||||
|
CELERY_BROKER_URL=redis://redis:6379/1
|
||||||
EMAIL_CONFIG=smtp://mailpit.funkwhale.test:1025
|
EMAIL_CONFIG=smtp://mailpit.funkwhale.test:1025
|
||||||
|
|
||||||
FORCE_HTTPS_URLS=True
|
FORCE_HTTPS_URLS=True
|
||||||
|
|
|
@ -135,6 +135,3 @@ RUN --mount=type=cache,target=~/.cache/pip; \
|
||||||
|
|
||||||
ADD --chown=0:0 --chmod=0755 ./entrypoint.sh /
|
ADD --chown=0:0 --chmod=0755 ./entrypoint.sh /
|
||||||
ENTRYPOINT [ "/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 /
|
ADD --chown=0:0 --chmod=0755 ./entrypoint.sh /
|
||||||
ENTRYPOINT [ "/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} collectstatic
|
||||||
${0} uvicorn
|
${0} uvicorn
|
||||||
;;
|
;;
|
||||||
develop-celery)
|
develop-worker)
|
||||||
export CELERYD_CONCURRENCY=0
|
export CELERYD_CONCURRENCY=0
|
||||||
watchmedo auto-restart \
|
watchmedo auto-restart \
|
||||||
--patterns="*.py" \
|
--patterns="*.py" \
|
||||||
|
|
|
@ -24,10 +24,10 @@ services:
|
||||||
service: api
|
service: api
|
||||||
<<: *django
|
<<: *django
|
||||||
|
|
||||||
celeryworker:
|
worker:
|
||||||
extends:
|
extends:
|
||||||
file: ./compose/app.django.yml
|
file: ./compose/app.django.yml
|
||||||
service: celeryworker
|
service: worker
|
||||||
<<: *django
|
<<: *django
|
||||||
|
|
||||||
nginx:
|
nginx:
|
||||||
|
|
|
@ -26,6 +26,7 @@ x-django: &django
|
||||||
|
|
||||||
- DATABASE_URL
|
- DATABASE_URL
|
||||||
- CACHE_URL
|
- CACHE_URL
|
||||||
|
- CELERY_BROKER_URL
|
||||||
- EMAIL_CONFIG
|
- EMAIL_CONFIG
|
||||||
- TYPESENSE_API_KEY
|
- TYPESENSE_API_KEY
|
||||||
|
|
||||||
|
@ -51,7 +52,27 @@ services:
|
||||||
context: ../api
|
context: ../api
|
||||||
dockerfile: Dockerfile.debian
|
dockerfile: Dockerfile.debian
|
||||||
command: develop
|
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
|
<<: *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:
|
depends_on:
|
||||||
minio: {}
|
minio: {}
|
||||||
|
|
||||||
celeryworker:
|
worker:
|
||||||
depends_on:
|
depends_on:
|
||||||
minio: {}
|
minio: {}
|
||||||
|
|
|
@ -284,7 +284,7 @@ Username `funkwhale` is not permitted. You need to export COMPOSE_PROJECT_NAME t
|
||||||
Recycle individual containers:
|
Recycle individual containers:
|
||||||
|
|
||||||
```sh
|
```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:
|
Once you're done with the containers, you can stop them all:
|
||||||
|
|
Loading…
Reference in New Issue