name: highload-lab3-bench services: db: image: postgres:16.10-bookworm cpus: 1.0 mem_limit: 512m environment: POSTGRES_DB: benchmark POSTGRES_USER: benchmark POSTGRES_PASSWORD: ${BENCH_PASSWORD:?prepare the private environment first} volumes: [bench_db:/var/lib/postgresql/data] networks: [data] healthcheck: test: [CMD-SHELL, 'pg_isready -U benchmark -d benchmark'] interval: 1s timeout: 3s retries: 60 redis: image: redis:7.4.11-bookworm cpus: 0.25 mem_limit: 128m command: [redis-server, --appendonly, 'yes', --appendfsync, everysec, --dir, /data] volumes: [bench_redis:/data] networks: [data] healthcheck: test: [CMD, redis-cli, ping] interval: 1s timeout: 3s retries: 60 migrate: image: highload-lab3-bench-api:baseline cpus: 0.5 mem_limit: 128m networks: [data] environment: DATABASE_URL: postgres://benchmark:${BENCH_PASSWORD}@db:5432/benchmark?sslmode=disable command: [./messenger, migrate, up] depends_on: db: {condition: service_healthy} api: image: ${BENCH_IMAGE:-highload-lab3-bench-api:baseline} cpus: ${BENCH_CPU:-0.5} mem_limit: ${BENCH_MEMORY:-128m} deploy: replicas: ${BENCH_REPLICAS:-2} stop_grace_period: 15s networks: [proxy, data] environment: DATABASE_URL: postgres://benchmark:${BENCH_PASSWORD}@db:5432/benchmark?sslmode=disable DATABASE_MAX_CONNS: ${BENCH_POOL:-6} BENCH_POOL_STATS: '1' GOMAXPROCS: ${BENCH_GOMAXPROCS:-} REDIS_ADDR: redis:6379 SESSION_TTL_SECONDS: 86400 APP_PORT: 8080 APP_HOST: 0.0.0.0 healthcheck: test: [CMD, ./messenger, healthcheck] interval: 1s timeout: 3s retries: 60 depends_on: migrate: {condition: service_completed_successfully} redis: {condition: service_healthy} haproxy: image: haproxy:3.2.25-alpine cpus: 0.5 mem_limit: 128m ports: ['127.0.0.1:18080:8080', '127.0.0.1:18404:8404'] networks: [edge, proxy] volumes: - ./experiments/lab3-scale/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro depends_on: api: {condition: service_healthy} volumes: bench_db: bench_redis: networks: edge: proxy: {internal: true} data: {internal: true}