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:
Pascal LinxweilerandClaude Opus 5.5 committed 2026-10-06 01:24:59 +02:00
1 parent 76683ffd7b
commit b68b4a2b23
23 files changed
+2622 -2

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
import { NextResponse } from "next/server";
import { withAuth } from "@/lib/api-auth";
import { apiError, handleApiError } from "@/lib/api-errors";
import { requestPull, RuntimeError } from "@/lib/runtimes";
/** Ask the worker to pull the image (again; updates moving tags like :server). */
export const POST = withAuth<RouteContext<"/api/runtimes/[id]/pull">>(async (_req, { params }) => {
const { id } = await params;
try {
await requestPull(id);
return new NextResponse(null, { status: 202 });
} catch (err) {
if (err instanceof RuntimeError) return apiError(err.status, err.code, err.message);
return handleApiError(err);
}
});
+25
View File
@@ -0,0 +1,25 @@
import { NextResponse } from "next/server";
import { withAuth } from "@/lib/api-auth";
import { apiError, handleApiError } from "@/lib/api-errors";
import { deleteRuntime, RuntimeBody, RuntimeError, updateRuntime } from "@/lib/runtimes";
export const PUT = withAuth<RouteContext<"/api/runtimes/[id]">>(async (req, { params }) => {
const { id } = await params;
try {
return NextResponse.json(await updateRuntime(id, RuntimeBody.parse(await req.json())));
} catch (err) {
if (err instanceof RuntimeError) return apiError(err.status, err.code, err.message);
return handleApiError(err);
}
});
export const DELETE = withAuth<RouteContext<"/api/runtimes/[id]">>(async (_req, { params }) => {
const { id } = await params;
try {
await deleteRuntime(id);
return new NextResponse(null, { status: 204 });
} catch (err) {
if (err instanceof RuntimeError) return apiError(err.status, err.code, err.message);
return handleApiError(err);
}
});
+21
View File
@@ -0,0 +1,21 @@
import { NextResponse } from "next/server";
import { z } from "zod";
import { withAuth } from "@/lib/api-auth";
import { apiError, handleApiError } from "@/lib/api-errors";
import { createRuntime, getDockerInfo, listRuntimes, RuntimeBody, RuntimeError } from "@/lib/runtimes";
export const dynamic = "force-dynamic";
/** Runtimes plus the Docker facts the worker reported. */
export const GET = withAuth(async () => NextResponse.json({ runtimes: await listRuntimes(), docker: await getDockerInfo() }));
export const POST = withAuth(async (req) => {
try {
const body = RuntimeBody.extend({ preset: z.string().optional() }).parse(await req.json());
return NextResponse.json(await createRuntime(body), { status: 201 });
} catch (err) {
if (err instanceof RuntimeError) return apiError(err.status, err.code, err.message);
return handleApiError(err);
}
});