diff --git a/Dockerfile b/Dockerfile index 3551c7f5..3115c308 100644 --- a/Dockerfile +++ b/Dockerfile @@ -53,6 +53,7 @@ COPY --from=backend-build /usr/local/bin/celery /usr/local/bin/celery WORKDIR /app COPY ./bin/docker_start.sh /start.sh COPY ./bin/celery_worker.sh /celery_worker.sh +COPY ./bin/celery_flower.sh /celery_flower.sh COPY ./bin/check_celery_worker_liveness.py ./bin/ RUN mkdir /app/log /app/config diff --git a/bin/celery_flower.sh b/bin/celery_flower.sh new file mode 100755 index 00000000..b8b3327b --- /dev/null +++ b/bin/celery_flower.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +set -e + +exec celery --app objects --workdir src flower diff --git a/docker-compose.yml b/docker-compose.yml index 12a173d3..15511655 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -22,7 +22,14 @@ services: - OBJECTS_SUPERUSER_USERNAME=admin - OBJECTS_SUPERUSER_PASSWORD=admin - OBJECTS_SUPERUSER_EMAIL=admin@localhost + - IS_HTTPS=no - ALLOWED_HOSTS=* + - CACHE_DEFAULT=redis:6379/0 + - CACHE_AXES=redis:6379/0 + - CACHE_OIDC=redis:6379/0 + - CELERY_BROKER_URL=redis://redis:6379/1 + - CELERY_RESULT_BACKEND=redis://redis:6379/1 + - CELERY_LOGLEVEL=DEBUG ports: - 8000:8000 depends_on: @@ -40,5 +47,15 @@ services: - redis volumes: *web_volumes + celery-flower: + build: *web_build + environment: *web_env + command: /celery_flower.sh + ports: + - 5555:5555 + depends_on: + - redis + - celery + volumes: media: diff --git a/requirements/base.in b/requirements/base.in index 90f6e98e..32cdb951 100644 --- a/requirements/base.in +++ b/requirements/base.in @@ -28,6 +28,7 @@ drf-spectacular # api documentation uwsgi sentry-sdk # error monitoring elastic-apm # Elastic APM integration +flower # task monitoring # Common ground libraries notifications-api-common diff --git a/requirements/base.txt b/requirements/base.txt index 34996741..2d169335 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -25,6 +25,7 @@ cbor2==5.6.1 celery==5.2.2 # via # -r requirements/base.in + # flower # notifications-api-common certifi==2020.12.5 # via @@ -160,6 +161,8 @@ face==20.1.1 # via glom faker==8.1.0 # via zgw-consumers +flower==2.0.1 + # via -r requirements/base.in gemma-zds-client==1.0.1 # via # commonground-api-common @@ -169,6 +172,8 @@ glom==23.5.0 # via # -r requirements/base.in # mozilla-django-oidc-db +humanize==4.9.0 + # via flower idna==2.10 # via requests inflection==0.5.1 @@ -215,6 +220,8 @@ pillow==10.2.0 # via -r requirements/base.in polib==1.1.1 # via django-rosetta +prometheus-client==0.20.0 + # via flower prompt-toolkit==3.0.43 # via click-repl psycopg2==2.8.6 @@ -247,6 +254,7 @@ pytz==2021.1 # celery # djangorestframework # drf-yasg + # flower pyyaml==6.0.1 # via # drf-spectacular @@ -281,6 +289,8 @@ sqlparse==0.4.2 # via django text-unidecode==1.3 # via faker +tornado==6.4 + # via flower typing-extensions==4.9.0 # via asgiref uritemplate==3.0.1 diff --git a/requirements/ci.txt b/requirements/ci.txt index 4bdc9878..b9331473 100644 --- a/requirements/ci.txt +++ b/requirements/ci.txt @@ -39,6 +39,7 @@ cbor2==5.6.1 celery==5.2.2 # via # -r requirements/base.txt + # flower # notifications-api-common certifi==2020.12.5 # via @@ -237,6 +238,8 @@ faker==8.1.0 # -r requirements/base.txt # factory-boy # zgw-consumers +flower==2.0.1 + # via -r requirements/base.txt freezegun==1.1.0 # via -r requirements/test-tools.in gemma-zds-client==1.0.1 @@ -249,6 +252,10 @@ glom==23.5.0 # via # -r requirements/base.txt # mozilla-django-oidc-db +humanize==4.9.0 + # via + # -r requirements/base.txt + # flower idna==2.10 # via # -r requirements/base.txt @@ -326,6 +333,10 @@ polib==1.1.1 # via # -r requirements/base.txt # django-rosetta +prometheus-client==0.20.0 + # via + # -r requirements/base.txt + # flower prompt-toolkit==3.0.43 # via # -r requirements/base.txt @@ -370,6 +381,7 @@ pytz==2021.1 # celery # djangorestframework # drf-yasg + # flower pyyaml==6.0.1 # via # -r requirements/base.txt @@ -423,6 +435,10 @@ text-unidecode==1.3 # via # -r requirements/base.txt # faker +tornado==6.4 + # via + # -r requirements/base.txt + # flower typing-extensions==4.9.0 # via # -r requirements/base.txt diff --git a/requirements/dev.txt b/requirements/dev.txt index 4fcc442b..16aefd8a 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -53,6 +53,7 @@ cbor2==5.6.1 celery==5.2.2 # via # -r requirements/ci.txt + # flower # notifications-api-common certifi==2020.12.5 # via @@ -269,6 +270,8 @@ faker==8.1.0 # zgw-consumers flake8==7.0.0 # via -r requirements/dev.in +flower==2.0.1 + # via -r requirements/ci.txt freezegun==1.1.0 # via -r requirements/ci.txt gemma-zds-client==1.0.1 @@ -281,6 +284,10 @@ glom==23.5.0 # via # -r requirements/ci.txt # mozilla-django-oidc-db +humanize==4.9.0 + # via + # -r requirements/ci.txt + # flower idna==2.10 # via # -r requirements/ci.txt @@ -376,6 +383,10 @@ polib==1.1.1 # via # -r requirements/ci.txt # django-rosetta +prometheus-client==0.20.0 + # via + # -r requirements/ci.txt + # flower prompt-toolkit==3.0.43 # via # -r requirements/ci.txt @@ -431,6 +442,7 @@ pytz==2021.1 # celery # djangorestframework # drf-yasg + # flower pyyaml==6.0.1 # via # -r requirements/ci.txt @@ -522,6 +534,10 @@ tomli==2.0.1 # build # pip-tools # pyproject-hooks +tornado==6.4 + # via + # -r requirements/ci.txt + # flower typing-extensions==4.9.0 # via # -r requirements/ci.txt