services: postgres: image: postgres:17-alpine@sha256:b0f9560a2de083e2cc7382e75f808c7381a32852a7ec49117deedb300e552b24 environment: POSTGRES_USER: messenger POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password POSTGRES_DB: messenger secrets: - postgres_password volumes: - pg_data:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U messenger -d messenger"] interval: 5s timeout: 3s retries: 10 start_period: 5s networks: - labnet restart: unless-stopped valkey: image: valkey/valkey:8.1-alpine@sha256:081c2f5cb575efc901aa80ff9cdbd1ec6a301682fd35e1ebb4b0990a4a4a8507 command: ["valkey-server", "--appendonly", "yes", "--save", "60", "1"] volumes: - valkey_data:/data healthcheck: test: ["CMD", "valkey-cli", "ping"] interval: 5s timeout: 3s retries: 10 start_period: 5s networks: - labnet restart: unless-stopped api: build: . image: mtusi-messenger:lab2 ports: - "127.0.0.1:8080:8080" env_file: - .env environment: DATABASE_URL_FILE: /run/secrets/database_url CACHE_URL_FILE: /run/secrets/cache_url SESSION_STORE: postgres SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600} secrets: - database_url - cache_url depends_on: postgres: condition: service_healthy valkey: condition: service_healthy networks: - labnet restart: unless-stopped secrets: postgres_password: file: ./secrets/postgres_password database_url: file: ./secrets/database_url cache_url: file: ./secrets/cache_url volumes: pg_data: valkey_data: networks: labnet: driver: bridge