在运行Flower以监视在我的docker部署的flask应用程序上运行的celenic异步任务时遇到问题。我已经尝试了所有的东西,但关于在docker部署的环境中运行flower的文档非常稀少;我对此还比较陌生。
网络&芹菜&我的docker-compose.yml
文件的花部分
version: "3.6"
services:
web:
image: <image here>
deploy:
replicas: 1
restart_policy:
condition: on-failure
placement:
constraints: [node.role == manager] # this parameter should be worker when in the cloud with managers and workers
command: ./docker_setup.sh postgres postgres_test
depends_on:
- celery
environment:
- PYTHONUNBUFFERED=1
secrets:
- <secret shtuff>
networks:
- webnet
labels:
- <local deployment label>
celery:
image: <image here>
deploy:
replicas: 1
restart_policy:
condition: on-failure
placement:
constraints: [node.role == manager] # this parameter should be worker when in the cloud with managers and workers
command: celery worker -A celery_worker.celery --loglevel=info
depends_on:
- postgres
- redis
environment:
- PYTHONUNBUFFERED=1
secrets:
- <secret shtuff>
networks:
- webnet
labels:
- <local deployment label>
flower:
image: <image here>
environment:
- PYTHONUNBUFFERED=1
working_dir: /code
command: celery flower -A celery_worker.celery --port=5555
depends_on:
- postgres
- redis
- celery
ports:
- "5555:5555"
links:
- db
- redis
networks:
- webnet
当我通过docker在本地部署它时(这样我就可以通过localhost
访问Web API(,它运行良好&通过芹菜日志,我可以看到该应用程序正在顺利运行并处理异步请求。然而,当我尝试通过执行$ flower
&转到http://localhost:5555
,flower应用程序加载,但没有显示线程或工作者。如有任何建议或帮助,我们将不胜感激!
哇。做了一个愚蠢的疏忽&忘记在应用程序的requirements.txt文件中包含flower==0.9.2
。一旦我这样做了,花就在本地部署后暴露在localhost:5555上。工作起来很有魅力!