forked from zanfranceschi/rinha-de-backend-2024-q1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
84 lines (82 loc) · 1.9 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
version: '3.4'
services:
app1: &app
image: halexv/rinha-de-backend-2024-q1-app
hostname: app1
environment:
POSTGRES_URL: 'postgres://postgres:12345678@localhost:5432/postgres'
DB_POOL: 40
APP_PORT: '8080'
CLUSTER: true
CLUSTER_WORKERS: 4
# expose:
# - '8080'
# ports:
# - 9999:9999
network_mode: host
depends_on:
postgres:
condition: service_healthy
ulimits:
nproc: 1000000
nofile:
soft: 1000000
hard: 1000000
deploy:
resources:
limits:
cpus: '0.4'
memory: '190MB'
app2:
<<: *app
hostname: app2
command: npm run start:prod
environment:
POSTGRES_URL: 'postgres://postgres:12345678@localhost:5432/postgres'
DB_POOL: 40
APP_PORT: '8081'
CLUSTER: true
CLUSTER_WORKERS: 4
postgres:
image: postgres
command: postgres -c 'max_connections=450' -c 'log_error_verbosity=terse' -c 'config_file=/etc/postgresql/postgresql.conf' -c 'client_min_messages=error'
environment:
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: 12345678
network_mode: host
# ports:
# - 5432:5432
volumes:
- ./postgresql.conf:/etc/postgresql/postgresql.conf
healthcheck:
test: ['CMD-SHELL', 'pg_isready -d postgres -U postgres']
interval: 5s
timeout: 5s
retries: 20
start_period: 2s
deploy:
resources:
limits:
cpus: '0.55'
memory: '150MB'
nginx: # Load Balancer
image: nginx:latest
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
- app1
- app2
network_mode: host
# ports:
# - '9999:9999'
ulimits:
nproc: 1000000
nofile:
soft: 1000000
hard: 1000000
deploy:
resources:
limits:
cpus: '0.15'
memory: '20MB'