forked from zanfranceschi/rinha-de-backend-2024-q1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
78 lines (73 loc) · 1.72 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
version: '3.8'
services:
api1: &api
image: felipebossolani/rinha-de-backend-2024-q01-dotnet9
container_name: api1
hostname: api1
ports:
- "8080:8080"
environment:
- ConnectionStrings__rinha=Host=db;Database=rinha;Username=user;Password=password;Pooling=true;Minimum Pool Size=0;Maximum Pool Size=100;
depends_on:
db:
condition: service_healthy
networks:
- app-network
deploy:
resources:
limits:
cpus: '0.4'
memory: '200MB'
api2:
<<: *api
hostname: api2
container_name: api2
ports:
- "8081:8080"
nginx:
image: nginx:latest
container_name: nginx
restart: on-failure
volumes:
- ./infra/nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
- api1
- api2
ports:
- "9999:9999"
deploy:
resources:
limits:
cpus: "0.2"
memory: "20MB"
networks:
- app-network
db:
image: postgres:latest
container_name: db
hostname: db
command: 'postgres -c max_connections=1000 -c shared_buffers=128MB -c synchronous_commit=off -c fsync=off -c full_page_writes=off'
environment:
- POSTGRES_PASSWORD=password
- POSTGRES_USER=user
- POSTGRES_DB=rinha
ports:
- "5432:5432"
volumes:
- ./db/01_ddl.sql:/docker-entrypoint-initdb.d/01_ddl.sql:ro
- ./db/02_dml.sql:/docker-entrypoint-initdb.d/02_dml.sql:ro
deploy:
resources:
limits:
cpus: '0.5'
memory: '500MB'
networks:
- app-network
healthcheck:
test: ["CMD", "pg_isready", "--username", "rinha"]
interval: 5s
timeout: 5s
retries: 20
start_period: 10s
networks:
app-network: