forked from akitaonrails/rinhabackend-python-fastapi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
99 lines (94 loc) · 2.08 KB
/
docker-compose.yml
File metadata and controls
99 lines (94 loc) · 2.08 KB
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'
services:
api1:
build:
context: ./app
hostname: api1
depends_on:
db:
condition: service_healthy
deploy:
resources:
limits:
cpus: '0.35'
memory: '0.6GB'
command: "uvicorn app.main:app --loop uvloop --uds /tmp/api1.sock --proxy-headers --no-access-log"
environment:
- DB_URL = postgresql://user:pass@db:5432/rinha
- DB_POOL = 200
- CACHE_URL= redis://redis:6379
volumes:
- socks:/tmp
networks:
- appnet
api2:
build:
context: ./app
hostname: api2
depends_on:
db:
condition: service_healthy
deploy:
resources:
limits:
cpus: '0.35'
memory: '0.6GB'
command: "uvicorn app.main:app --loop uvloop --uds /tmp/api2.sock --proxy-headers --no-access-log"
environment:
- DB_URL = postgresql://user:pass@db:5432/rinha
- DB_POOL = 200
- CACHE_URL= redis://redis:6379
volumes:
- socks:/tmp
networks:
- appnet
nginx:
image: nginx:latest
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
- socks:/tmp
depends_on:
api1:
condition: service_started
api2:
condition: service_started
ulimits:
nproc: 1000000
nofile:
soft: 1000000
hard: 1000000
ports:
- "9999:9999"
deploy:
resources:
limits:
cpus: '0.1'
memory: '0.3GB'
networks:
- appnet
db:
image: postgres:latest
environment:
POSTGRES_USER: user
POSTGRES_PASSWORD: pass
POSTGRES_DB: rinha
volumes:
- ./postgresql.conf:/docker-entrypoint-initdb.d/postgresql.conf
deploy:
resources:
limits:
cpus: '0.7'
memory: '1.5GB'
command: postgres -c 'max_connections=450' -c 'shared_buffers=512MB'
healthcheck:
test: ["CMD-SHELL", "pg_isready --dbname=rinha --username=user"]
interval: 2s
timeout: 2s
retries: 30
networks:
- appnet
networks:
appnet:
driver: bridge
volumes:
socks: