forked from zanfranceschi/rinha-de-backend-2024-q1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
87 lines (83 loc) · 2.02 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
version: "3.5"
services:
api01: &api
image: jhendrik/rinha-backend-golang-2024:latest
hostname: api01
container_name: rinha-api1
environment:
- RINHA_BACKEND_ENV=production
- RINHA_BACKEND_PORT=8080
- RINHA_BACKEND_TIME_ZONE=-3
- RINHA_BACKEND_DB_HOST=db
- RINHA_BACKEND_DB_PORT=5432
- RINHA_BACKEND_DB_USER=admin
- RINHA_BACKEND_DB_PASS=123
- RINHA_BACKEND_DB_DBNAME=rinha
- RINHA_BACKEND_DB_APPLICATION="Rinha API"
ports:
- "3001:8080"
restart: unless-stopped
depends_on:
db:
condition: service_healthy
deploy:
resources:
limits:
cpus: "0.2"
memory: "10MB"
api02:
<<: *api
hostname: api02
container_name: rinha-api2
environment:
- RINHA_BACKEND_ENV=production
- RINHA_BACKEND_PORT=8081
- RINHA_BACKEND_TIME_ZONE=-3
- RINHA_BACKEND_DB_HOST=db
- RINHA_BACKEND_DB_PORT=5432
- RINHA_BACKEND_DB_USER=admin
- RINHA_BACKEND_DB_PASS=123
- RINHA_BACKEND_DB_DBNAME=rinha
- RINHA_BACKEND_DB_APPLICATION="Rinha API"
ports:
- "3002:8081"
haproxy:
image: haproxy:lts-alpine
container_name: rinha-loadbalance
volumes:
- ./haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
depends_on:
- api01
- api02
ports:
- "9999:9999"
restart: unless-stopped
deploy:
resources:
limits:
cpus: "0.2"
memory: "30MB"
db:
image: postgres:latest
container_name: rinha-db
hostname: db
environment:
- POSTGRES_PASSWORD=123
- POSTGRES_USER=admin
- POSTGRES_DB=rinha
ports:
- "5432:5432"
restart: unless-stopped
volumes:
- ./script.sql:/docker-entrypoint-initdb.d/init.sql
deploy:
resources:
limits:
cpus: "0.4"
memory: "100MB"
healthcheck:
test: ["CMD", "pg_isready", "--username", "rinha"]
interval: 5s
timeout: 5s
retries: 20
start_period: 10s