forked from mtusi2026/mtusi2026lab2
76 lines
1.8 KiB
YAML
76 lines
1.8 KiB
YAML
services:
|
|
postgres:
|
|
image: postgres:17.6
|
|
environment:
|
|
POSTGRES_DB: messenger
|
|
POSTGRES_USER: messenger
|
|
POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password
|
|
secrets:
|
|
- postgres_password
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U messenger -d messenger"]
|
|
interval: 2s
|
|
timeout: 2s
|
|
retries: 30
|
|
restart: unless-stopped
|
|
|
|
redis:
|
|
image: redis:7.4.2-alpine
|
|
command: ["redis-server", "--save", "", "--appendonly", "no", "--maxmemory", "64mb", "--maxmemory-policy", "allkeys-lru"]
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 2s
|
|
timeout: 2s
|
|
retries: 15
|
|
restart: unless-stopped
|
|
|
|
postgres-restore:
|
|
profiles: ["research"]
|
|
image: postgres:17.6
|
|
environment:
|
|
POSTGRES_DB: restore_control
|
|
POSTGRES_USER: messenger
|
|
POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password
|
|
secrets:
|
|
- postgres_password
|
|
volumes:
|
|
- restore_data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U messenger -d restore_control"]
|
|
interval: 2s
|
|
timeout: 2s
|
|
retries: 30
|
|
restart: unless-stopped
|
|
|
|
api:
|
|
build: .
|
|
image: messenger-lab2:local
|
|
environment:
|
|
APP_HOST: 0.0.0.0
|
|
APP_PORT: 8080
|
|
SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600}
|
|
DATABASE_URL_FILE: /run/secrets/database_url
|
|
REDIS_URL: redis:6379
|
|
secrets:
|
|
- database_url
|
|
ports:
|
|
- "127.0.0.1:${API_PORT:-8080}:8080"
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_started
|
|
restart: unless-stopped
|
|
|
|
secrets:
|
|
postgres_password:
|
|
file: ./secrets/postgres_password
|
|
database_url:
|
|
file: ./secrets/database_url
|
|
|
|
volumes:
|
|
postgres_data:
|
|
restore_data:
|