-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
96 lines (91 loc) · 2.23 KB
/
Copy pathdocker-compose.yml
File metadata and controls
96 lines (91 loc) · 2.23 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
version: '3.8'
services:
postgres:
image: postgres:15
environment:
POSTGRES_USER: service_user
POSTGRES_PASSWORD: service_password
POSTGRES_DB: service_db
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
- ./postgres/init.sql:/docker-entrypoint-initdb.d/init.sql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U service_user -d service_db"]
interval: 5s
timeout: 5s
retries: 5
deploy:
resources:
limits:
cpus: '0.50'
memory: 512M
fastapi_sync:
build: ./fastapi_sync
ports:
- "8001:8001"
depends_on:
postgres:
condition: service_healthy
environment:
- DATABASE_URL=postgresql://service_user:service_password@postgres/service_db
healthcheck:
test: ["CMD-SHELL", "python -c 'import urllib.request; urllib.request.urlopen(\"http://localhost:8001\")' || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
deploy:
resources:
limits:
cpus: '0.50'
memory: 512M
profiles:
- fastapi-sync
fastapi_async:
build: ./fastapi_async
ports:
- "8002:8002"
depends_on:
postgres:
condition: service_healthy
environment:
- DATABASE_URL=postgresql+asyncpg://service_user:service_password@postgres/service_db
healthcheck:
test: ["CMD-SHELL", "python -c 'import urllib.request; urllib.request.urlopen(\"http://localhost:8002\")' || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
deploy:
resources:
limits:
cpus: '0.50'
memory: 512M
profiles:
- fastapi-async
express:
build: ./express
ports:
- "3000:3000"
depends_on:
postgres:
condition: service_healthy
environment:
- DB_HOST=postgres
healthcheck:
test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:3000 || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
deploy:
resources:
limits:
cpus: '0.50'
memory: 512M
profiles:
- express
volumes:
postgres_data: