How I can connect Flower to RabbitMQ. My celery running tasks do not appear on Flower. Although they are running fine. On the Flower UI, when I click on "broker", I get this error message on the terminal [E 210326 10:53:07 broker:78] RabbitMQ management API call failed: Timeout while connecting
This is my docker-compose file:
version: "3.8"
services:
base:
container_name: base
image: postgres:13
ports:
- "5433:5432"
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
volumes:
- /var/lib/postgresql/data
api:
build:
context: ./api/
dockerfile: Dockerfile
volumes:
- ./api/app:/app/app
ports:
- "1000:80"
depends_on:
- base
env_file:
- .env
command: ["/start-reload.sh"]
frontend:
build:
context: ./frontend/
dockerfile: Dockerfile
ports:
- "3000:3000"
volumes:
- /app/node_modules
- ./frontend:/app
environment:
- NODE_ENV=development
stdin_open: true
links:
- api
rabbitmq:
image: "bitnami/rabbitmq:latest"
ports:
- "4369:4369"
- "5672:5672"
- "25672:25672"
- "15672:15672"
volumes:
# - "rabbitmq_data:/bitnami"
- /bitnami
redis:
image: "bitnami/redis:latest"
environment:
- REDIS_PASSWORD=password123
ports:
- "6379:6379"
volumes:
# - "redis_data:/bitnami/redis/data"
- /bitnami/redis/data
flower:
image: mher/flower
command: ["flower", "--broker=amqp://user:bitnami@rabbitmq:5672//", "--port=8888"]
ports:
- 8888:8888
depends_on:
- rabbitmq
- redis
worker:
build:
context: ./api/
dockerfile: Dockerfile.celery
depends_on:
- rabbitmq
- redis
volumes:
- ./api/app:/app
command: celery -A app.worker.celery_worker worker --loglevel=INFO --concurrency=4 -Q test-queue
5
Answers
You need to add network to combine them in same network. After that you can use service names as hostname. Like
rabbitmq
I also suffered from the same problem in my tests of last three days. Flower correctly worked only once during the tests. And I failed to identify why it worked at that time.
For me, the only method to solve this problem was downgrading the docker image from
mher/flower:latest
ormher/flower:0.9.7
tomher/flower:0.9.5
. Changing command line options, environment variables, and docker-compose.yml contents did not help. Everything works fine after the downgrade.Note. My environment was
I have opened an issue in Flower project and will attempt to fix this if I have spare time but in the mean time in the investigation section you should see the reason for this.
Issue in github: https://github.com/mher/flower/issues/1112
You can use this docker-compose file:
*** remember not to use single quotation for CELERY_BROKER_URL value!! the below config will raise error:
Try to connect to your RabbitMQ by Docker IP.
Example command: