Tyrel Kostyk
Tyrel Kostyk

Reputation: 535

Flower - Celery async task monitoring tool - On Flask/Docker web API

Having trouble running Flower to monitor the celery async tasks that are running on my docker-deployed flask app. I've tried everything but the documentation on getting flower running in a docker deployed environment is pretty sparse & I'm still relatively new to this.

The web & celery & flower portions of my docker-compose.yml file

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

When I deploy this locally through docker (such that I can access the Web API via localhost), it works fine & I can see through the celery logs that the app is running and handling async requests smoothly. However, when I try to access the flower monitoring app by executing $ flower & going to http://localhost:5555, the flower app loads but no threads or workers are shown. Any advice or help would be greatly appreciated!

Upvotes: 1

Views: 1382

Answers (1)

Tyrel Kostyk
Tyrel Kostyk

Reputation: 535

Wow. Made a silly oversight & forgot to include flower==0.9.2 in my requirements.txt file in my app. Once I did that, flower was exposed on localhost:5555 after doing a local deployment. Works like a charm!

Upvotes: 0

Related Questions