forked from zanfranceschi/rinha-de-backend-2024-q1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
75 lines (74 loc) · 1.95 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
version: '3.9'
name: 'rinha-backend-praeiro'
services:
api1: &api
image: andrepraeiro/rinha-praeiro:latest
hostname: api1
container_name: rinhaapi1
environment:
- ConnectionStrings__rinha=Host=db;Database=rinha;Username=rinha;Password=rinha;Pooling=true;Minimum Pool Size=10;Maximum Pool Size=15;Multiplexing=true;Timeout=120;Command Timeout=120;Cancellation Timeout=-1;No Reset On Close=true;Max Auto Prepare=20;Auto Prepare Min Usages=1;
depends_on:
db:
condition: service_healthy
networks:
- app-network
ulimits:
nofile:
soft: 1000000
hard: 1000000
deploy:
resources:
limits:
cpus: '0.42'
memory: '70MB'
api2:
<<: *api
hostname: api2
container_name: rinhaapi2
db:
image: postgres:alpine
container_name: rinhadb
hostname: database
command: postgres -c max_connections=500 -c shared_buffers=50MB -c synchronous_commit=off -c fsync=off -c full_page_writes=off
environment:
- POSTGRES_PASSWORD=rinha
- POSTGRES_USER=rinha
- POSTGRES_DB=rinha
ports:
- "5432:5432"
networks:
- app-network
volumes:
- ./Sql/init.sql:/docker-entrypoint-initdb.d/01-init.sql
- ./Sql/reset.sql:/docker-entrypoint-initdb.d/02-reset.sql
- ./Sql/criartransacao.sql:/docker-entrypoint-initdb.d/03-criartransacao.sql
healthcheck:
test: ["CMD", "pg_isready", "--username", "rinha"]
interval: 5s
timeout: 5s
retries: 20
start_period: 10s
deploy:
resources:
limits:
cpus: '0.5'
memory: '390MB'
nginx:
image: nginx
container_name: rinha_nginx
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
- api1
- api2
ports:
- "9999:9999"
networks:
- app-network
deploy:
resources:
limits:
cpus: '0.2'
memory: '20MB'
networks:
app-network: