Skip to content

Instantly share code, notes, and snippets.

@Odilhao
Created August 22, 2023 23:16
Show Gist options
  • Save Odilhao/3bcdb5d3226a35373b5f545bc2d524b9 to your computer and use it in GitHub Desktop.
Save Odilhao/3bcdb5d3226a35373b5f545bc2d524b9 to your computer and use it in GitHub Desktop.
version: '3.9'
name: 'rinha-de-backend'
services:
spring-api1:
build: .
hostname: spring-api1
environment:
- SERVER_PORT=8080
- DATABASE_URL=jdbc:postgresql://db-postgresql:5432/rinhadb
- DATABASE_USERNAME=rinha
- DATABASE_PASSWORD=rinha123
depends_on:
- db-postgresql
links:
- db-postgresql
ulimits:
nofile:
soft: 1000000
hard: 1000000
deploy:
resources:
limits:
# cpus: '0.4'
memory: '1.25GB'
networks:
- app-network
spring-api2:
build: .
hostname: spring-api2
environment:
- SERVER_PORT=8080
- DATABASE_URL=jdbc:postgresql://db-postgresql:5432/rinhadb
- DATABASE_USERNAME=rinha
- DATABASE_PASSWORD=rinha123
depends_on:
- db-postgresql
links:
- db-postgresql
ulimits:
nofile:
soft: 1000000
hard: 1000000
deploy:
resources:
limits:
# cpus: '0.4'
memory: '1.25GB'
networks:
- app-network
nginx:
image: nginx:latest
volumes:
- ./config/nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
- spring-api1
- spring-api2
links:
- spring-api1
- spring-api2
ports:
- "9999:9999"
networks:
- app-network
deploy:
resources:
limits:
cpus: '0.2'
memory: '0.25GB'
db-postgresql:
image: postgres:latest
command: "postgres -c max_connections=200 -c shared_buffers=256MB -c synchronous_commit=off -c fsync=off -c full_page_writes=off -c config_file=/etc/postgresql.conf"
hostname: db-postgresql
volumes:
- ./config/postgresql.conf:/etc/postgresql.conf
- ./config/ddl.sql:/docker-entrypoint-initdb.d/ddl.sql
environment:
- POSTGRES_PASSWORD=rinha123
- POSTGRES_USER=rinha
- POSTGRES_DB=rinhadb
ports:
- "5432:5432"
deploy:
resources:
limits:
memory: '0.5GB'
healthcheck:
test: [ "CMD-SHELL", "pg_isready -h db-postgresql" ]
interval: 5s
timeout: 5s
retries: 20
start_period: 10s
networks:
- app-network
networks:
app-network:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment