Add Redis service and Celery configuration to Docker setup

- Introduced Redis service in both docker-compose files for production and development.
- Updated web and celery services to use Redis as the broker and result backend.
- Added necessary environment variables for Celery in settings.py.
- Included new tasks and soil_data apps in Django settings and updated URL routing.
- Updated requirements.txt to include Celery and Redis dependencies.
This commit is contained in:
2026-02-27 13:09:00 +03:30
parent f6ac30aa34
commit 09e0c26c68
26 changed files with 828 additions and 13 deletions
+30 -1
View File
@@ -31,10 +31,16 @@ services:
db:
condition: service_healthy
redis:
image: redis:7-alpine
container_name: ai-redis
ports:
- "6380:6379" # host:container — سرویس‌ها داخل شبکه از redis:6379 استفاده می‌کنند
web:
build: .
container_name: ai-web
command: python manage.py runserver 0.0.0.0:8000
command: ["python", "manage.py", "runserver", "0.0.0.0:8000"]
volumes:
- .:/app
ports:
@@ -43,9 +49,32 @@ services:
- .env
environment:
DB_HOST: db
CELERY_BROKER_URL: redis://redis:6379/0
CELERY_RESULT_BACKEND: redis://redis:6379/0
depends_on:
db:
condition: service_healthy
redis:
condition: service_started
celery:
build: .
container_name: ai-celery
command: celery -A config worker -l info
volumes:
- .:/app
env_file:
- .env
environment:
DB_HOST: db
CELERY_BROKER_URL: redis://redis:6379/0
CELERY_RESULT_BACKEND: redis://redis:6379/0
SKIP_MIGRATE: "1"
depends_on:
db:
condition: service_healthy
redis:
condition: service_started
volumes:
ai_mysql_data: