Files
mtusi2026lab2/compose.yaml
T
Daria0w0 c0ca56f208
Application checks / application (pull_request) Canceled after 0s
Skeleton contracts / contracts (pull_request) Canceled after 0s
Complete lab2 grade 4 implementation and report
2026-10-10 00:28:43 +03:00

92 lines
2.2 KiB
YAML

name: messenger-lab2
services:
api:
build: .
environment:
SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600}
DATABASE_PASSWORD_FILE: /run/secrets/postgres_password
REDIS_ADDR: redis:6379
secrets:
- postgres_password
ports:
- "127.0.0.1:8080:8080"
depends_on:
postgres:
condition: service_healthy
migrate:
condition: service_completed_successfully
redis:
condition: service_started
stop_grace_period: 15s
redis:
image: redis:7.4.11-alpine
command: ["redis-server", "--save", "", "--appendonly", "no", "--maxmemory", "64mb", "--maxmemory-policy", "allkeys-lru"]
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 3s
timeout: 2s
retries: 10
tmpfs:
- /data
migrate:
image: postgres:17.9-bookworm
environment:
PGHOST: postgres
PGUSER: messenger
PGDATABASE: messenger
PGCONNECT_TIMEOUT: "5"
secrets:
- postgres_password
volumes:
- ./migrations:/migrations:ro
entrypoint: ["/bin/sh", "-ec"]
command:
- 'export PGPASSWORD="$$(cat /run/secrets/postgres_password)"; exec psql -X -f /migrations/apply.psql'
depends_on:
postgres:
condition: service_healthy
dbcheck:
profiles: [tools]
build: .
command: [dbcheck]
environment:
DATABASE_PASSWORD_FILE: /run/secrets/postgres_password
secrets:
- postgres_password
depends_on:
postgres:
condition: service_healthy
healthcheck:
disable: true
postgres:
image: postgres:17.9-bookworm
environment:
POSTGRES_DB: messenger
POSTGRES_USER: messenger
POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password
POSTGRES_INITDB_ARGS: --encoding=UTF8
secrets:
- postgres_password
volumes:
- postgres_data:/var/lib/postgresql/data
- ./migrations:/migrations:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U messenger -d messenger"]
interval: 3s
timeout: 3s
retries: 20
start_period: 10s
stop_grace_period: 30s
secrets:
postgres_password:
file: ./secrets/postgres_password.txt
volumes:
postgres_data: