forked from zanfranceschi/rinha-de-backend-2024-q1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
82 lines (78 loc) · 1.74 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
version: '3.9'
services:
nginx:
image: nginx:alpine
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
- api1
- api2
expose:
- 9999
network_mode: host
restart: always
deploy:
resources:
limits:
cpus: '0.1'
memory: '30MB'
api1: &api
image: wiliamvj/rinha:latest
hostname: api1
restart: always
environment:
DB_HOST: localhost
DB_PASSWORD: rinha_pass
DB_USER: rinha_user
DB_NAME: rinha_db
DB_PORT: 5432
HTTP_PORT: 8080
network_mode: host
volumes:
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
deploy:
resources:
limits:
cpus: '0.1'
memory: '80MB'
depends_on:
postgres:
condition: service_healthy
expose:
- 8080
api2:
<<: *api
hostname: api2
environment:
DB_HOST: localhost
DB_PASSWORD: rinha_pass
DB_USER: rinha_user
DB_NAME: rinha_db
DB_PORT: 5432
HTTP_PORT: 8081
expose:
- 8081
postgres:
image: postgres:16.2
hostname: postgres
environment:
POSTGRES_PASSWORD: rinha_pass
POSTGRES_USER: rinha_user
POSTGRES_DB: rinha_db
network_mode: host
expose:
- 5432
volumes:
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
command: 'postgres -c shared_buffers=96MB -c checkpoint_timeout=600 -c synchronous_commit=off -c fsync=off -c full_page_writes=off -c work_mem=16MB'
healthcheck:
test: ['CMD-SHELL', "sh -c 'pg_isready -U rinha_user -d rinha_db'"]
interval: 5s
timeout: 5s
retries: 20
start_period: 10s
deploy:
resources:
limits:
cpus: '1.2'
memory: '360MB'