-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
226 lines (215 loc) · 5.2 KB
/
docker-compose.yml
File metadata and controls
226 lines (215 loc) · 5.2 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
version: '3.8'
services:
# Nginx Load Balancer
nginx:
image: nginx:1.25-alpine
container_name: falcon-nginx
ports:
- "80:80"
- "8080:8080"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./nginx/conf.d:/etc/nginx/conf.d:ro
depends_on:
- worker-1
- worker-2
- worker-3
networks:
- falcon-network
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:8080/health"]
interval: 10s
timeout: 5s
retries: 3
# Inference Workers
worker-1:
build:
context: .
dockerfile: Dockerfile
container_name: falcon-worker-1
environment:
- WORKER_ID=worker-1
env_file:
- .env
expose:
- "8000"
volumes:
- ./models:/app/models
- ./logs:/app/logs
depends_on:
redis:
condition: service_healthy
postgres:
condition: service_healthy
networks:
- falcon-network
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/healthz"]
interval: 10s
timeout: 5s
retries: 3
start_period: 30s
worker-2:
build:
context: .
dockerfile: Dockerfile
container_name: falcon-worker-2
environment:
- WORKER_ID=worker-2
env_file:
- .env
expose:
- "8000"
volumes:
- ./models:/app/models
- ./logs:/app/logs
depends_on:
redis:
condition: service_healthy
postgres:
condition: service_healthy
networks:
- falcon-network
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/healthz"]
interval: 10s
timeout: 5s
retries: 3
start_period: 30s
worker-3:
build:
context: .
dockerfile: Dockerfile
container_name: falcon-worker-3
environment:
- WORKER_ID=worker-3
env_file:
- .env
expose:
- "8000"
volumes:
- ./models:/app/models
- ./logs:/app/logs
depends_on:
redis:
condition: service_healthy
postgres:
condition: service_healthy
networks:
- falcon-network
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/healthz"]
interval: 10s
timeout: 5s
retries: 3
start_period: 30s
# Redis Cache
redis:
image: redis:7-alpine
container_name: falcon-redis
ports:
- "6379:6379"
command: redis-server --maxmemory 256mb --maxmemory-policy allkeys-lru
networks:
- falcon-network
restart: unless-stopped
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 3s
retries: 3
volumes:
- redis-data:/data
# Postgres Database
postgres:
image: postgres:15-alpine
container_name: falcon-postgres
environment:
- POSTGRES_DB=falcon_inference
- POSTGRES_USER=falcon
- POSTGRES_PASSWORD=falcon_dev_password_change_in_prod
ports:
- "5432:5432"
networks:
- falcon-network
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U falcon"]
interval: 10s
timeout: 5s
retries: 5
volumes:
- postgres-data:/var/lib/postgresql/data
- ./init-db:/docker-entrypoint-initdb.d
# Prometheus
prometheus:
image: prom/prometheus:v2.48.0
container_name: falcon-prometheus
ports:
- "9090:9090"
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.console.libraries=/usr/share/prometheus/console_libraries'
- '--web.console.templates=/usr/share/prometheus/consoles'
- '--web.enable-lifecycle'
volumes:
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- ./prometheus/alerts:/etc/prometheus/alerts:ro
- prometheus-data:/prometheus
networks:
- falcon-network
restart: unless-stopped
# Grafana
grafana:
image: grafana/grafana:10.2.2
container_name: falcon-grafana
ports:
- "3000:3000"
environment:
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=admin_change_in_prod
- GF_USERS_ALLOW_SIGN_UP=false
- GF_SERVER_ROOT_URL=http://localhost:3000
- GF_INSTALL_PLUGINS=
volumes:
- ./grafana/provisioning:/etc/grafana/provisioning:ro
- ./grafana/dashboards:/var/lib/grafana/dashboards:ro
- grafana-data:/var/lib/grafana
depends_on:
- prometheus
networks:
- falcon-network
restart: unless-stopped
# cAdvisor for container metrics
cadvisor:
image: gcr.io/cadvisor/cadvisor:v0.47.2
container_name: falcon-cadvisor
ports:
- "8081:8080"
volumes:
- /:/rootfs:ro
- /var/run:/var/run:ro
- /sys:/sys:ro
- /var/lib/docker/:/var/lib/docker:ro
- /dev/disk/:/dev/disk:ro
privileged: true
networks:
- falcon-network
restart: unless-stopped
command:
- '--housekeeping_interval=10s'
- '--docker_only=true'
networks:
falcon-network:
driver: bridge
name: falcon-network
volumes:
redis-data:
postgres-data:
prometheus-data:
grafana-data: