155 lines
3.3 KiB
YAML
155 lines
3.3 KiB
YAML
x-common-env: &common-env
|
|
DATABASE_URL: postgresql://mpr_user:mpr_pass@postgres:5432/mpr
|
|
REDIS_URL: redis://redis:6379/0
|
|
DJANGO_SETTINGS_MODULE: mpr.settings
|
|
DEBUG: 1
|
|
GRPC_HOST: grpc
|
|
GRPC_PORT: 50051
|
|
|
|
x-healthcheck-defaults: &healthcheck-defaults
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
services:
|
|
# =============================================================================
|
|
# Infrastructure
|
|
# =============================================================================
|
|
|
|
postgres:
|
|
image: postgres:15-alpine
|
|
environment:
|
|
POSTGRES_DB: mpr
|
|
POSTGRES_USER: mpr_user
|
|
POSTGRES_PASSWORD: mpr_pass
|
|
ports:
|
|
- "5436:5432"
|
|
volumes:
|
|
- postgres-data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
<<: *healthcheck-defaults
|
|
test: ["CMD-SHELL", "pg_isready -U mpr_user -d mpr"]
|
|
|
|
redis:
|
|
image: redis:7-alpine
|
|
ports:
|
|
- "6381:6379"
|
|
volumes:
|
|
- redis-data:/data
|
|
healthcheck:
|
|
<<: *healthcheck-defaults
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
|
|
nginx:
|
|
image: nginx:alpine
|
|
ports:
|
|
- "80:80"
|
|
volumes:
|
|
- ./nginx.conf:/etc/nginx/nginx.conf:ro
|
|
- ../media:/app/media:ro
|
|
depends_on:
|
|
- django
|
|
- fastapi
|
|
- timeline
|
|
|
|
# =============================================================================
|
|
# Application Services
|
|
# =============================================================================
|
|
|
|
django:
|
|
build:
|
|
context: ..
|
|
dockerfile: ctrl/Dockerfile
|
|
command: >
|
|
bash -c "python manage.py migrate &&
|
|
python manage.py loadbuiltins || true &&
|
|
python manage.py runserver 0.0.0.0:8701"
|
|
ports:
|
|
- "8701:8701"
|
|
environment:
|
|
<<: *common-env
|
|
volumes:
|
|
- ..:/app
|
|
- ../media:/app/media
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
|
|
fastapi:
|
|
build:
|
|
context: ..
|
|
dockerfile: ctrl/Dockerfile
|
|
command: uvicorn api.main:app --host 0.0.0.0 --port 8702 --reload
|
|
ports:
|
|
- "8702:8702"
|
|
environment:
|
|
<<: *common-env
|
|
volumes:
|
|
- ..:/app
|
|
- ../media:/app/media
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
|
|
grpc:
|
|
build:
|
|
context: ..
|
|
dockerfile: ctrl/Dockerfile
|
|
command: python -m grpc.server
|
|
ports:
|
|
- "50052:50051"
|
|
environment:
|
|
<<: *common-env
|
|
GRPC_PORT: 50051
|
|
GRPC_MAX_WORKERS: 10
|
|
volumes:
|
|
- ..:/app
|
|
- ../media:/app/media
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
|
|
celery:
|
|
build:
|
|
context: ..
|
|
dockerfile: ctrl/Dockerfile
|
|
command: celery -A mpr worker -l info -Q default -c 2
|
|
environment:
|
|
<<: *common-env
|
|
MPR_EXECUTOR: local
|
|
volumes:
|
|
- ..:/app
|
|
- ../media:/app/media
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
grpc:
|
|
condition: service_started
|
|
|
|
timeline:
|
|
build:
|
|
context: ../ui/timeline
|
|
dockerfile: Dockerfile
|
|
ports:
|
|
- "5173:5173"
|
|
volumes:
|
|
- ../ui/timeline/src:/app/src
|
|
|
|
volumes:
|
|
postgres-data:
|
|
redis-data:
|
|
|
|
networks:
|
|
default:
|
|
name: mpr
|
|
|
|
name: mpr
|