Files
mtusi2026lab2/compose.yaml
DaniilKuznetsovandЮгай Артур Рустамович 8e06e7634f ЛР2 на 3
Co-authored-by: Югай Артур Рустамович <f1ekserr@yandex.ru>
2026-11-16 22:19:31 +03:00

63 lines
1.4 KiB
YAML

name: kuznetsov-lab2
x-app: &app
image: mtusi-messenger:kuznetsov-lab2
build: .
environment:
APP_HOST: 0.0.0.0
APP_PORT: ${APP_PORT:-8080}
APP_ENV: lab
DATABASE_URL_FILE: /run/secrets/database_url
CURSOR_SECRET_FILE: /run/secrets/cursor_key
SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600}
secrets:
- database_url
- cursor_key
services:
db:
image: postgres:17.11-bookworm@sha256:665dc7b37ac52a17e298511414c21d23ffa4e6a6ef6225b3e5d59c7afb35e994
environment:
POSTGRES_USER: messenger
POSTGRES_DB: messenger
POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password
secrets:
- postgres_password
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U messenger -d messenger"]
interval: 2s
timeout: 3s
retries: 30
stop_grace_period: 10s
migrate:
<<: *app
command: ["python", "-m", "src.migrate"]
depends_on:
db:
condition: service_healthy
api:
<<: *app
ports:
- "127.0.0.1:${HTTP_PORT:-18102}:${APP_PORT:-8080}"
depends_on:
db:
condition: service_healthy
migrate:
condition: service_completed_successfully
stop_grace_period: 10s
volumes:
pgdata:
secrets:
postgres_password:
file: ./secrets/postgres_password
database_url:
file: ./secrets/database_url
cursor_key:
file: ./secrets/cursor_key