forked from zanfranceschi/rinha-de-backend-2024-q1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
compose.yml
93 lines (87 loc) · 2.01 KB
/
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
version: '3.5'
services:
api01: &api
image: jefersonbaixo/rinha-jef-2024-q1
hostname: api01
container_name: api01-phoenix
environment:
- PHX_HOST=api01
- DATABASE_URL=postgres://postgres:postgres@postgres:5432/rinha
- SECRET_KEY_BASE=Hy7pQWVbcnpz7w45pawgl5aqG7HdyDHiXQh/dGQN0bVDCKIPKd4D1aiN3v24F0Jg
ports:
- "4000:4000"
depends_on:
postgres:
condition: service_healthy
networks:
- api_network
deploy:
resources:
limits:
cpus: '0.5'
memory: '180MB'
api02:
<<: *api
hostname: api02
container_name: api02-phoenix
environment:
- PHX_HOST=api02
- DATABASE_URL=postgres://postgres:postgres@postgres:5432/rinha
- SECRET_KEY_BASE=Hy7pQWVbcnpz7w45pawgl5aqG7HdyDHiXQh/dGQN0bVDCKIPKd4D1aiN3v24F0Jg
- CREATE_TABLES=false
- PORT=4001
ports:
- "4001:4001"
networks:
- api_network
depends_on:
postgres:
condition: service_healthy
deploy:
resources:
limits:
cpus: '0.5'
memory: '180MB'
postgres:
image: postgres:latest
container_name: postgres
restart: always
hostname: postgres
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=rinha
volumes:
- ./setup/init.sql:/docker-entrypoint-initdb.d/init.sql
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U postgres -d rinha" ]
interval: 4s
timeout: 2s
retries: 5
networks:
- api_network
deploy:
resources:
limits:
cpus: '0.4'
memory: '180MB'
nginx:
image: nginx:1.25.3-alpine
container_name: nginx
volumes:
- ./setup/nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
- api01
- api02
ports:
- "9999:9999"
networks:
- api_network
deploy:
resources:
limits:
cpus: '0.1'
memory: '10MB'
networks:
api_network:
driver: bridge