diff --git a/docker/docker-compose.prod.yml b/docker/docker-compose.prod.yml index 10270005..a13476a3 100644 --- a/docker/docker-compose.prod.yml +++ b/docker/docker-compose.prod.yml @@ -45,6 +45,26 @@ services: networks: - network-backend + flower: + build: + context: .. + dockerfile: docker/Dockerfile.prod + image: doccano_flower:prod + entrypoint: ["/opt/bin/prod-flower.sh"] + environment: + PYTHONUNBUFFERED: "1" + CELERY_BROKER_URL: "amqp://${RABBITMQ_DEFAULT_USER}:${RABBITMQ_DEFAULT_PASS}@rabbitmq" + DATABASE_URL: "postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}?sslmode=disable" + DJANGO_SETTINGS_MODULE: "config.settings.production" + FLOWER_BASIC_AUTH: "username:password" + depends_on: + - celery + ports: + - 5555:5555 + networks: + - network-backend + - network-frontend + rabbitmq: image: rabbitmq:3.10.7-alpine environment: diff --git a/tools/prod-flower.sh b/tools/prod-flower.sh new file mode 100755 index 00000000..5db436df --- /dev/null +++ b/tools/prod-flower.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +set -o errexit +set -o nounset + +cd /backend + +( + echo "Waiting for database" + python manage.py wait_for_db + + echo "Starting flower" + if [[ -n "${FLOWER_BASIC_AUTH}" ]]; then + celery --app=config flower --basic_auth="${FLOWER_BASIC_AUTH}" + fi +)