feat(dashboard): v2 — SSE status, model upload, comfy management, system controls #2
Reference in New Issue
Block a user
Delete Branch "feature/dashboard-v2"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Что нового
1. Фикс build failure на legacy Docker builder
Убрал
COPY yarn.lock*(wildcard без матча ломается на legacy builder без BuildKit). Заменил на явныйCOPY package.json package-lock.json ./. Добавилdashboard/.dockerignore— исключаетnode_modules/.nextиз контекста (быстрее сборка, меньше контекст).2. Real-time статус через SSE (вместо fetch-polling)
Новый эндпоинт
/api/status/stream— открывает single long-lived соединение и пушитstatusevent каждые 4 сек со списком контейнеров + llama health. Фронт используетEventSourceвместоsetInterval(fetch). Автореконнект при обрыве.Почему SSE, а не WebSocket: push server→client — это всё что нужно для статуса; работает через любой HTTP-прокси (Tailscale serve); built-in в браузер; zero extra deps; сохраняет Next.js standalone output (маленький docker image).
3. Загрузка .gguf через UI
POST /api/models/upload(multipart) → сохраняет вgpu/llama_models/XMLHttpRequest.upload.onprogressDELETE /api/models?name=...для удаления.gguf, нет path traversal4. ComfyUI models management (как
gpuctl comfy models ...)Новые API routes (всё через
docker exec model-worker python3 /app/worker.py ...):GET /api/comfy/models?type=— список моделейGET /api/comfy/queue— текущая очередь загрузокPOST /api/comfy/models/add{url, type} — поставить в очередьPOST /api/comfy/models/rm{filename, type?} — удалить модельНовая вкладка Comfy с тремя блоками: очередь загрузок (live progress), форма добавления по URL, таблица моделей с фильтром по типу и кнопкой удаления.
5. ComfyUI start/stop/restart
POST /api/comfy{action: start|stop|restart}6. System controls (sleep / wake / update)
POST /api/system{action: sleep|wake|update}updateзапускаетsh build.sh+docker compose up -d --force-recreate7. Generic service management
Новый
/api/services/[role]— start/stop/restart/remove/logs для любого сервиса: llama, comfyui, model-worker, webdav, ssh, ssh-companion, gpu-test, dashboard.Вкладка System → таблица контейнеров с per-container action buttons (▶ / ↻ / ■ / 🗑). Tailscale защищён от удаления.
8. Live logs для любого сервиса
Logs tab теперь имеет target selector (llama / comfyui / dashboard / ssh). Использует streaming endpoint
/api/services/<role>.Sleep/wake интеграция
ssh/scripts/status.sh:sleep_mode()— добавленdashboardв список удаля��мых контейнеров (раньше оставался живым в sleep mode)wake_mode()— добавленdashboardв список запускаемых +--profile wakeфлагupdate_ssh()— добавленdashboard+--profile wakeфлагЭто также фиксит тонкий баг:
ssh-companion,model-worker,webdavимелиprofiles: [wake], ноwake_mode()/update_ssh()вызывалиdocker compose up -dбез--profile wake. Compose v2 в этом случае либо падает с "no such service", либо тихо игнорирует. Теперь--profile wakeпередаётся явно.RESTART_WSL.bat
Новый
RESTART_WSL.batрядом сSTART_GPU_NODE.bat:wsl --shutdown+ 3s waitdocker compose up -d— стартует GPU nodessh-only-tailscale-after-reboot — разбор
Самая вероятная причина: пустой
HOST_PROJECT_PATHв.env.ssh/entrypoint.shexits 1 еслиHOST_PROJECT_PATHпустойrestart: alwaysDocker daemon пытается рестартить контейнер при каждой загрузке сервера, но он сразу падаетtailscaleне требует этой env-переменной → стартует чистоФикс: в начало
compose.yamlдобавлена (закомментированная по умолчанию) валидация:Раскомментируй чтобы получить fail-fast ошибку если забыл
.env. В.env.exampleдобавлен явный warning.Альтернативная причина (менее вероятная): если до ребута был вызван
gpuctl sleep—sshконтейнер мог быть удалён целиком. После ребута Docker нечего рестартить. Лечение:docker compose up -dпосле ребута (что и делает новыйRESTART_WSL.bat), либоWakeкнопка из дашборда.Авторизация
Не добавлял — доступ через Tailscale serve на порту 8090, внутри tailnet. Контент публичный только внутри твоей сети, как ты и просил.
Файлы
dashboard/Dockerfile— fixed COPYdashboard/.dockerignore— newdashboard/src/app/page.tsx— major rewritedashboard/src/app/api/status/stream/route.ts— new SSEdashboard/src/app/api/models/upload/route.ts— newdashboard/src/app/api/models/route.ts— added DELETEdashboard/src/app/api/comfy/*— new (5 routes)dashboard/src/app/api/system/route.ts— newdashboard/src/app/api/services/[role]/route.ts— newdashboard/src/lib/docker.ts— added comfy/system/upload/service functionsssh/scripts/status.sh— sleep/wake/update updatesssh/gpuctl— usage textcompose.yaml— HOST_PROJECT_PATH validation comment.env.example— warning about HOST_PROJECT_PATHRESTART_WSL.bat— newTodo / следующими PR
## 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