celery icon indicating copy to clipboard operation
celery copied to clipboard

BROKER_URL !== CELERY_BROKER_URL

Open chris-hydra opened this issue 10 years ago • 7 comments

Thanks for all the great work making this image available - posting this in case anyone else has this issue.

The README for this image doesn't make it clear that BROKER_URL is deprecated in favour of CELERY_BROKER_URL.

The Celery configuration documentation makes no mention of CELERY_BROKER_URL - all examples use BROKER_URL.

If you rename your RabbitMQ service to anything but "rabbit" in your docker-compose.yml, and try (according to the configuration docs) to set BROKER_URL accordingly, this image won't work.

I will cross-post this issue on the Celery documentation site.

chris-hydra avatar Apr 27 '16 17:04 chris-hydra

BROKER_URL is the variable name chosen by upstream to use in celeryconfig.py, while CELERY_BROKER_URL is the environment variable created for this image that is used to fill BROKER_URL in the provided celeryconfig.py. The value of CELERY_BROKER_URL defaults to amqp://guest@rabbit.

yosifkit avatar Apr 27 '16 23:04 yosifkit

Thanks for the clarification - there still needs to be some mention that CELERY_BROKER_URL effectively overwrites any BROKER_URL setting in celeryconfig.py, when celeryconfig.py is volume-mapped from the host machine.

I would think this is a pretty common use-case - set BROKER_URL in celeryconfig.py on the host machine, and to make that configuration available to the guest Docker image via a volume mapping. The Celery Docker image breaks that, and it needs to be made clear in the Docker image docs this CELERY_BROKER_URL - celeryconfig.py interaction.

To quote immunda:

Perhaps this is more of a Celery problem, but unfortunately there's undocumented behaviour where CELERY_BROKER_URL envvar will always trump BROKER_URL as provided in a config file, as can be seen at https://github.com/celery/celery/blob/master/celery/app/utils.py#L106 which I believe results in the behaviour I encountered above.

chris-hydra avatar Apr 28 '16 15:04 chris-hydra

I have encountered the same problem, how to set BROKER_URL to make it valid, I want to use custom broker url, not use default CELERY_BROKER_URL,

leimbag avatar Feb 15 '17 02:02 leimbag

@leimbag how are you setting BROKER_URL and running celery? If you provide your own celeryconfig.py with BROKER_URL set it will mask the file provided by the image.

$ docker run -v /path/to/my/celeryconfig.py:/home/user/celeryconfig.py [more docker args...] celery

Or if you just want to change BROKER_URL at run time, just set CELERY_BROKER_URL:

$ docker run -e CELERY_BROKER_URL=amqp://my-custom-host celery

yosifkit avatar Feb 16 '17 20:02 yosifkit

I was accidentally using CELERY_BROKER_URL as environment variable and using broker_url in the celery_config file. Thanks to this post I found the magic that was changing silently the variable!

enanablancaynumeros avatar Mar 07 '17 00:03 enanablancaynumeros

I was going through old PRs, and ended up filing https://github.com/docker-library/celery/issues/12 as a result -- if you've got time, please go check my assumptions before we deprecate this image entirely. :heart: :pray:

tianon avatar Apr 05 '17 17:04 tianon

See https://github.com/docker-library/docs/pull/880 for more details of the deprecation of this image.

tianon avatar Aug 03 '17 20:08 tianon