forked from zanfranceschi/rinha-de-backend-2024-q1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
96 lines (84 loc) · 2.12 KB
/
docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
version: "3.5"
services:
api1: &api
image: docker.io/weversonlemos/rinha-v2:latest
pull_policy: always
hostname: api1
container_name: api1-rb
depends_on:
postgres:
condition: service_healthy
network_mode: host
env_file:
- ./config/.env
environment:
SERVER_PORT: 8080
deploy:
resources:
limits:
cpus: "0.50"
memory: "80MB"
healthcheck:
test: ["CMD-SHELL", "wget -q --spider http://localhost:8080/clientes/1/extrato || exit 1"]
start_interval: 0.20s
retries: 10
interval: 0.20s
timeout: 0.80s
api2:
<<: *api
hostname: api2
container_name: api2-rb
environment:
SERVER_PORT: 8081
healthcheck:
test: ["CMD-SHELL", "wget -q --spider http://localhost:8081/clientes/1/extrato || exit 1"]
start_interval: 0.20s
retries: 10
interval: 0.20s
timeout: 0.80s
nginx:
image: docker.io/nginx:alpine
container_name: nginx-rb
volumes:
- ./config/nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
api1:
condition: service_healthy
api2:
condition: service_healthy
network_mode: host
deploy:
resources:
limits:
cpus: "0.10"
memory: "20MB"
postgres:
image: docker.io/postgres:16.2
container_name: postgres-rb
environment:
POSTGRES_DB: rinhadb
POSTGRES_USER: rinha
POSTGRES_PASSWORD: rinha
network_mode: host
volumes:
- postgres-data:/var/lib/postgresql/data
- ./config/init.sql:/docker-entrypoint-initdb.d/init.sql
- ./config/postgresql.conf:/docker-entrypoint-initdb.d/postgresql.conf
command: postgres -c config_file=/docker-entrypoint-initdb.d/postgresql.conf
deploy:
resources:
limits:
cpus: "0.40"
memory: "370MB"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U rinha -d rinhadb -h localhost -p 5432"]
start_interval: 1s
retries: 10
interval: 0.50s
timeout: 0.50s
ulimits:
nofile:
soft: 65535
hard: 65535
volumes:
postgres-data: