Browse Source

Add flower config to docker compose

pull/1972/head
Hironsan 2 years ago
parent
commit
2bacdcdba1
2 changed files with 36 additions and 0 deletions
  1. 20
      docker/docker-compose.prod.yml
  2. 16
      tools/prod-flower.sh

20
docker/docker-compose.prod.yml

@ -45,6 +45,26 @@ services:
networks: networks:
- network-backend - 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: rabbitmq:
image: rabbitmq:3.10.7-alpine image: rabbitmq:3.10.7-alpine
environment: environment:

16
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
)
Loading…
Cancel
Save