name: mtusi-lab3 x-postgres: &postgres image: postgres:17.6-bookworm environment: POSTGRES_USER: messenger POSTGRES_DB: messenger POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password secrets: [postgres_password] cpus: 1 mem_limit: 512m healthcheck: test: ["CMD-SHELL", "pg_isready -U messenger -d messenger"] interval: 2s timeout: 3s retries: 30 services: postgres: <<: *postgres volumes: [postgres_data:/var/lib/postgresql/data] valkey: image: valkey/valkey:8.1.3 command: ["valkey-server", "--appendonly", "yes", "--appendfsync", "always", "--save", "", "--maxmemory", "64mb", "--maxmemory-policy", "noeviction"] volumes: [valkey_data:/data] cpus: 0.5 mem_limit: 128m healthcheck: test: ["CMD", "valkey-cli", "ping"] interval: 2s timeout: 3s retries: 30 api: image: mtusi-messenger:lab3 build: . env_file: .env environment: SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600} secrets: [database_url, cache_url] ports: ["127.0.0.1:${HOST_PORT:-8080}:8080"] cpus: 1 mem_limit: 256m depends_on: postgres: {condition: service_healthy} valkey: {condition: service_healthy} stop_grace_period: 10s postgres-restore: <<: *postgres profiles: [research] volumes: [restore_data:/var/lib/postgresql/data] volumes: postgres_data: valkey_data: restore_data: secrets: postgres_password: file: ./secrets/postgres_password database_url: file: ./secrets/database_url cache_url: file: ./secrets/cache_url