forked from zanfranceschi/rinha-de-backend-2024-q1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
106 lines (101 loc) · 2.35 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
version: '3.9'
services:
api1: &api
image: docker.io/lucasmancan/rinhabackend-2024:latest
hostname: api1
environment:
- SERVER_PORT=8080
- DATABASE_URL=jdbc:postgresql://db-postgresql:5432/rinhadb
- DATABASE_USERNAME=rinhaapp
- DATABASE_PASSWORD=root
depends_on:
db-postgresql:
condition: service_healthy
ulimits:
nofile:
soft: 1000000
hard: 1000000
deploy:
resources:
limits:
cpus: '0.6'
memory: '208MB'
networks:
- app-network
healthcheck:
test: curl -o /dev/null -s --retry 0 --get http://localhost:8080/health-check || exit 1
interval: 60s
retries: 5
start_period: 20s
timeout: 5s
api2:
<<: *api
hostname: api2
environment:
- SERVER_PORT=8080
- DATABASE_URL=jdbc:postgresql://db-postgresql:5432/rinhadb
- DATABASE_USERNAME=rinhaapp
- DATABASE_PASSWORD=root
depends_on:
db-postgresql:
condition: service_healthy
ulimits:
nofile:
soft: 1000000
hard: 1000000
deploy:
resources:
limits:
cpus: '0.6'
memory: '208MB'
networks:
- app-network
healthcheck:
test: curl -o /dev/null -s --retry 0 --get http://localhost:8080/health-check || exit 1
interval: 60s
retries: 5
start_period: 20s
timeout: 5s
nginx:
image: nginx:latest
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
- api1
- api2
ports:
- "9999:9999"
networks:
- app-network
deploy:
resources:
limits:
cpus: '0.1'
memory: '15MB'
db-postgresql:
image: postgres:latest
command: 'postgres -c max_connections=200 -c synchronous_commit=off -c fsync=off -c full_page_writes=off'
hostname: db-postgresql
environment:
- POSTGRES_PASSWORD=root
- POSTGRES_USER=rinhaapp
- POSTGRES_DB=rinhadb
ports:
- "5432:5432"
volumes:
- ./ddl.sql:/docker-entrypoint-initdb.d/ddl.sql
deploy:
resources:
limits:
cpus: '0.2'
memory: '119MB'
networks:
- app-network
healthcheck:
test: ["CMD-SHELL", "pg_isready", "-U", "rinhaapp"]
interval: 5s
timeout: 5s
retries: 20
start_period: 10s
networks:
app-network: