feat: add provisioning lifecycle actions

Rename Deployments to Provisioning with compatible redirects and APIs. Add durable Start, Restart, Stop, and Rebuild operations alongside Create and Destroy; rebuild wipes the instance and recreates it in the same slot and port.

Add lifecycle, migration, recovery, and Komodo command tests. Type checks and production build pass; the full suite retains a telemetry assertion failure reproduced on the unchanged branch.

Refs #39
This commit is contained in:
2026-09-27 14:20:04 -04:00
parent 0b0e5b5bdb
commit cfed584614
42 changed files with 886 additions and 108 deletions
+20
View File
@@ -0,0 +1,20 @@
import { json } from '@sveltejs/kit';
import { listDeployments } from '$lib/server/fleet/deployments.js';
import { requestLifecycle } from '$lib/server/fleet/lifecycle.js';
import { runtimeActions, type RuntimeAction } from '$lib/provisioning.js';
import { kick } from '$lib/server/pipeline/worker.js';
export function GET() { return json({ deployments: listDeployments() }); }
export async function POST({ request }: { request: Request }) {
const body = await request.json().catch(() => null);
if (!body || typeof body.server !== 'string' || !body.server || !runtimeActions.includes(body.action)) {
return json({ error: 'server and a valid lifecycle action are required.' }, { status: 400 });
}
try {
const result = requestLifecycle(body.server, body.action as RuntimeAction);
if (!result.ok) return json({ error: result.error }, { status: result.status });
void kick().catch(err => console.error('[provisioning] worker kick failed:', err));
return json(result, { status: 202 });
} catch (err) { return json({ error: (err as Error).message }, { status: 400 }); }
}
@@ -0,0 +1 @@
export * from '../../deployments/[id]/+server.js';
@@ -0,0 +1 @@
export * from '../../../deployments/[id]/cancel/+server.js';
@@ -0,0 +1 @@
export * from '../../../deployments/[id]/resume/+server.js';
@@ -0,0 +1 @@
export * from '../../deployments/house-party/+server.js';
@@ -0,0 +1 @@
export * from '../../deployments/preview/+server.js';