diff --git a/participantes/rodrigocaldeira/docker-compose.yml b/participantes/rodrigocaldeira/docker-compose.yml new file mode 100644 index 000000000..6fdc312e7 --- /dev/null +++ b/participantes/rodrigocaldeira/docker-compose.yml @@ -0,0 +1,85 @@ +version: "3.5" + +services: + api01: &api + hostname: api01 + image: rodscaldeira/rinha-backend-2024-q1:latest + ports: + - "4000:4000" + environment: + - PHX_HOST=api01 + - SECRET_KEY_BASE="vnbnYw4N0WzDuQieEpv0tzaZCAGfNOzk/M+naf87PNX3yd2fM4COTizm3yVwwHh7" + - DATABASE_URL=postgres://postgres:postgres@db:5432/rinha_backend + depends_on: + db: + condition: service_healthy + deploy: + resources: + limits: + cpus: "0.6" + memory: "200MB" + ulimits: + nproc: 65535 + nofile: + soft: 1000000 + hard: 1000000 + + api02: + <<: *api + hostname: api02 + ports: + - "4001:4001" + depends_on: + - api01 + environment: + - PORT=4001 + - PHX_HOST=api02 + - SECRET_KEY_BASE="yd5mZeRqTh7KqzvBGTPIaN9yuIRoeQuqeeQCJKe8pqAXakf1p4zugNYfUGjp32C+" + - DATABASE_URL=postgres://postgres:postgres@db:5432/rinha_backend + + nginx: + image: nginx:latest + volumes: + - ./nginx.conf:/etc/nginx/nginx.conf:ro + depends_on: + - api01 + - api02 + ports: + - "9999:9999" + deploy: + resources: + limits: + cpus: "0.1" + memory: "50MB" + ulimits: + nproc: 65535 + nofile: + soft: 1000000 + hard: 1000000 + + + db: + image: postgres:latest + hostname: db + environment: + - POSTGRES_PASSWORD=postgres + - POSTGRES_USER=postgres + - POSTGRES_DB=rinha_backend + ports: + - "5432:5432" + deploy: + resources: + limits: + cpus: "0.20" + memory: "100MB" + command: postgres -c max_connections=450 + healthcheck: + test: [ "CMD-SHELL", "pg_isready -U postgres -d rinha_backend" ] + interval: 3s + timeout: 1s + retries: 5 + +networks: + default: + driver: bridge + name: rinha_backend_2024_q1 diff --git a/participantes/rodrigocaldeira/nginx.conf b/participantes/rodrigocaldeira/nginx.conf new file mode 100644 index 000000000..ce1ff0240 --- /dev/null +++ b/participantes/rodrigocaldeira/nginx.conf @@ -0,0 +1,22 @@ +events { + worker_connections 8000; + use epoll; +} + +http { + access_log off; + sendfile on; + + upstream api { + server api01:4000; + server api02:4001; + } + + server { + listen 9999; + + location / { + proxy_pass http://api; + } + } +}