concord/deploy/docker-compose.yml

117 lines
3.4 KiB
YAML

version: "3.9"
services:
postgres:
image: postgres:14-alpine
restart: always
env_file:
- ../.env
environment:
POSTGRES_USER: ${DB_USER:-postgres}
POSTGRES_PASSWORD: ${DB_PASSWORD:-postgres}
POSTGRES_DB: ${DB_NAME:-concord}
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-postgres}"]
interval: 5s
timeout: 5s
retries: 10
redis:
image: redis:7-alpine
restart: always
env_file:
- ../.env
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 10
api:
build:
context: ..
dockerfile: deploy/Dockerfile.api
restart: always
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
healthcheck:
test: [ "CMD", "wget", "-q", "--spider", "http://localhost:8081/health/live" ]
interval: 5s
timeout: 3s
retries: 10
start_period: 10s
env_file:
- ../.env
environment:
DB_HOST: postgres
REDIS_HOST: redis
STORAGE_PATH: /media
STORAGE_URL: /files
volumes:
- /var/www/media/concord:/media
user: "${APP_UID:-33}:${APP_GID:-33}"
ports:
# Bind to localhost only; nginx terminates TLS and proxies to these.
- "127.0.0.1:${HOST_HTTP_PORT:-18080}:8080" # HTTP gateway (internal container port is 8080)
- "127.0.0.1:${HOST_GRPC_PORT:-19000}:9000" # gRPC (internal container port is 9000)
- "127.0.0.1:${HOST_METRICS_PORT:-19100}:9100" # API Prometheus metrics
- "127.0.0.1:${HOST_HEALTH_PORT:-18081}:8081" # API health checks
voice:
build:
context: ..
dockerfile: deploy/Dockerfile.voice
restart: always
depends_on:
api:
condition: service_healthy
env_file:
- ../.env
environment:
# Local voice talks to API over docker network (plaintext gRPC) TODO: add TLS support if needed
REGISTRY_URL: ${REGISTRY_URL_INTERNAL:-api:${GRPC_PORT:-9000}}
# --- Voice identity / placement ---
VOICE_SERVER_ID: ${VOICE_SERVER_ID:-}
VOICE_SERVER_NAME: ${VOICE_SERVER_NAME:-voice-local-1}
VOICE_REGION: ${VOICE_REGION:-ru-west-1}
VOICE_SECRET: ${VOICE_SECRET:-change-me}
# --- UDP media plane ---
VOICE_PUBLIC_HOST: ${VOICE_PUBLIC_HOST:-concord.akarpov.ru}
VOICE_UDP_HOST: ${VOICE_UDP_HOST:-0.0.0.0}
VOICE_UDP_PORT_START: ${VOICE_UDP_PORT_START:-50000}
VOICE_UDP_PORT_END: ${VOICE_UDP_PORT_END:-52000}
# --- Control/metrics/health plane ---
VOICE_CONTROL_PORT: ${VOICE_CONTROL_PORT:-9001}
VOICE_METRICS_PORT: ${VOICE_METRICS_PORT:-9101}
VOICE_HEALTH_PORT: ${VOICE_HEALTH_PORT:-8082}
# Heartbeat / capacity hints
VOICE_HEARTBEAT_INTERVAL: ${VOICE_HEARTBEAT_INTERVAL:-30s}
VOICE_CAPACITY: ${VOICE_CAPACITY:-1000}
ports:
# Voice control (TCP). Exposed only locally for debugging / internal checks.
- "127.0.0.1:${VOICE_CONTROL_HOST_PORT:-19001}:9001"
# Metrics (TCP). Local only.
- "127.0.0.1:${VOICE_METRICS_HOST_PORT:-19101}:9101"
# Health (TCP). Local only.
- "127.0.0.1:${VOICE_HEALTH_HOST_PORT:-18082}:8082"
# UDP media range - PUBLIC
- "${VOICE_UDP_PORT_START:-50000}-${VOICE_UDP_PORT_END:-50049}:50000-50049/udp"
volumes:
postgres_data: