-
Notifications
You must be signed in to change notification settings - Fork 923
/
Copy pathdocker-compose.yml
89 lines (84 loc) · 2.08 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
86
87
88
89
version: "3.5"
services:
postgres:
image: postgres:15.4-alpine
hostname: postgres
environment:
POSTGRES_USER: postgres_user
POSTGRES_PASSWORD: postgres_password
POSTGRES_DB: database_rinha
volumes:
- ./database/init.sql:/docker-entrypoint-initdb.d/init.sql
- ./database/postgres.conf:/etc/postgres/postgres.conf
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", "pg_isready -d $$POSTGRES_DB -U $$POSTGRES_USER" ]
interval: 10s
timeout: 5s
retries: 5
ports:
- "5432:5432"
deploy:
resources:
limits:
cpus: '0.30'
memory: '80MB'
networks:
- network-rinha
restart: unless-stopped
svc01: &api
image: carlosdemarco/rinha-backend-2024-q1:v1
hostname: svc01
environment:
- POSTGRES_HOST=postgres
- POSTGRES_PORT=5432
- POSTGRES_DATABASE=database_rinha
- POSTGRES_USER=postgres_user
- POSTGRES_PASS=postgres_password
- POSTGRES_LOG=off
- SHOW_SQL=false
depends_on:
postgres:
condition:
service_healthy
healthcheck:
test: [ 'CMD-SHELL', 'curl --fail --silent http://localhost:8080/actuator/health | grep UP || exit 1' ]
interval: 5s
timeout: 2s
retries: 5
deploy:
resources:
limits:
cpus: '0.50'
memory: '225MB'
networks:
- network-rinha
svc02:
<<: *api
hostname: svc02
nginx:
image: nginx:latest
volumes:
- ./proxy/nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
svc01:
condition:
service_healthy
svc02:
condition:
service_healthy
ports:
- "9999:9999"
healthcheck:
test: service nginx status || exit 1
timeout: 1s
deploy:
resources:
limits:
cpus: '0.20'
memory: '20MB'
networks:
- network-rinha
networks:
network-rinha:
driver: bridge