53 lines
1.7 KiB
YAML
53 lines
1.7 KiB
YAML
services:
|
|
postgres:
|
|
image: postgres:16.8-alpine
|
|
environment:
|
|
POSTGRES_DB: messenger
|
|
POSTGRES_USER: messenger
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD in .env}
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U messenger -d messenger"]
|
|
interval: 3s
|
|
timeout: 2s
|
|
retries: 20
|
|
redis:
|
|
image: redis:7.4.2-alpine
|
|
command: ["redis-server", "--save", "", "--appendonly", "no", "--maxmemory", "128mb", "--maxmemory-policy", "allkeys-lru"]
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 3s
|
|
timeout: 2s
|
|
retries: 20
|
|
api:
|
|
build: .
|
|
environment:
|
|
DATABASE_HOST: postgres
|
|
DATABASE_NAME: messenger
|
|
DATABASE_USER: messenger
|
|
DATABASE_PASSWORD: ${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD in .env}
|
|
REDIS_URL: redis://redis:6379/0
|
|
SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600}
|
|
DB_POOL_SIZE: ${DB_POOL_SIZE:-10}
|
|
CACHE_ENABLED: ${CACHE_ENABLED:-1}
|
|
CACHE_LOCK_ENABLED: ${CACHE_LOCK_ENABLED:-1}
|
|
CACHE_MISS_DELAY_MS: ${CACHE_MISS_DELAY_MS:-0}
|
|
ENABLE_EXPERIMENT_METRICS: ${ENABLE_EXPERIMENT_METRICS:-}
|
|
ports:
|
|
- "127.0.0.1:${APP_PORT:-8080}:8080"
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8080/health/ready', timeout=2).close()"]
|
|
interval: 3s
|
|
timeout: 3s
|
|
start_period: 5s
|
|
retries: 20
|
|
volumes:
|
|
postgres_data:
|