-
Notifications
You must be signed in to change notification settings - Fork 932
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7f25582
commit 28e0741
Showing
2 changed files
with
107 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} | ||
} |