71f90aa5695f14aaad9ede586cd49ad4cf947af7
4 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
6c4e1c8f64 |
feat(dashboard): download .gguf models from URL with live progress
## What
Adds a 'Download from URL' section to the Models tab. Paste a HuggingFace
URL (or any direct .gguf URL) and the dashboard fetches it into
gpu/llama_models/ with live progress, speed, ETA, and cancel support.
## Backend
### `dashboard/src/lib/downloads.ts` (new)
In-memory download tracker. Single Node process, so no DB needed.
- `startModelDownload(url, filenameOverride?)` — validates URL (http/https
only), sanitizes filename (.gguf only, no path traversal), spawns curl:
curl -L -f -S --progress-bar -o <dest>.part <url>
curl follows redirects (HuggingFace, Cloudflare R2), fails on HTTP 4xx/5xx,
writes to <dest>.part for atomic rename on success.
- `subscribeToJob(id, cb)` — pub/sub for progress updates
- `cancelDownload(id)` — sends SIGTERM to curl, deletes .part file
- `listJobs()` / `getJob(id)` — read access
- `publicJob(job)` — strips internal fields (_child, _subscribers) before
returning to API caller
Progress tracking:
- Parses curl --progress-bar stderr for percent (looks like '#### 54.3%')
- Periodically stats the .part file for actual bytes downloaded (more
reliable than parsing curl output)
- Does HEAD request via curl -I to get Content-Length for total bytes
History: keeps last 50 finished jobs to avoid memory bloat.
### API routes (all under /api/models/download/)
- `POST /api/models/download` — body: {url, filename?}, returns job
- `GET /api/models/download/status` — returns all jobs (active + recent)
- `GET /api/models/download/[id]/stream` — SSE push of progress events:
event: progress
data: {id, status, percent, bytesDownloaded, bytesTotal, ...}
Plus 'end' event when job reaches terminal state.
- `POST /api/models/download/[id]/cancel` — SIGTERMs curl, deletes .part
### Dockerfile
Added `curl` to the apk add list — needed for the actual download.
`wget` was already present (kept for compatibility with the rest of the
codebase that uses it for health checks).
## Frontend
### ModelsTab additions
- URL input + Download button — Enter to submit
- 'Active downloads' list with progress bars, bytes downloaded / total,
speed (e.g. '1.5 MB/s'), elapsed time, Cancel button
- 'Recent' list (last 5 finished) — shows final size + duration
### DownloadJobRow component
Reusable row for both active and finished jobs. Two modes:
- Full (default): badge + filename + progress bar + stats + source URL link
- Compact: smaller, just badge + filename + final size/duration
### Main component state
- `downloadJobs: DownloadJob[]` — full job list
- `downloadUrl: string` — URL input state
- `downloadsActiveRef` — guards SSE subscription lifecycle
- `downloadSSERef` — Map<jobId, EventSource> for cleanup
On mount, fetches existing download jobs (in case page was refreshed
mid-download). For each active job, opens an EventSource subscription.
On 'end' event, closes the SSE and refreshes the models list (file
should now be on disk).
### Handlers
- `handleDownload()` — POST /api/models/download, then start SSE
- `handleCancelDownload(id)` — POST /api/models/download/[id]/cancel,
closes SSE, refreshes job list
- `refreshDownloadJobs()` — GET /api/models/download/status, manages
SSE subscriptions based on which jobs are active
## Verification
- `npm run build` — OK, 25 routes (4 new download routes)
- `bash dashboard/validate-build.sh` — all 8 COPY sources ✓, standalone ✓
## After deploy
```sh
git pull && sh build.sh
docker compose up -d --force-recreate dashboard
```
Open Models tab, paste a URL like
'https://huggingface.co/bartowski/Qwen2.5-7B-Instruct-Q8_0.gguf' (or any
direct .gguf link), click Download. Watch progress live, cancel if needed.
File appears in the models list automatically when download completes.
## Files changed
- dashboard/src/lib/downloads.ts — new (download tracker + curl wrapper)
- dashboard/src/app/api/models/download/route.ts — new (POST start)
- dashboard/src/app/api/models/download/status/route.ts — new (GET list)
- dashboard/src/app/api/models/download/[id]/stream/route.ts — new (SSE)
- dashboard/src/app/api/models/download/[id]/cancel/route.ts — new (POST cancel)
- dashboard/Dockerfile — added curl to apk add
- dashboard/src/app/page.tsx — ModelsTab gets Download section,
DownloadJobRow component, DownloadJob type, SSE-based handlers
|
||
|
|
f35fd71348 |
fix(dashboard): next-env.d.ts missing in fresh checkout + CVE-2025-66478
## Root cause of build failure `next-env.d.ts` is auto-generated by Next.js on first dev/build run and is gitignored (per Next.js convention). On a fresh git checkout — e.g., when the dashboard image is being built inside the ssh-main container after a `git pull` — this file doesn't exist. The Dockerfile had: COPY tsconfig.json next.config.ts next-env.d.ts postcss.config.mjs .eslintrc.json ./ Legacy Docker builder (no BuildKit) errors out: COPY failed: file not found in build context or excluded by .dockerignore: stat next-env.d.ts: file does not exist ## Fix - Removed `next-env.d.ts` from the COPY line - Added `RUN touch next-env.d.ts` before the build step (Next.js will overwrite it with correct content during `npm run build`) - Removed `.eslintrc.json` from `.dockerignore` (it was being excluded but is needed by the COPY in Dockerfile) ## Security: CVE-2025-66478 `next@16.0.0` has a security vulnerability (CVE-2025-66478). Bumped: - next: 16.0.0 -> 16.4.3 (latest stable) - eslint-config-next: 16.0.0 -> 16.4.3 16.4.3 is the latest stable release and is fully backward-compatible with the existing React 19 + TypeScript 5 + Tailwind 4 setup. ## Verified - Clean build from scratch (rm -rf node_modules .next next-env.d.ts) - `npm install` + `npm run build` succeed - All 17 routes generated (1 page + 1 not-found + 15 API routes) - Standalone output present (.next/standalone/server.js + .next/static) |
||
|
|
3dc57f5eaf |
feat(dashboard): v2 — SSE status, model upload, comfy management, system controls
## Fixes
- **Dockerfile build failure on legacy builder**: removed `COPY yarn.lock*`
wildcard (legacy builder fails when no file matches). Now uses explicit
`COPY package.json package-lock.json ./`.
- Added `dashboard/.dockerignore` to exclude node_modules/.next from build
context (faster builds, smaller context).
## New features
### Real-time status via SSE (replaces fetch polling)
- New `/api/status/stream` endpoint emits `status` event every 4s with
full containers + llama health payload.
- Frontend opens single `EventSource` connection instead of polling.
Auto-reconnects on disconnect.
- SSE chosen over WebSocket: one-way push (server→client) is all we need
for status, works through any HTTP proxy (Tailscale serve), built into
the browser, no extra deps, keeps Next.js standalone output.
### .gguf model upload
- New `/api/models/upload` (multipart/form-data) saves files to
`gpu/llama_models/`.
- Drag-and-drop dropzone + click-to-upload in the Models tab.
- Live progress bar via XMLHttpRequest upload progress event.
- New `DELETE /api/models?name=...` removes a model.
- Filename sanitization: only .gguf, no path traversal.
### ComfyUI models management (mirrors `gpuctl comfy models ...`)
- New API routes:
- `GET /api/comfy/models?type=` — list models via model-worker
- `GET /api/comfy/queue` — show download queue
- `POST /api/comfy/models/add` {url, type} — queue download
- `POST /api/comfy/models/rm` {filename, type?} — remove model
- New Comfy tab with: download queue (live progress), add-model form,
models table (filter by type, remove button).
- All proxied through `docker exec model-worker python3 /app/worker.py ...`.
### ComfyUI start/stop/restart
- New `POST /api/comfy` {action: start|stop|restart}.
- 4 new quick-action cards on the dashboard home.
### System controls (sleep / wake / update)
- New `POST /api/system` {action: sleep|wake|update}.
- Header buttons (Sleep / Wake / Update) with confirmation dialogs.
- `update` runs `sh build.sh` then `docker compose up -d --force-recreate`.
### Generic service management
- New `/api/services/[role]` route handles start/stop/restart/remove/logs
for any service: llama, comfyui, model-worker, webdav, ssh,
ssh-companion, gpu-test, dashboard.
- System tab → Containers table shows per-container action buttons
(start/restart/stop/remove), tailscale is protected.
### Live logs for any service
- Logs tab now has a target selector (llama / comfyui / dashboard / ssh).
- Uses `/api/services/<role>` streaming endpoint.
## Shell script updates (`gpuctl` integration)
- `ssh/scripts/status.sh`:
- `sleep_mode()` now also removes the `dashboard` container
- `wake_mode()` now also starts the `dashboard` container
- Both `wake_mode()` and `update_ssh()` now pass `--profile wake`
when starting profile-gated services (this fixes a subtle bug where
`ssh-companion`/`model-worker`/`webdav`/`dashboard` would fail
to start without the wake profile flag).
- `ssh/gpuctl` usage text updated to list `dashboard`.
## WSL restart script
- New `RESTART_WSL.bat` next to `START_GPU_NODE.bat`:
1. Checks if WSL is running, starts it if not
2. `wsl --shutdown` + 3s wait
3. Wakes WSL back up
4. `docker compose up -d` to start GPU node services
5. Shows running containers
## ssh-only-tailscale-after-reboot investigation
Most likely cause: empty `HOST_PROJECT_PATH` in `.env`.
- `ssh/entrypoint.sh` exits 1 if `HOST_PROJECT_PATH` is unset
- With `restart: always`, Docker daemon keeps trying to restart it on
every boot, but it crashes immediately each time
- `tailscale` doesn't need this env var, so it starts cleanly
Fix: added a hard fail at the top of `compose.yaml`:
```yaml
# ${HOST_PROJECT_PATH:?ERROR: HOST_PROJECT_PATH must be set in .env}
```
(commented out by default to avoid breaking existing setups; uncomment to
enable fail-fast validation). Also updated `.env.example` with a clear
warning about this gotcha.
Alternative cause (less likely): if `gpuctl sleep` was called before the
reboot, the `ssh` container may have been removed entirely. After reboot,
Docker has no container to restart, so only `tailscale` (which `sleep_mode`
preserves) comes back. Fix: run `docker compose up -d` after reboot to
re-create the ssh container, or just call `gpuctl wake` from the dashboard.
## Files added/changed
- `dashboard/Dockerfile` — fixed COPY commands
- `dashboard/.dockerignore` — new
- `dashboard/src/app/page.tsx` — major rewrite (comfy, sleep/wake, upload, SSE)
- `dashboard/src/app/api/status/stream/route.ts` — new SSE endpoint
- `dashboard/src/app/api/models/route.ts` — added DELETE
- `dashboard/src/app/api/models/upload/route.ts` — new
- `dashboard/src/app/api/comfy/route.ts` — new
- `dashboard/src/app/api/comfy/models/route.ts` — new
- `dashboard/src/app/api/comfy/queue/route.ts` — new
- `dashboard/src/app/api/comfy/models/add/route.ts` — new
- `dashboard/src/app/api/comfy/models/rm/route.ts` — new
- `dashboard/src/app/api/system/route.ts` — new
- `dashboard/src/app/api/services/[role]/route.ts` — new
- `dashboard/src/lib/docker.ts` — added start/stop/restart/remove services,
comfy models proxy, sleep/wake/update, model upload/delete
- `ssh/scripts/status.sh` — sleep_mode + wake_mode + update_ssh updated
- `ssh/gpuctl` — usage text updated
- `compose.yaml` — added HOST_PROJECT_PATH validation comment
- `.env.example` — added HOST_PROJECT_PATH warning, LLAMA_EXTRA_ARGS
- `RESTART_WSL.bat` — new
|
||
|
|
c4a91972b3 |
feat: add llama dashboard for managing launch config via web UI
Adds a small Next.js dashboard as a new Docker service () that replaces the need to manually edit and call over SSH every time you want to tweak llama launch parameters. Features: - Live status panel for all GPU-node containers (auto-refresh) - Models list with file sizes, click-to-select active model - Structured launch config form: * Model, ctx-size, parallel, batch-size, n-gpu-layers, threads * Context overflow (none / shift / evict) * Speculative decoding (spec-type, draft model, spec-draft-n-max) * Free-form extra args textarea for anything else - Named presets (save / load / delete) - Start / Restart / Stop / Remove llama actions - Live streaming logs viewer (docker logs -f) - GPU status (nvidia-smi via docker exec on llama) - Auto-writes LLAMA_MODEL and LLAMA_EXTRA_ARGS back to .env so the existing workflow keeps working, and persists full structured config to gpu/dashboard/config.json for reload on next visit Integration: - New service in compose.yaml (no profile, runs always) - Mounts /var/run/docker.sock + HOST_PROJECT_PATH - Tailscale serve exposes port 8090 -> dashboard:3000 - build.sh extended to build the dashboard image Tech: Next.js 16 standalone, React 19, TypeScript 5, Tailwind 4, shadcn-style components, Radix UI primitives. |