forked from mtusi2026/mtusi2026lab2
94 lines
2.4 KiB
YAML
94 lines
2.4 KiB
YAML
name: mtusi-lab2
|
|
services:
|
|
postgres:
|
|
image: postgres:17.6-alpine3.22
|
|
environment:
|
|
POSTGRES_USER: messenger
|
|
POSTGRES_DB: messenger
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?Run python scripts/bootstrap.py}
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: [CMD-SHELL, 'pg_isready -U messenger -d messenger']
|
|
interval: 2s
|
|
timeout: 2s
|
|
retries: 30
|
|
cpus: 1.0
|
|
mem_limit: 512m
|
|
restart: unless-stopped
|
|
redis:
|
|
image: redis:7.4.5-alpine3.21
|
|
command: [redis-server, /etc/redis/redis.conf]
|
|
volumes:
|
|
- redis_data:/data
|
|
- ./infra/redis.conf:/etc/redis/redis.conf:ro
|
|
healthcheck:
|
|
test: [CMD, redis-cli, ping]
|
|
interval: 2s
|
|
timeout: 2s
|
|
retries: 30
|
|
cpus: 0.5
|
|
mem_limit: 128m
|
|
restart: unless-stopped
|
|
restore:
|
|
profiles: [research]
|
|
image: postgres:17.6-alpine3.22
|
|
environment:
|
|
POSTGRES_USER: messenger
|
|
POSTGRES_DB: restore_validation
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?Run python scripts/bootstrap.py}
|
|
volumes:
|
|
- restore_data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: [CMD-SHELL, 'pg_isready -U messenger -d restore_validation']
|
|
interval: 2s
|
|
timeout: 2s
|
|
retries: 30
|
|
cpus: 1.0
|
|
mem_limit: 512m
|
|
api:
|
|
image: mtusi-messenger:lab2
|
|
build: .
|
|
environment:
|
|
APP_HOST: 0.0.0.0
|
|
APP_PORT: 8080
|
|
DATABASE_URL_FILE: /run/secrets/database_url
|
|
CACHE_URL_FILE: /run/secrets/cache_url
|
|
SESSION_STORE: postgres
|
|
SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600}
|
|
DB_MAX_CONNECTIONS: 8
|
|
DB_TIMEOUT_MS: 2000
|
|
MAX_IN_FLIGHT: 64
|
|
MAX_BODY_BYTES: 1048576
|
|
KDF_CONCURRENCY: 4
|
|
ports:
|
|
- '127.0.0.1:${HOST_PORT:-8080}:8080'
|
|
secrets:
|
|
- database_url
|
|
- cache_url
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: [CMD, wget, -q, -O, /dev/null, 'http://127.0.0.1:8080/health/ready']
|
|
interval: 2s
|
|
timeout: 3s
|
|
retries: 30
|
|
cpus: 1.0
|
|
mem_limit: 512m
|
|
read_only: true
|
|
cap_drop: [ALL]
|
|
security_opt: [no-new-privileges:true]
|
|
restart: unless-stopped
|
|
volumes:
|
|
postgres_data:
|
|
redis_data:
|
|
restore_data:
|
|
secrets:
|
|
database_url:
|
|
file: ./secrets/database_url
|
|
cache_url:
|
|
file: ./secrets/cache_url
|