forked from zanfranceschi/rinha-de-backend-2024-q1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yaml
70 lines (65 loc) · 1.66 KB
/
docker-compose.yaml
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
version: '3.9'
name: 'rinha-de-backend-2'
# 1.5 CPUs = 0.5 PostgreSQL + 2 x 0.45 Java puro + 0.1 NGinx
# 550MB = 200MB PostgreSQL + 2 x 165MB Java puro + 20MB NGinx
services:
javinha1: &api
image: docker.io/boaglio/jaiminho:latest
hostname: javinha1
network_mode: host
environment:
- SERVER_PORT=8081
depends_on:
db:
condition: service_healthy
ulimits:
nofile:
soft: 1000000
hard: 1000000
deploy:
resources:
limits:
cpus: '0.45'
memory: '165MB'
javinha2:
<<: *api
hostname: javinha2
environment:
- SERVER_PORT=8082
nginx:
image: nginx:latest
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
- javinha1
- javinha2
network_mode: host
deploy:
resources:
limits:
cpus: '0.2'
memory: '20MB'
db:
image: postgres:latest
hostname: db
network_mode: host
restart: always
environment:
- POSTGRES_USER=admin
- POSTGRES_PASSWORD=rinha
- POSTGRES_DB=rinhadepostgres
volumes:
- ./docker-entrypoint-initdb.d/init.sql:/docker-entrypoint-initdb.d/init.sql:ro
- ./postgresql.conf:/etc/postgresql/postgresql.conf
deploy:
resources:
limits:
cpus: '0.5'
memory: '200MB'
command: postgres -c checkpoint_timeout=600 -c max_wal_size=2096 -c synchronous_commit=0 -c full_page_writes=0 -c fsync=off -c check_function_bodies=false
healthcheck:
test: ["CMD-SHELL", "sh -c 'pg_isready -U admin -d rinhadepostgres'"]
interval: 5s
timeout: 5s
retries: 20
start_period: 5s