You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
105 lines
2.5 KiB
105 lines
2.5 KiB
services:
|
|
db:
|
|
image: postgres:16-alpine
|
|
container_name: divar_postgres
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_DB: ${POSTGRES_DB:-divar_crawler}
|
|
POSTGRES_USER: ${POSTGRES_USER:-postgres}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: [ "CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres} -d ${POSTGRES_DB:-divar_crawler}" ]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
redis:
|
|
image: redis:7-alpine
|
|
container_name: divar_redis
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: [ "CMD", "redis-cli", "ping" ]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 5
|
|
|
|
backend:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile.backend
|
|
container_name: divar_backend
|
|
restart: unless-stopped
|
|
command: gunicorn config.wsgi:application --bind 0.0.0.0:8000 --workers 4
|
|
ports:
|
|
- "${BACKEND_HOST_PORT:-8000}:8000"
|
|
environment:
|
|
- REDIS_URL=redis://redis:6379/0
|
|
- POSTGRES_HOST=db
|
|
- CELERY_TASK_ALWAYS_EAGER=False
|
|
env_file:
|
|
- .env
|
|
volumes:
|
|
- ./backend:/app/backend
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
|
|
celery:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile.backend
|
|
container_name: divar_celery
|
|
restart: unless-stopped
|
|
command: celery -A config worker --loglevel=info -P gevent -c 20
|
|
environment:
|
|
- REDIS_URL=redis://redis:6379/0
|
|
- POSTGRES_HOST=db
|
|
- CELERY_TASK_ALWAYS_EAGER=False
|
|
env_file:
|
|
- .env
|
|
volumes:
|
|
- ./backend:/app/backend
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
|
|
celery_beat:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile.backend
|
|
container_name: divar_celery_beat
|
|
restart: unless-stopped
|
|
command: celery -A config beat --loglevel=info --scheduler django_celery_beat.schedulers:DatabaseScheduler
|
|
environment:
|
|
- REDIS_URL=redis://redis:6379/0
|
|
- POSTGRES_HOST=db
|
|
- CELERY_TASK_ALWAYS_EAGER=False
|
|
env_file:
|
|
- .env
|
|
volumes:
|
|
- ./backend:/app/backend
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
|
|
frontend:
|
|
build:
|
|
context: .
|
|
dockerfile: frontend/Dockerfile
|
|
container_name: divar_frontend
|
|
restart: unless-stopped
|
|
ports:
|
|
- "${HTTP_PORT:-8080}:80"
|
|
depends_on:
|
|
- backend
|
|
|
|
volumes:
|
|
postgres_data:
|