services: api1: image: payment2:latest restart: always networks: - backend - payment-processor depends_on: - redis - database deploy: resources: limits: cpus: '0.3' memory: '64MB' api2: image: payment2:latest restart: always depends_on: - redis - database networks: - backend - payment-processor deploy: resources: limits: cpus: '0.3' memory: '64MB' api3: image: payment2:latest restart: always depends_on: - redis - database networks: - backend - payment-processor deploy: resources: limits: cpus: '0.3' memory: '64MB' nginx: image: nginx:latest restart: always ports: - '9999:9999' volumes: - ./nginx.conf:/etc/nginx/nginx.conf networks: - backend depends_on: - api1 - api2 - api3 deploy: resources: limits: cpus: '0.15' memory: '9MB' redis: image: redis:7.2-alpine restart: always platform: linux/amd64 ports: - '6379:6379' networks: - backend deploy: resources: limits: cpus: '0.40' memory: '25MB' database: image: postgres:17-alpine restart: always command: postgres -c checkpoint_timeout=600 -c max_wal_size=4096 -c synchronous_commit=0 -c fsync=0 -c full_page_writes=0 platform: linux/amd64 ports: - '5432:5432' environment: - POSTGRES_DB=payment - POSTGRES_USER=postgres - POSTGRES_PASSWORD=postgres_pwd volumes: - ./init.sql:/docker-entrypoint-initdb.d/init.sql healthcheck: test: ['CMD-SHELL', 'pg_isready -U postgres'] interval: 3s timeout: 3s retries: 5 networks: - backend deploy: resources: limits: cpus: '0.25' memory: '124MB' networks: backend: driver: bridge payment-processor: external: true volumes: db_volume: redis_data: