Skip to content

Commit

Permalink
Adds docker-compose and nginx files
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigocaldeira committed Feb 7, 2024
1 parent 7f25582 commit 28e0741
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 0 deletions.
85 changes: 85 additions & 0 deletions participantes/rodrigocaldeira/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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
22 changes: 22 additions & 0 deletions participantes/rodrigocaldeira/nginx.conf
Original file line number Diff line number Diff line change
@@ -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;
}
}
}

0 comments on commit 28e0741

Please sign in to comment.