I have setup django project using django cookiecutter. The project scaffolding is excellent. I also opted to use docker along with it. Now I am struggling with getting celery v4.0.x working in the whole setup.
This is my docker-compose.yml
version: '2' volumes: postgres_data_dev: {} postgres_backup_dev: {} services: postgres: build: ./compose/postgres volumes: - postgres_data_dev:/var/lib/postgresql/data - postgres_backup_dev:/backups environment: - POSTGRES_USER=application django: build: context: . dockerfile: ./compose/django/development/Dockerfile depends_on: - postgres environment: - POSTGRES_USER=application - USE_DOCKER=yes volumes: - .:/app - /tmp/ links: - postgres - redis expose: - "8000" env_file: - ./dev.env restart: - "on-failure" nginx: build: context: . dockerfile: ./compose/nginx/development/Dockerfile depends_on: - django ports: - "0.0.0.0:80:80" links: - django volumes_from: - django redis: image: redis:latest hostname: redis celeryworker: build: context: . dockerfile: ./compose/django/development/Dockerfile env_file: ./dev.env depends_on: - postgres - redis command: celery -A application.taskapp worker -l INFO restart: "on-failure" celerybeat: build: context: . dockerfile: ./compose/django/development/Dockerfile env_file: ./dev.env depends_on: - postgres - redis command: celery -A application.taskapp beat -l INFO Quite honestly I feel there seems to be some tiny issue with config for celerybeat/celeryworker service. It would be nice if someone can point it out.
Update:
When I execute the command to run the containers, I get an error saying that application could not be found
Update
This is the new compose file which ironed out few errors in my compose. Somewhere along the way of getting it all working I also came across thread where someone had mentioned that ordering of the services mattered as well. So in the new version, django is placed first.
version: '2' volumes: postgres_data_dev: {} postgres_backup_dev: {} services: django: &django build: context: . dockerfile: ./compose/django/development/Dockerfile depends_on: - postgres volumes: - .:/app - /tmp/ links: - postgres - redis environment: - POSTGRES_USER=application - USE_DOCKER=yes expose: - "8000" env_file: - ./dev.env postgres: build: ./compose/postgres volumes: - postgres_data_dev:/var/lib/postgresql/data - postgres_backup_dev:/backups environment: - POSTGRES_USER=application ports: - "5432:5432" redis: image: redis:latest hostname: redis ports: - "0.0.0.0:6379:6379" env_file: - ./dev.env nginx: build: context: . dockerfile: ./compose/nginx/development/Dockerfile depends_on: - django ports: - "0.0.0.0:80:80" links: - django volumes_from: - django celeryworker: <<: *django depends_on: - redis - postgres command: "celery -A application.taskapp worker --loglevel INFO --uid taskmaster"