-
Notifications
You must be signed in to change notification settings - Fork 925
/
docker-compose.yml
66 lines (63 loc) · 1.55 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
services:
api1: &api
image: thiagotn/rinhafastapi:3.0
container_name: api1
command: uvicorn app.main:app --host 0.0.0.0 --port 3000
network_mode: host
environment:
- MAX_CONNECTIONS=5
- MIN_CONNECTIONS=1
- POSTGRES_DB=rinha
- POSTGRES_USER=rinha
- POSTGRES_PASSWORD=rinha
- POSTGRES_HOST=localhost
depends_on:
db:
condition: service_healthy
deploy:
resources:
limits:
cpus: "590m"
memory: "105MB"
api2:
<<: *api
container_name: api2
command: uvicorn app.main:app --host 0.0.0.0 --port 3001
db:
image: postgres:16
container_name: db
volumes:
- ./config/init.sql:/docker-entrypoint-initdb.d/init.sql
- ./config/postgresql.conf:/etc/postgresql/postgresql.conf
- type: tmpfs
target: /var/lib/postgresql/data
command: postgres -c config_file=/etc/postgresql/postgresql.conf
network_mode: host
healthcheck:
test: ["CMD-SHELL", "pg_isready -U rinha -d rinha -h localhost -p 5432"]
interval: 5s
timeout: 5s
retries: 5
environment:
POSTGRES_USER: rinha
POSTGRES_PASSWORD: rinha
POSTGRES_DB: rinha
deploy:
resources:
limits:
cpus: "240m"
memory: "320MB"
nginx:
image: nginx
container_name: nginx
volumes:
- ./config/nginx.conf:/etc/nginx/nginx.conf:ro
network_mode: host
depends_on:
- api1
- api2
deploy:
resources:
limits:
cpus: "80m"
memory: "20MB"