flower
flower copied to clipboard
Flower broker API is not working.
Describe the bug
I have infrastructure like:
Celery worker + RabbitMQ as a broker + Redis as backend + Flower.
So the problem is in that task are creating like once in 100 times i guess. And i can't use /broker in flower.
My dockerfiles and docker-compose is below with trace:
[E 211208 14:33:30 broker:79] RabbitMQ management API call failed: Timeout while connecting
. By the way, in logs there is NOTHING about problems on flower or Rabbit side.
Dockerfile-flower:
FROM python:3.8-alpine
ENV PYTHONBUFFERED=0
# need to copy flower requirements #
# flower uses celery v5 #
RUN mkdir /flowerapp
WORKDIR /flowerapp
COPY requirements/flower-requirements.txt .
COPY entrypoints/flower-entrypoint.sh .
RUN pip install -r flower-requirements.txt
# creating user, no need to run from root! #
RUN addgroup -S flowerg && adduser -S flower -G flowerg
# USER flower
ENTRYPOINT /flowerapp/flower-entrypoint.sh
Flower-entrypoint:
#!/bin/sh
celery --broker amqp://$RABBITMQ_DEFAULT_USER:$RABBITMQ_DEFAULT_PASS@rabbit:5672// flower
With this configuration there are 2 types of errors. First - upper. And second is about {bad_header,<<"GET /api">>}
- ref on https://github.com/mher/flower/issues/1036. So if I am able to fix bad_header
, i can't fix Timeout.
So my final docker-compose with no Dockerfile for flower and entrypoint (like all doing):
version: "3.2"
services:
docker-compose.yml
database:
image: redis:6.2-alpine
restart: always
ports:
- "6379:6379"
rabbit:
image: rabbitmq:3.9-management
env_file:
- environments/broker.env
ports:
- "5672:5672"
- "15672:15672"
restart: always
flower:
image: mher/flower:latest
env_file:
- environments/broker.env
environment:
- FLOWER_BASIC_AUTH=riven:an0th3r_p@ss
- CELERY_BROKER_URL=amqp://riven:s3cr3t_p4ss@rabbit:5672/
- FLOWER_BROKER_API_URL=http://riven:s3cr3t_p4ss@rabbit:15672/api
- FLOWER_PORT=5555
ports:
- "5555:5555"
depends_on:
- rabbit
My flower rq.txt:
flower==1.0.0
humanize==3.13.1
prometheus-client==0.12.0
tornado==6.1
To Reproduce You need to use MACOS big sur. I guess it can make sense..
Steps to reproduce the behavior:
- Start docker-compose and Celery (
celery -A celery_test worker --loglevel=info
) - Go to flower url and use /broker section
- Open flower docker logs and see error.
Expected behavior Connection to RabbitMQ? WORKING?
No, problem is not in CELERY_BROKER_URL=amqp://riven:s3cr3t_p4ss@rabbit:5672/
. I tried to change it and give user permissions (administrator). but nothing helps. I even tried to do like in your official docs:
CELERY_BROKER_URL=amqp://riven:s3cr3t_p4ss@rabbit:5672//
and this trace is there too! :)
I tried even to switch versions of Flower and RabbitMQ. Flower to 0.9.5 and 0.9.7 and Rabbit from alpine to manage. And nothing.
and sometimes i am able to create task. But...
Unknown worker '[email protected]'
So if I am starting Rabbit first - i've got error about header. If second - timeout.
I am installing curl with apk get inside container. And what i am gettin?
curl -i -u riven:s3cr3t_p4ss http://rabbit:15672/api/vhosts
->
[{"cluster_state":{"rabbit@539369e1efa3":"running"},"description":"Default virtual host","message_stats":{"confirm":0,"confirm_details":{"rate":0.0},"drop_unroutable":0,"drop_unroutable_details":{"rate":0.0},"publish":1,"publish_details":{"rate":0.0},"return_unroutable":0,"return_unroutable_details":{"rate":0.0}},"messages":1,"messages_details":{"rate":0.0},"messages_ready":1,"messages_ready_details":{"rate":0.0},"messages_unacknowledged":0,"messages_unacknowledged_details":{"rate":0.0},"metadata":{"description":"Default virtual host","tags":[]},"name":"/","recv_oct":6462,"recv_oct_details":{"rate":0.0},"send_oct":8286,"send_oct_details":{"rate":0.0},"tags":[],"tracing":false}]
All works fine with it, but not with /api endpoint. It gives 301, and if i follow - just /api information.
Duplicate of #1112?
Duplicate of #1112?
Nope, does not helps.
Errors are random and there is no solution.
And if you are talking about open duplicate - maybe you are right. And if RMQ is not working with flower - developers should write in doc about that. So i will wait for them in this thread
Hello, Flower and Celery are both working fine with RabbitMQ, please see my example below: https://github.com/JCardoen/fast-api-example
Hello, Flower and Celery are both working fine with RabbitMQ, please see my example below: https://github.com/JCardoen/fast-api-example
yes, with version 5.1.2 thanks
Hello, Flower and Celery are both working fine with RabbitMQ, please see my example below: https://github.com/JCardoen/fast-api-example
Please try to reproduce my issue. Or just say what is wrong in this configuration. I can't see a real difference.
Здравствуйте, Цветок и сельдерей отлично работают с RabbitMQ, пожалуйста, смотрите мой пример ниже: https://github.com/JCardoen/fast-api-example
yes, with version 5.1.2 thanks
Wdm v5.1.2?
I need to add celery to flower container with version 5.1.2?
Hello, Flower and Celery are both working fine with RabbitMQ, please see my example below: https://github.com/JCardoen/fast-api-example
yes, with version 5.1.2 thanks
Wdm v5.1.2?
I need to add celery to flower container with version 5.1.2?
celery 5.1.2 + flower 1.0.0
If this works, please close this issue.
I have the same issue, the broker API is not working, using flower 1.2.0 and celery 5.2.7
from my celeryconfig.py:
broker_api = "https://user:pw@<broker-domain.com>/api/"
Celery shows nothing in the broker tab.
Otherwise its working quite fine.
this is the broker tab:
I had the same problem with the broker tab being empty. My solution was to change:
FLOWER_BROKER_API_URL=http://username:password@rabbit:15672/api
to
FLOWER_BROKER_API_URL=http://username:password@rabbit:15672/api/
Note the trailing slash.
I first came across this (annoying) requirement with Django. I'm not a fan.
In case anyone is looking for a working config in docker-compose, here's one with RabbitMQ 3.12 and Flower 2.0.0:
redis:
image: redis:7.2.4
restart: always
networks:
- backnet
rabbitmq:
image: rabbitmq:3.12-management
ports:
- 5672:5672
- 15672:15672
networks:
- backnet
flower:
image: mher/flower:2.0.0
environment:
- CELERY_BROKER_URL=amqp://guest:guest@rabbitmq:5672//
- CELERY_RESULT_BACKEND=redis://redis:6379/0
- FLOWER_BROKER_API=http://guest:guest@rabbitmq:15672/api/
- FLOWER_PORT=8888
networks:
- backnet
ports:
- 8888:8888
depends_on:
- rabbitmq
- redis
networks:
backnet:
frontnet:
What made it work was changing the FLOWER_BROKER_API_URL into FLOWER_BROKER_API... :roll_eyes: Using Celery 5.3.6