运行Flower来监视在我的docker部署的flask应用程序上运行的celery异步任务时遇到麻烦。我已经尝试了所有方法,但是有关在docker部署环境中运行花的文档非常少,而且我对此还比较陌生。
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)时,它运行良好,并且可以通过celery日志查看该应用程序正在运行并顺利处理异步请求。但是,当我尝试通过执行$ flower
并转到http://localhost:5555
来访问花监控应用程序时,该花应用程序会加载,但不会显示线程或工作程序。任何建议或帮助将不胜感激!
答案 0 :(得分:0)
哇。愚蠢的疏忽并忘记在应用程序的我的requirements.txt文件中包含flower==0.9.2
。完成该操作后,在进行本地部署后,flower在localhost:5555上公开。奇迹般有效!