Skip to content

Commit

Permalink
Fix celery broker issue
Browse files Browse the repository at this point in the history
  • Loading branch information
bibekme committed Feb 15, 2023
1 parent 3c8ba80 commit e287ab4
Show file tree
Hide file tree
Showing 43 changed files with 25 additions and 18 deletions.
1 change: 1 addition & 0 deletions .env.dev-sample
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ SQL_PASSWORD=hello_django
SQL_HOST=db
SQL_PORT=5432
DATABASE=postgres
CELERY_BROKER_URL=amqp://guest:guest@rabbitmq:5672//
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion app/core/__init__.py

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 1 addition & 4 deletions app/core/settings.py → core/settings.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
"""
Django settings for hello_django project.
Generated by 'django-admin startproject' using Django 3.2.6.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""
Expand Down Expand Up @@ -141,5 +138,5 @@
AUTH_USER_MODEL = "users.User"

CELERY_BROKER_URL = os.environ.get(
"CELERY_BROKER_URL", default="redis://localhost:6379"
"CELERY_BROKER_URL", "amqp://guest:guest@rabbit:5672//"
)
File renamed without changes.
File renamed without changes.
File renamed without changes.
34 changes: 22 additions & 12 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
version: "3.8"
version: "3.9"

services:
web:
build: ./app
build: .
command: python manage.py runserver 0.0.0.0:8000
volumes:
- ./app/:/usr/src/app/
- ./:/usr/src/app/
ports:
- 8000:8000
env_file:
Expand All @@ -20,33 +20,44 @@ services:
- POSTGRES_USER=hello_django
- POSTGRES_PASSWORD=hello_django
- POSTGRES_DB=hello_django_dev

rabbitmq:
image: rabbitmq:3-management
container_name: rabbitmq
restart: always
image: rabbitmq:3.9-alpine
volumes:
- rabbitmq_data:/var/lib/rabbitmq

hostname: rabbitmq
environment:
- RABBITMQ_DEFAULT_USER=guest
- RABBITMQ_DEFAULT_PASS=guest
- RABBITMQ_DEFAULT_VHOST=/
ports:
- 5672:5672
- 15672:15672
celeryworker:
container_name: celeryworker
restart: always
build: ./app
build: .
env_file:
- ./.env.dev
command: celery -A core worker --pool=prefork -l info
depends_on:
- rabbitmq

celeryscheduler:
container_name: celeryscheduler
restart: always
build: ./app
build: .
env_file:
- ./.env.dev
command: celery -A core beat -l info
depends_on:
- celeryworker

celeryflower:
container_name: celeryflower
restart: always
build: ./app
build: .
env_file:
- ./.env.dev
command: celery -A core flower -l info
ports:
- 5555:5555
Expand All @@ -56,4 +67,3 @@ services:

volumes:
postgres_data:
rabbitmq_data:
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion app/requirements.txt → requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ click==8.1.3
click-didyoumean==0.3.0
click-plugins==1.1.1
click-repl==0.2.0
Django==3.2.6
Django==4.1.7
django-shortuuidfield==0.1.3
flower==1.2.0
gunicorn==20.1.0
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file added users/migrations/__init__.py
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit e287ab4

Please sign in to comment.