forked from zanfranceschi/rinha-de-backend-2024-q1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
85 lines (82 loc) · 1.78 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
version: '3.5'
services:
api1: &api
image: viniciusgferreira/rinha-api-q1-2024:latest
container_name: rinha-api1
hostname: rinha-api1
restart: always
depends_on:
db:
condition: service_healthy
environment:
APP_PORT: 3000
ports:
- "3000:3000"
networks:
- rinhanet
deploy:
resources:
limits:
cpus: '0.2'
memory: '50MB'
api2:
<<: *api
container_name: rinha-api2
hostname: rinha-api2
networks:
- rinhanet
ports:
- "3001:3001"
environment:
APP_PORT: 3001
nginx:
container_name: rinha-nginx
image: nginx:alpine
restart: always
depends_on:
- api1
- api2
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
ports:
- "9999:9999"
networks:
- rinhanet
deploy:
resources:
limits:
cpus: '0.1'
memory: '30MB'
db: # Banco de dados
image: postgres
container_name: rinha-db
hostname: rinha-db
restart: always
healthcheck:
test: [ "CMD", "pg_isready", "-Upostgres" ]
interval: 10s
timeout: 5s
retries: 30
networks:
- rinhanet
ports:
- "5432:5432"
command: postgres -c 'max_connections=150' -c 'log_error_verbosity=terse' -c 'checkpoint_timeout=800' -c 'max_wal_size=10GB' -c 'effective_cache_size=128MB' -c 'shared_buffers=128MB'
environment:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_DB: rinhadb
deploy:
resources:
limits:
cpus: '1'
memory: '420MB'
volumes:
- pg_data:/var/lib/postgresql/data
- ./script.sql:/docker-entrypoint-initdb.d/script.sql
volumes:
pg_data:
driver: local
networks:
rinhanet:
driver: bridge