Files
mtusi2026lab2/compose.yaml
T

53 lines
1.3 KiB
YAML

name: lyakhonov-lab2
services:
db:
image: postgres:16.6-alpine
environment:
POSTGRES_USER: messenger
POSTGRES_DB: messenger
POSTGRES_PASSWORD_FILE: /run/secrets/db_password
secrets: [db_password]
volumes: [postgres_data:/var/lib/postgresql/data]
healthcheck:
test: [CMD-SHELL, "pg_isready -U messenger -d messenger"]
interval: 2s
timeout: 3s
retries: 30
cpus: 1
mem_limit: 512m
redis:
image: redis:7.4.1-alpine
command: [redis-server, --maxmemory, 64mb, --maxmemory-policy, allkeys-lru, --save, "", --appendonly, "no"]
volumes: [redis_data:/data]
healthcheck:
test: [CMD, redis-cli, ping]
interval: 2s
timeout: 3s
retries: 20
cpus: 0.5
mem_limit: 128m
api:
build: .
image: lyakhonov-messenger:lab2
environment:
DATABASE_URL_FILE: /run/secrets/database_url
CACHE_URL: redis://redis:6379/0
PROFILE_CACHE_TTL_SECONDS: 60
SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600}
secrets: [database_url]
ports: ["127.0.0.1:8080:8080"]
depends_on:
db:
condition: service_healthy
cpus: 1
mem_limit: 512m
stop_grace_period: 10s
secrets:
db_password:
file: ./secrets/db_password
database_url:
file: ./secrets/database_url
volumes:
redis_data:
postgres_data: