forked from mtusi2026/mtusi2026lab2
81 lines
1.8 KiB
YAML
81 lines
1.8 KiB
YAML
services:
|
|
api:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
image: mtusi-messenger:lab2
|
|
ports:
|
|
- "127.0.0.1:8080:8080"
|
|
environment:
|
|
APP_HOST: 0.0.0.0
|
|
APP_PORT: "8080"
|
|
APP_ENV: lab
|
|
LOG_LEVEL: info
|
|
SHUTDOWN_GRACE_SECONDS: "10"
|
|
SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600}
|
|
CACHE_TTL_SECONDS: ${CACHE_TTL_SECONDS:-60}
|
|
SESSION_STORE: redis
|
|
DATABASE_URL: postgresql://messenger:${POSTGRES_PASSWORD}@postgres:5432/messenger
|
|
REDIS_URL: redis://redis:6379/0
|
|
DB_POOL_MIN: "1"
|
|
DB_POOL_MAX: "10"
|
|
DB_COMMAND_TIMEOUT: "5"
|
|
DB_CONNECT_TIMEOUT: "5"
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
restart: unless-stopped
|
|
mem_limit: 512m
|
|
cpus: "1.0"
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-fsS", "http://127.0.0.1:8080/health/ready"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 12
|
|
start_period: 20s
|
|
|
|
postgres:
|
|
image: postgres:16.6-alpine
|
|
environment:
|
|
POSTGRES_USER: messenger
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
|
POSTGRES_DB: messenger
|
|
volumes:
|
|
- pg_data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U messenger -d messenger"]
|
|
interval: 3s
|
|
timeout: 3s
|
|
retries: 20
|
|
restart: unless-stopped
|
|
mem_limit: 512m
|
|
cpus: "1.0"
|
|
|
|
redis:
|
|
image: redis:7.4.2-alpine
|
|
command:
|
|
- redis-server
|
|
- --appendonly
|
|
- "yes"
|
|
- --appendfsync
|
|
- everysec
|
|
- --save
|
|
- "60"
|
|
- "1"
|
|
volumes:
|
|
- redis_data:/data
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 3s
|
|
timeout: 3s
|
|
retries: 20
|
|
restart: unless-stopped
|
|
mem_limit: 128m
|
|
cpus: "0.50"
|
|
|
|
volumes:
|
|
pg_data:
|
|
redis_data:
|