Runtimes: Docker connection via socket proxy, runtime images, host info
- docker-proxy service (tecnativa/docker-socket-proxy) in both compose files; worker uses it via DOCKER_HOST with a dependency-free client. - runtimes table with presets (llama.cpp CPU, vLLM CPU) and custom images; validation of image refs, env, args, devices (/dev/dri, /dev/kfd). - Worker reports Docker/CPU/memory facts and detects its network and models mount; pulls images with progress; image state per runtime. - Settings -> Runtimes page with host card, list, editor, pull/update. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
76683ffd7b
commit
b68b4a2b23
23 files changed
+2622
-2
No files matched your search
@@ -15,6 +15,7 @@ import { DeleteRunner } from "./delete";
|
||||
import { DownloadRunner } from "./download";
|
||||
import { log } from "./log";
|
||||
import type { Runner } from "./runner";
|
||||
import { docker, handlePullRequests, refreshDockerInfo, resetStalePulls, seedRuntimePresets, syncImageStates } from "./runtimes";
|
||||
import { scanModelsDir } from "./scan";
|
||||
import { VerifyRunner } from "./verify";
|
||||
import { settleModelStatus } from "./model-status";
|
||||
@@ -28,6 +29,9 @@ const SHUTDOWN_GRACE_MS = 8_000;
|
||||
const HUB_CHECK_SCAN_MS = 10 * 60_000;
|
||||
/** How often MODELS_DIR is scanned for folders that could be imported (plus on request). */
|
||||
const FOLDER_SCAN_MS = 2 * 60_000;
|
||||
const DOCKER_INFO_MS = 5 * 60_000;
|
||||
const IMAGE_SYNC_MS = 60_000;
|
||||
const PULL_CHECK_MS = 3_000;
|
||||
/** Touched on every heartbeat; the Docker healthcheck checks its age. */
|
||||
const HEALTH_FILE = join(tmpdir(), "kaname-worker-alive");
|
||||
|
||||
@@ -377,6 +381,19 @@ async function main() {
|
||||
timers.push(setInterval(() => void tick(), TICK_MS));
|
||||
timers.push(setInterval(() => void checkHubDue(), HUB_CHECK_SCAN_MS));
|
||||
timers.push(setInterval(() => void scanFolders(), FOLDER_SCAN_MS));
|
||||
|
||||
// Runtimes (Docker): presets, host facts, image states, pulls.
|
||||
await resetStalePulls();
|
||||
await seedRuntimePresets().catch((err) => log.error("seeding runtime presets failed", err));
|
||||
if (docker()) log.info(`Docker API: ${coreEnv().DOCKER_HOST}`);
|
||||
else log.info("DOCKER_HOST not set; runtimes are disabled");
|
||||
const dockerInfo = () => refreshDockerInfo(instanceId).catch((err) => log.error("Docker info failed", err));
|
||||
const imageSync = () => syncImageStates().catch((err) => log.error("image sync failed", err));
|
||||
await dockerInfo();
|
||||
void imageSync();
|
||||
timers.push(setInterval(() => void dockerInfo(), DOCKER_INFO_MS));
|
||||
timers.push(setInterval(() => void imageSync(), IMAGE_SYNC_MS));
|
||||
timers.push(setInterval(() => void handlePullRequests().catch((err) => log.error("pull failed", err)), PULL_CHECK_MS));
|
||||
void scanFolders();
|
||||
void tick();
|
||||
setTimeout(() => void checkHubDue(), 15_000);
|
||||
|
||||
Reference in new issue
Block a user