-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
315 lines (302 loc) · 9.75 KB
/
Copy pathdocker-compose.yml
File metadata and controls
315 lines (302 loc) · 9.75 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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
name: openprocessor
services:
triton-server:
image: davidamacey/openprocessor-triton:latest
build:
context: .
dockerfile: Dockerfile.triton
container_name: triton-server
restart: always
ports:
- 4600:8000 # HTTP
- 4601:8001 # gRPC
- 4602:8002 # Metrics
volumes:
- ./models:/models
command:
- tritonserver
- --model-store=/models
- --backend-config=default-max-batch-size=128
- --strict-model-config=false
- --model-control-mode=explicit
# ===================================================================
# Visual Search Models
# ===================================================================
- --load-model=yolov11_small_trt_end2end
- --load-model=scrfd_10g_bnkps
- --load-model=arcface_w600k_r50
- --load-model=mobileclip2_s2_image_encoder
- --load-model=mobileclip2_s2_text_encoder
- --load-model=paddleocr_det_trt
- --load-model=paddleocr_rec_trt
- --load-model=ocr_pipeline
# ===================================================================
- --log-verbose=1
- --log-info=true
shm_size: 8g
ulimits:
memlock: -1
stack: 67108864
deploy:
resources:
reservations:
devices:
- driver: nvidia
device_ids: [ '0' ]
capabilities:
- gpu
networks:
- triton_net
yolo-api:
image: davidamacey/openprocessor:latest
container_name: yolo-api
restart: always
build:
context: .
dockerfile: Dockerfile
volumes:
- ./src:/app/src
- ./export:/app/export
- ./scripts:/app/scripts
- ./tests:/app/tests
- ./benchmarks:/app/benchmarks
- ./models:/app/models
- ./pytorch_models:/app/pytorch_models
- ./test_images:/app/test_images
- ./VERSION:/app/VERSION:ro
- ./cache/huggingface:/home/appuser/.cache/huggingface # HuggingFace tokenizers (appuser)
environment:
# Triton gRPC endpoint (Docker service name)
- TRITON_URL=triton-server:8001
# HuggingFace cache configuration (appuser home directory)
- HF_HOME=/home/appuser/.cache/huggingface
- HF_HUB_CACHE=/home/appuser/.cache/huggingface/hub
shm_size: 8g
stdin_open: true # Keep stdin open
tty: true # Allocate a pseudo-TTY
command:
- uvicorn
- src.main:app
- --host=0.0.0.0
- --port=8000
# ===================================================================
# Worker Configuration (Performance Tuning)
# Production: 64 workers for dual-GPU throughput
# Benchmark: 4 workers to match TRT instance count for fair comparison
# ===================================================================
- --workers=32 # Increased for higher face pipeline throughput
- --limit-max-requests=10000 # Recycle workers every 10k requests (prevents memory leaks)
# ===================================================================
# Event Loop & HTTP Protocol (Already Optimized)
# ===================================================================
- --loop=uvloop # 2-3x faster than asyncio default loop
- --http=httptools # Faster HTTP parsing than h11
# ===================================================================
# Connection & Concurrency Settings
# ===================================================================
- --backlog=4096 # Socket connection queue size
- --limit-concurrency=512 # Max concurrent requests (prevents overload)
- --timeout-keep-alive=75 # Keep connections alive for reuse
- --timeout-graceful-shutdown=30 # Clean shutdown (drain connections)
# ===================================================================
# Logging
# ===================================================================
- --access-log
- --log-level=info
ports:
- 4603:8000 # FastAPI
ulimits:
memlock: -1
stack: 67108864
deploy:
resources:
reservations:
devices:
- driver: nvidia
device_ids: [ '0' ]
capabilities:
- gpu
depends_on:
- triton-server
networks:
- triton_net
triton-sdk:
image: nvcr.io/nvidia/tritonserver:26.06-py3-sdk
container_name: triton-sdk
profiles:
- benchmark
command: sleep infinity
volumes:
- ./benchmarks:/workspace/benchmarks
- ./models:/models
networks:
- triton_net
node-exporter:
image: prom/node-exporter:v1.10.2
container_name: triton-node-exporter
restart: always
command:
- '--path.rootfs=/host'
pid: host
volumes:
- '/:/host:ro,rslave'
networks:
- triton_net
# Per-GPU utilization / VRAM / power / temperature for Grafana across ALL
# host GPUs (not just Triton's). Read-only; does not reserve compute.
dcgm-exporter:
image: nvcr.io/nvidia/k8s/dcgm-exporter:3.3.5-3.4.0-ubuntu22.04
container_name: triton-dcgm-exporter
restart: always
cap_add:
- SYS_ADMIN
environment:
- DCGM_EXPORTER_LISTEN=:9400
ports:
- 4610:9400 # DCGM GPU metrics
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu, utility]
networks:
- triton_net
prometheus:
image: prom/prometheus:v3.12.0
container_name: triton-prometheus
restart: always
ports:
- 4604:9090 # Prometheus
volumes:
- ./monitoring/prometheus.yml:/etc/prometheus/prometheus.yml
- ./monitoring/alerts:/etc/prometheus/alerts
- prometheus_data:/prometheus
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'
networks:
- triton_net
depends_on:
- triton-server
- node-exporter
grafana:
image: grafana/grafana:13.1.0
container_name: triton-grafana
restart: always
ports:
- 4605:3000 # Grafana
volumes:
- grafana_data:/var/lib/grafana
- ./monitoring/grafana-datasources.yml:/etc/grafana/provisioning/datasources/datasources.yml
- ./monitoring/grafana-dashboards.yml:/etc/grafana/provisioning/dashboards/dashboards.yml
- ./monitoring/grafana-alerting.yml:/etc/grafana/provisioning/alerting/alerting.yml
- ./monitoring/dashboards:/etc/grafana/dashboards
environment:
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=admin
- GF_USERS_ALLOW_SIGN_UP=false
# Enable unified alerting (Grafana 8+)
- GF_UNIFIED_ALERTING_ENABLED=true
- GF_ALERTING_ENABLED=false
networks:
- triton_net
depends_on:
- prometheus
- loki
loki:
# Runs as the image's builtin non-root user (uid 10001). Existing
# root-owned loki_data volumes need a one-time chown — see
# docs/MIGRATION_TRITON_26.md.
image: grafana/loki:3.6.12
container_name: triton-loki
restart: always
ports:
- 4606:3100 # Loki
volumes:
- ./monitoring/loki-config.yml:/etc/loki/local-config.yaml
- loki_data:/loki
command: -config.file=/etc/loki/local-config.yaml
networks:
- triton_net
# Log shipper: Grafana Alloy (Promtail reached EOL 2026-03-02).
alloy:
image: grafana/alloy:v1.17.1
container_name: triton-alloy
restart: always
volumes:
- ./monitoring/alloy-config.alloy:/etc/alloy/config.alloy:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
- /var/lib/docker/containers:/var/lib/docker/containers:ro
command:
- run
- /etc/alloy/config.alloy
- --storage.path=/tmp/alloy
networks:
- triton_net
depends_on:
- loki
# ===================================================================
# OpenSearch for Visual Search (Vector Database)
# OpenSearch 3.x with k-NN plugin for vector similarity search
# ===================================================================
opensearch:
image: opensearchproject/opensearch:3.6.0
container_name: triton-opensearch
restart: always
environment:
- discovery.type=single-node
- bootstrap.memory_lock=true
- "OPENSEARCH_JAVA_OPTS=-Xms2g -Xmx2g" # Heap size (adjust based on RAM)
- DISABLE_SECURITY_PLUGIN=true # Disable security for dev (enable in production)
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536
hard: 65536
volumes:
- opensearch_data:/usr/share/opensearch/data
ports:
- 4607:9200 # REST API
healthcheck:
test: ["CMD-SHELL", "curl -sS http://localhost:9200 || exit 1"]
interval: 5s
timeout: 10s
retries: 20
networks:
- triton_net
opensearch-dashboards:
image: opensearchproject/opensearch-dashboards:3.6.0
container_name: triton-opensearch-dashboards
restart: always
environment:
- OPENSEARCH_HOSTS=["http://opensearch:9200"]
- DISABLE_SECURITY_DASHBOARDS_PLUGIN=true # Must match OpenSearch security setting
ports:
- 4608:5601 # OpenSearch Dashboards
volumes:
- opensearch_dashboards_data:/usr/share/opensearch-dashboards/data
healthcheck:
test: ["CMD-SHELL", "curl -sS http://localhost:5601 || exit 1"]
interval: 10s
timeout: 10s
retries: 20
networks:
- triton_net
depends_on:
opensearch:
condition: service_healthy
networks:
triton_net:
driver: bridge
volumes:
prometheus_data:
grafana_data:
loki_data:
opensearch_data:
opensearch_dashboards_data: