name: mtusi-lab4 services: postgres: image: postgres:17.2-alpine environment: POSTGRES_USER: messenger POSTGRES_DB: messenger POSTGRES_PASSWORD_FILE: /run/secrets/db_password secrets: - db_password volumes: - postgres_data:/var/lib/postgresql/data healthcheck: test: [CMD-SHELL, 'pg_isready -U messenger -d messenger'] interval: 2s timeout: 2s retries: 20 cpus: 1.0 mem_limit: 512m stop_grace_period: 15s migrate: image: mtusi-lab4-api:1.1.0 pull_policy: never command: [python, -m, src.migrate] secrets: - database_url depends_on: postgres: condition: service_healthy cpus: 0.5 mem_limit: 128m api: build: . image: mtusi-lab4-api:1.1.0 environment: SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600} DB_POOL_SIZE: ${DB_POOL_SIZE:-4} S3_ENDPOINT: http://s3:9000 MAX_UPLOAD_BYTES: 10485760 MAX_IMAGE_PIXELS: 40000000 secrets: - database_url - s3_access_key_id - s3_secret_access_key depends_on: s3-bootstrap: condition: service_completed_successfully migrate: condition: service_completed_successfully deploy: replicas: ${API_REPLICAS:-2} cpus: ${API_CPUS:-0.5} mem_limit: ${API_MEMORY:-512m} stop_grace_period: 8s healthcheck: test: [CMD, python, -S, src/healthcheck.py] interval: 2s timeout: 3s retries: 2 start_period: 10s s3: image: chrislusf/seaweedfs:3.85 command: [server, -dir=/data, -ip=s3, -ip.bind=0.0.0.0, -s3, -s3.port=9000, -s3.config=/run/secrets/s3_config, -volume.max=8, -master.volumeSizeLimitMB=128] secrets: - s3_config volumes: - s3_data:/data - ./infra/filer.toml:/etc/seaweedfs/filer.toml:ro cpus: 1.0 mem_limit: 512m healthcheck: test: [CMD, wget, -q, -O, /dev/null, http://localhost:9333/cluster/status] interval: 2s timeout: 2s retries: 30 s3-bootstrap: image: mtusi-lab4-api:1.1.0 pull_policy: never command: [python, -m, src.bootstrap_storage] secrets: - minio_root_user - minio_root_password depends_on: s3: condition: service_healthy lb: image: haproxy:3.0.7-alpine ports: - '127.0.0.1:${PUBLIC_PORT:-8080}:8080' volumes: - ./infra/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro depends_on: api: condition: service_healthy cpus: 0.5 mem_limit: 128m stop_grace_period: 8s secrets: db_password: file: ./secrets/db_password database_url: file: ./secrets/database_url minio_root_user: file: ./secrets/minio_root_user minio_root_password: file: ./secrets/minio_root_password s3_access_key_id: file: ./secrets/s3_access_key_id s3_secret_access_key: file: ./secrets/s3_secret_access_key s3_config: file: ./secrets/s3_config volumes: s3_data: postgres_data: