version: '3.5' services: api1: &app image: marcosisocram/rinha-2024-q1:latest hostname: api1 network_mode: "host" depends_on: db: condition: service_healthy expose: - "8180" environment: - PORT=8180 - DB_URL=jdbc:postgresql://localhost:5433/postgres - DB_USER=user - DB_PASSWORD=rinha-de-bK - DB_POOLSIZE=20 deploy: resources: limits: cpus: '0.325' memory: "90MB" api2: # API - Instância 02 <<: *app expose: - "8280" environment: - PORT=8280 - DB_URL=jdbc:postgresql://localhost:5433/postgres - DB_USER=user - DB_PASSWORD=rinha-de-bK - DB_POOLSIZE=20 hostname: api2 db: image: postgres:latest hostname: db network_mode: "host" environment: - POSTGRES_PASSWORD=rinha-de-bK - POSTGRES_USER=user - POSTGRES_DB=postgres - PGPORT=5433 expose: - "5433" volumes: - ./init.sql:/docker-entrypoint-initdb.d/init.sql - ./postgresql.conf:/docker-entrypoint-initdb.d/postgresql.conf healthcheck: test: [ "CMD-SHELL", "pg_isready" ] interval: 5s timeout: 5s retries: 5 deploy: resources: limits: cpus: '0.55' memory: '300MB' nginx-rinha: # Load Balancer image: nginx:latest network_mode: "host" volumes: - ./nginx.conf:/etc/nginx/nginx.conf:ro depends_on: - api1 - api2 expose: - "9999" deploy: resources: limits: cpus: '0.3' memory: '70MB'