Skip to content

Commit

Permalink
Add celery and redis to docker-compose
Browse files Browse the repository at this point in the history
  • Loading branch information
okeneo committed Feb 23, 2024
1 parent f60069d commit 17fd9fd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
16 changes: 16 additions & 0 deletions backend/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,22 @@ services:
- ../.env
depends_on:
- postgres-db

celery:
build: .
command: celery -A myproject worker -l INFO
environment:
- CELERY_BROKER=redis://redis:6379/0
env_file:
- ../.env
depends_on:
- api
- redis

redis:
image: redis:7.2.4-alpine
command: redis-server

postgres-db:
image: postgres:16
volumes:
Expand Down
4 changes: 2 additions & 2 deletions backend/myproject/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,12 @@
MAX_TIME_TO_CONFIRM_EMAIL = 3 * 24 * 60 * 60 # 3 days.

# Add username and password to Redis instance before deploying to production.
CELERY_BROKER_URL = "redis://localhost:6379/0"
CELERY_BROKER_URL = "redis://redis:6379/0"

CACHES = {
"default": {
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": "redis://127.0.0.1:6379/1",
"LOCATION": "redis://redis:6379/1",
"OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient",
},
Expand Down

0 comments on commit 17fd9fd

Please sign in to comment.