1

无法运行 Flower 来监控在我的 docker 部署的烧瓶应用程序上运行的 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 在本地部署它时(这样我可以通过 访问 Web API localhost),它工作正常并且我可以通过 celery 日志看到应用程序正在运行并顺利处理异步请求。但是,当我尝试通过执行$ flower& go to来访问花卉监控应用程序时http://localhost:5555,花卉应用程序会加载,但没有显示线程或工作线程。任何建议或帮助将不胜感激!

4

1 回答 1

0

哇。做了一个愚蠢的疏忽,忘记flower==0.9.2在我的应用程序中包含我的 requirements.txt 文件。一旦我这样做了,在进行本地部署后,花就会暴露在 localhost:5555 上。奇迹般有效!

于 2018-07-30T21:08:29.837 回答