name: vp-lab2 services: api: build: . ports: - "127.0.0.1:8080:8080" environment: DATABASE_URL_FILE: /run/secrets/database_url CACHE_URL: redis://redis:6379/0 SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600} secrets: [database_url] depends_on: db: condition: service_healthy healthcheck: test: [CMD, python, -c, "import urllib.request; urllib.request.urlopen('http://localhost:8080/health/ready', timeout=5)"] interval: 5s timeout: 6s retries: 12 mem_limit: 512m cpus: 2 db: image: postgres:16.6-bookworm environment: POSTGRES_USER: messenger POSTGRES_DB: messenger POSTGRES_PASSWORD_FILE: /run/secrets/db_password secrets: [db_password] volumes: [pgdata:/var/lib/postgresql/data] healthcheck: test: [CMD-SHELL, "pg_isready -U messenger -d messenger"] interval: 3s timeout: 3s retries: 20 mem_limit: 512m cpus: 1 redis: image: redis:7.4.1-bookworm command: [redis-server, --maxmemory, 64mb, --maxmemory-policy, allkeys-lru, --save, "", --appendonly, "no"] mem_limit: 128m cpus: 0.5 volumes: pgdata: secrets: db_password: file: ./secrets/db_password database_url: file: ./secrets/database_url