bf1c19db2f7776b6a3a17cf24933e4fd05a69fbd
2 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
93bf5cdc88 |
fix(dashboard): start-llama diagnostics + comfy/queue no longer 500s
## Two issues from user feedback ### Issue 1: Apply doesn't change model User reports: 'if I select a model in the panel, it shows as the new model but logs show the default model is still running'. Most likely cause: the user has an old model-worker image without the `--json` flag, OR the request body isn't including the new model name. The fix here is purely diagnostic — add logging so we can see what's happening: - `startLlama()` now logs to console: * `[startLlama] model: <name>` * `[startLlama] extraArgs: <args>` * `[startLlama] compose exit: <code>` * `[startLlama] compose output: <full docker compose output>` - `/api/llama` POST logs: * `[/api/llama] action: <action> config.model: <name>` * `[/api/llama] merged cfg.model: <name>` * `[/api/llama] startLlama result ok: <bool>` - `handleStartLlama()` now includes the last 500 chars of compose logs in the toast message if start failed. Toast component renders multi-line messages as `<pre>` so the logs are readable. - Toast now uses `max-w-md` (was `max-w-sm`) and supports multi-line content with `whitespace-pre-wrap`. After deploying, run `docker logs -f gpu-node-win-dashboard` while clicking Start Llama — you'll see exactly what model name is being sent and what docker compose outputs. ### Issue 2: /api/comfy/queue returns 500 every 5s User reports: 'in logs I see problems with queue — 500 Internal Server Error'. Even when not downloading anything. Most likely cause: model-worker image on prod is old and doesn't support `queue --json` flag (added in PR #5). When `modelWorkerExec('queue', '--json')` fails with non-zero exit code, `getComfyQueue()` returns `ok: false`, and the endpoint returns 500. Frontend polls every 5s, so we get a flood of 500s. Fixes: - `/api/comfy/queue` no longer returns 500 on worker failure. Always returns 200 with `{ ok: false, queue: [], error: <reason> }` — frontend shows empty queue, no error toast. - `modelWorkerExec()` now logs failures to console.error with: * args being called * container name * exit code * stderr (truncated to 500 chars) This will show up in `docker logs gpu-node-win-dashboard` so we can see if it's a missing --json flag, container not running, etc. ## After deploying ```sh git pull && sh build.sh docker compose up -d --force-recreate dashboard model-worker ``` If model-worker is on old image (no --json support), the dashboard logs will show: [modelWorkerExec] args=["queue","--json"] container=gpu-node-win-model-worker exitCode=1 stderr=Usage: ... worker.py queue [--watch] [--clear] ... Recreate model-worker to pick up the new image: docker compose up -d --force-recreate model-worker ## Files changed - dashboard/src/lib/docker.ts: * startLlama() now logs model + extraArgs + compose output * modelWorkerExec() now logs failures with exit code + stderr - dashboard/src/app/api/llama/route.ts: logs action + model + result - dashboard/src/app/api/comfy/queue/route.ts: returns 200 even on failure - dashboard/src/app/page.tsx: * handleStartLlama includes compose logs in toast on failure * Toast component supports multi-line messages (renders as <pre>) |
||
|
|
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
|