[Django]-Setting up docker-compose.yml to run celery worker and celery beat for a django project with redis as broker

3๐Ÿ‘

I am using the same tech stack . This works fine for me.
docker-compose.yml

redis:
    image: redis
    container_name: redis
    command: ["redis-server", "--port", "${REDIS_PORT}", "--appendonly", "yes","--maxmemory", "1gb", "--maxmemory-policy", "allkeys-lru"]
    ports:
        - "${REDIS_PORT}:${REDIS_PORT}"
    volumes:
        - .:/redis.conf
    networks:
        - pipeline-net

celery-worker:
    build:
    context: ./app
    container_name: celery-worker
    entrypoint: celery
    command: -A celery_app.celery worker --loglevel=info
    volumes:
    - .:/var/www/app/worker
    links:
    - redis
    depends_on:
    - redis
    networks:
    - pipeline-net

celery-beat:
    build:
    context: ./app
    container_name: celery-beat
    entrypoint: celery
    command: -A celery_app.celery beat --loglevel=info
    volumes:
    - .:/var/www/app/beat
    links:
    - celery-worker
    - redis
    depends_on:
    - celery-worker
    - redis
    networks:
    - pipeline-net

flower:
    image: mher/flower
    container_name: flower
    environment:
    - CELERY_BROKER_URL=redis://redis:6379
    - FLOWER_PORT=8888
    ports:
    - 8888:8888
    links:
    - redis
    - celery-worker
    - celery-beat
    depends_on:
    - redis
    - celery-worker
    - celery-beat
    networks:
    - pipeline-net
๐Ÿ‘คetotientz

Leave a comment