Skip to content

Commit f84d125

Browse files
authored
[ViPPET] Add model-download service to Docker Compose stack (open-edge-platform#2092)
1 parent baa7f9e commit f84d125

6 files changed

Lines changed: 74 additions & 13 deletions

File tree

tools/visual-pipeline-and-platform-evaluation-tool/Makefile

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ SHELL := bash -eu -o pipefail
66
# default goal to show help
77
.DEFAULT_GOAL := help
88
.PHONY: all lint build mdlint ruff fix-linter format pyright run build-dev run-dev test \
9-
shell shell-vippet shell-models shell-collector shell-videogenerator stop clean clean-output-videos help \
9+
shell shell-vippet shell-models shell-model-download shell-collector shell-videogenerator stop clean clean-output-videos help \
1010
build-videogenerator build-models build-onvif-discovery docker-build env-setup \
1111
install-models-once install-models-force install-models-all \
1212
test-smoke test-full
@@ -33,7 +33,7 @@ all: lint build run test ## Run lint, build, run and test
3333

3434
lint: $(VENV_DIR) mdlint ruff pyright ## Run all linters
3535

36-
MD_FILES := $(shell find . -type f \( -name '*.md' \) -not -path './.*' -print )
36+
MD_FILES := $(shell find . -type f \( -name '*.md' \) -not -path './.*' -not -path './shared/*' -print )
3737
mdlint: ## Lint MD files
3838
# download tool from https://github.com/igorshubovych/markdownlint-cli
3939
markdownlint --version
@@ -42,19 +42,19 @@ mdlint: ## Lint MD files
4242
ruff: $(VENV_DIR) ## Run ruff linter
4343
set +u; . ./$</bin/activate; set -u ;\
4444
ruff --version ;\
45-
# Exclude shared/scripts/ to avoid formatting user created scripts ;\
46-
ruff check --exclude shared/scripts/ ;\
47-
ruff format --check --exclude shared/scripts/
45+
# Exclude shared/ — runtime-mounted volume, not source code ;\
46+
ruff check --exclude shared/ ;\
47+
ruff format --check --exclude shared/
4848

4949
fix-linter: $(VENV_DIR) ## Fix linter issues using ruff
5050
set +u; . ./$</bin/activate; set -u ;\
51-
# Exclude shared/scripts/ to avoid formatting user created scripts ;\
52-
ruff check --fix --exclude shared/scripts/
51+
# Exclude shared/ — runtime-mounted volume, not source code ;\
52+
ruff check --fix --exclude shared/
5353

5454
format: $(VENV_DIR) ## Format code using ruff
5555
set +u; . ./$</bin/activate; set -u ;\
56-
# Exclude shared/scripts/ to avoid formatting user created scripts ;\
57-
ruff format --exclude shared/scripts/
56+
# Exclude shared/ — runtime-mounted volume, not source code ;\
57+
ruff format --exclude shared/
5858

5959
pyright: $(VENV_DIR) ## Run pyright type checker
6060
set +u; . ./$</bin/activate; set -u ;\
@@ -69,6 +69,8 @@ generate_openapi: $(VENV_DIR) ## Generate OpenAPI schema file
6969
env-setup: ## Environment setup target: always run before build/run targets that need .env and shared dirs
7070
mkdir -p shared/collector-signals && chmod o+w shared/collector-signals
7171
mkdir -p shared/models/output && chmod o+w shared/models/output
72+
mkdir -p shared/model-download/venv && chmod o+w shared/model-download/venv
73+
mkdir -p shared/model-download/cache && chmod o+w shared/model-download/cache
7274
mkdir -p shared/videos/input && chmod o+w shared/videos/input
7375
mkdir -p shared/videos/output && chmod o+w shared/videos/output
7476
mkdir -p shared/videos/video-generator && chmod o+w shared/videos/video-generator
@@ -138,17 +140,20 @@ shell-vippet: ## Open shell in vippet container
138140
shell-models: ## Open shell in models container
139141
$(MAKE) shell SERVICE=models
140142

143+
shell-model-download: ## Open shell in model-download container
144+
$(MAKE) shell SERVICE=model-download
145+
141146
shell-collector: ## Open shell in collector container
142147
$(MAKE) shell SERVICE=collector
143148

144149
shell-videogenerator: ## Open shell in videogenerator container
145150
$(MAKE) shell SERVICE=videogenerator
146151

147152
stop: ## Stop the docker compose services
148-
docker compose down models collector videogenerator mediamtx vippet-ui vippet onvif-discovery
153+
docker compose down models model-download collector videogenerator mediamtx vippet-ui vippet onvif-discovery
149154

150155
clean: ## Clean all build artifacts
151-
rm -rf shared/collector-signals shared/models/output/ shared/onvif/onvif_cameras.json shared/videos/input shared/videos/output shared/videos/video-generator
156+
rm -rf shared/collector-signals shared/models/output/ shared/model-download/ shared/onvif/onvif_cameras.json shared/videos/input shared/videos/output shared/videos/video-generator
152157

153158
clean-output-videos: ## Clean only output videos
154159
rm -rf shared/videos/output/*

tools/visual-pipeline-and-platform-evaluation-tool/compose.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,36 @@ services:
101101
- https_proxy=${https_proxy}
102102
- no_proxy=${no_proxy}
103103
command: './model_manager.sh'
104+
model-download:
105+
image: docker.io/intel/model-download:2026.1.0-20260331-weekly
106+
container_name: model-download
107+
command: --plugins ${MODEL_DOWNLOAD_PLUGINS:-openvino,huggingface,ultralytics,geti}
108+
healthcheck:
109+
test: ["CMD", "curl", "--fail", "--silent", "--show-error", "--output", "/dev/null", "http://localhost:8000/api/v1/health"]
110+
interval: 30s
111+
timeout: 10s
112+
retries: 5
113+
start_period: 60s
114+
start_interval: 5s
115+
restart: on-failure:5
116+
environment:
117+
MODELS_DIR: /models/output
118+
CORS_ALLOW_ORIGINS: "*"
119+
HF_HUB_ENABLE_HF_TRANSFER: "1"
120+
HF_TOKEN: ${HF_TOKEN:-}
121+
UV_CACHE_DIR: /cache/uv
122+
GETI_HOST: ${GETI_HOST:-}
123+
GETI_TOKEN: ${GETI_TOKEN:-}
124+
GETI_WORKSPACE_ID: ${GETI_WORKSPACE_ID:-}
125+
GETI_SERVER_API_VERSION: ${GETI_SERVER_API_VERSION:-v1}
126+
GETI_SERVER_SSL_VERIFY: ${GETI_SERVER_SSL_VERIFY:-False}
127+
http_proxy: ${http_proxy}
128+
https_proxy: ${https_proxy}
129+
no_proxy: ${no_proxy}
130+
volumes:
131+
- ./shared/models/:/models
132+
- ./shared/model-download/venv:/opt/.venv
133+
- ./shared/model-download/cache:/cache
104134
vippet: # Always 'vippet', hardware config from override files
105135
<<: *vippet
106136
container_name: vippet

tools/visual-pipeline-and-platform-evaluation-tool/pyrightconfig.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"**/node_modules",
1717
"**/__pycache__",
1818
".git",
19-
"shared/scripts"
20-
],
19+
"shared/scripts",
20+
"shared/model-download"
21+
]
2122
}

tools/visual-pipeline-and-platform-evaluation-tool/shared/model-download/.gitkeep

Whitespace-only changes.

tools/visual-pipeline-and-platform-evaluation-tool/ui/nginx.conf

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,24 @@ server {
2424
proxy_read_timeout 30;
2525
}
2626

27+
# Reverse proxy for model-download service API
28+
location /model-download/ {
29+
proxy_pass http://model-download:8000/api/v1/;
30+
proxy_set_header Host $host;
31+
proxy_set_header X-Real-IP $remote_addr;
32+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
33+
proxy_set_header X-Forwarded-Proto $scheme;
34+
proxy_set_header X-Forwarded-Host $host:$server_port;
35+
36+
# Timeout settings (model downloads can take a long time)
37+
proxy_connect_timeout 30;
38+
proxy_send_timeout 300;
39+
proxy_read_timeout 300;
40+
41+
# Allow large model uploads
42+
client_max_body_size 5G;
43+
}
44+
2745
# WebSocket proxy for metrics
2846
location /metrics/ws/ {
2947
proxy_pass http://vippet:7860;

tools/visual-pipeline-and-platform-evaluation-tool/ui/vite.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ export default defineConfig(({ mode }) => {
2828
secure: false,
2929
ws: true,
3030
},
31+
"/model-download": {
32+
target: env.VITE_MODEL_DOWNLOAD_URL || "http://localhost:8000",
33+
changeOrigin: true,
34+
secure: false,
35+
ws: false,
36+
rewrite: (path: string) => path.replace(/^\/model-download/, "/api/v1"),
37+
},
3138
"/api": {
3239
target: env.VITE_API_URL || "http://localhost:7860",
3340
changeOrigin: true,

0 commit comments

Comments
 (0)