-
Notifications
You must be signed in to change notification settings - Fork 923
/
Copy pathdocker-compose.yml
99 lines (91 loc) · 2.48 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
version: "3.5"
x-db-connection-settings: &db-connection-settings
CREBITO_DB__uri: "postgresql+asyncpg://user:[email protected]/crebito"
CREBITO_DB__pool_size: 10
CREBITO_DB__max_overflow: 10
CREBITO_DB__pool_timeout: 60
CREBITO_DB__pool_recycle: 1800
CREBITO_DB__echo: false
x-healthcheck-settings: &default-healthcheck
interval: 1s
timeout: 3s
retries: 5
start_period: 1s
services:
api1: &api
image: docker.io/vgdss/crebito:latest
#pull_policy: always
hostname: api1
container_name: rinha-api1
depends_on:
postgres:
condition: service_healthy
network_mode: host
environment:
<<: *db-connection-settings
PORT: 8001
deploy:
resources:
limits:
cpus: "0.45"
memory: "100MB"
healthcheck:
<<: *default-healthcheck
test: ["CMD-SHELL", "curl -f http://127.0.0.1:8001/clientes/1/extrato || exit 1"]
api2:
<<: *api
hostname: api2
container_name: rinha-api2
depends_on:
postgres:
condition: service_healthy
api1:
condition: service_healthy
environment:
<<: *db-connection-settings
PORT: 8002
healthcheck:
<<: *default-healthcheck
test: ["CMD-SHELL", "curl -f http://127.0.0.1:8002/clientes/1/extrato || exit 1"]
nginx:
image: nginx:latest
container_name: rinha-nginx
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
api1:
condition: service_healthy
api2:
condition: service_healthy
network_mode: host
deploy:
resources:
limits:
cpus: "0.1"
memory: "50MB"
healthcheck:
<<: *default-healthcheck
test: ["CMD-SHELL", "curl -f http://127.0.0.1:9999/clientes/1/extrato || exit 1"]
postgres:
image: postgres:latest
container_name: rinhadb
environment:
POSTGRES_DB: crebito
POSTGRES_USER: user
POSTGRES_PASSWORD: password
network_mode: host
volumes:
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
- pgdata:/var/lib/postgresql/data
- ./postgresql.conf:/docker-entrypoint-initdb.d/postgresql.conf
command: postgres -c config_file=/docker-entrypoint-initdb.d/postgresql.conf
deploy:
resources:
limits:
cpus: "0.5"
memory: "300MB"
healthcheck:
<<: *default-healthcheck
test: ["CMD", "pg_isready", "-U", "user", "-d", "crebito","-h", "127.0.0.1", "-p", "5432"]
volumes:
pgdata: