Files
mtusi2026lab2/compose.yaml
T
Xabenskie 990a36c95f
Application acceptance / api (pull_request) Canceled after 0s
Skeleton contracts / contracts (pull_request) Canceled after 0s
[+] lab 2
2026-11-02 11:02:27 +03:00

56 lines
1.6 KiB
YAML

name: mtusi-lab2
services:
postgres:
image: postgres:17.5-bookworm
environment:
POSTGRES_DB: messenger
POSTGRES_USER: messenger
POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password
secrets: [postgres_password]
volumes: [postgres_data:/var/lib/postgresql/data]
healthcheck:
test: [CMD-SHELL, 'pg_isready -U messenger -d messenger']
interval: 2s
timeout: 2s
retries: 30
mem_limit: 512m
cpus: 1.0
redis:
image: redis:7.4.4-bookworm
command: [redis-server, --appendonly, 'yes', --maxmemory, 64mb, --maxmemory-policy, allkeys-lru]
volumes: [redis_data:/data]
healthcheck:
test: [CMD, redis-cli, ping]
interval: 2s
timeout: 2s
retries: 30
mem_limit: 128m
cpus: 0.5
api:
image: mtusi-lab2-api:lab2
build: .
environment:
DATABASE_URL_FILE: /run/secrets/database_url
CACHE_URL_FILE: /run/secrets/cache_url
SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600}
POOL_MAX_SIZE: '8'
secrets: [database_url, cache_url]
ports: ['127.0.0.1:8080:8080']
depends_on:
postgres: {condition: service_healthy}
redis: {condition: service_healthy}
healthcheck:
test: [CMD, python, -c, "import urllib.request; urllib.request.urlopen('http://localhost:8080/health/ready', timeout=2)"]
interval: 2s
timeout: 3s
retries: 30
mem_limit: 512m
cpus: 1.0
secrets:
postgres_password: {file: ./secrets/postgres_password}
database_url: {file: ./secrets/database_url}
cache_url: {file: ./secrets/cache_url}
volumes:
postgres_data:
redis_data: