-
Notifications
You must be signed in to change notification settings - Fork 3
/
docker-compose.yml
76 lines (73 loc) · 1.6 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
version: '3.5'
services:
api1: # API - Instância 01
# image: gabrielleeg1/rinha:latest
build: .
depends_on:
db:
condition: service_healthy
environment:
PORT: 3000
HOST: 'localhost'
POSTGRES_HOST: 'localhost'
POSTGRES_USER: 'postgres'
POSTGRES_PASSWORD: 'password'
POSTGRES_DATABASE: 'rinha'
POSTGRES_PORT: 5432
network_mode: host
deploy:
resources:
limits:
cpus: '0.25'
memory: '0.5GB'
api2:
# image: gabrielleeg1/rinha:latest
build: .
depends_on:
db:
condition: service_healthy
environment:
PORT: 3001
HOST: 'localhost'
POSTGRES_HOST: 'localhost'
POSTGRES_USER: 'postgres'
POSTGRES_PASSWORD: 'password'
POSTGRES_DATABASE: 'rinha'
POSTGRES_PORT: 5432
network_mode: host
deploy:
resources:
limits:
cpus: '0.25'
memory: '0.5GB'
nginx: # Load Balancer
image: nginx:latest
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
- api1
- api2
network_mode: host
deploy:
resources:
limits:
cpus: '0.25'
memory: '0.5GB'
db:
image: postgres
environment:
POSTGRES_PASSWORD: 'password'
POSTGRES_DB: 'rinha'
network_mode: host
volumes:
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
deploy:
resources:
limits:
cpus: '0.75'
memory: '1.5GB'
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5