Initial commit — SvelteKit fleet manager for T5 Plutonium servers
Ports push_scripts.sh (1497 lines of bash) to a SvelteKit + SQLite web app that manages a fleet of T5 Plutonium servers running on Komodo. Same push and beta workflow as the shell script, with a live SSE pipeline view, a !rt-token-gated auth modal that hard-pauses deployments on stale tokens, per-file audit diffs, and a Komodo-container deployment target. - Push/beta engines port the exact filter, held-by-beta, conflict, and stale-backup rules from the shell script - SQLite (better-sqlite3) replaces script_metadata.json; a one-shot importer moves legacy state over on first boot - 16 vitest tests cover push add/update/skip, beta open→rollback, open→promote, conflict guards, sweep frozen/manual branches, and IW4M login/status parsing - docker/ + komodo/stack.toml deploy as a managed container on the same host as the game servers, /root/zombies bind-mounted at the same path the shell script used
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
import { json } from '@sveltejs/kit';
|
||||
import { openBeta, updateBeta, listBetas, listBetaScripts, listBetaServers, BetaError } from '$lib/server/fleet/beta.js';
|
||||
import { stagedFiles, findTargets } from '$lib/server/fleet/files.js';
|
||||
import { kick } from '$lib/server/pipeline/worker.js';
|
||||
|
||||
export async function GET() {
|
||||
const staged = await stagedFiles();
|
||||
const withHints = await Promise.all(
|
||||
staged.map(async (base) => ({
|
||||
base,
|
||||
hits: await findTargets(base)
|
||||
}))
|
||||
);
|
||||
const betas = listBetas().map((b) => ({
|
||||
...b,
|
||||
servers: listBetaServers(b.slug),
|
||||
scripts: listBetaScripts(b.slug)
|
||||
}));
|
||||
return json({ staged: withHints, betas });
|
||||
}
|
||||
|
||||
export async function POST({ request }: { request: Request }) {
|
||||
const body = (await request.json().catch(() => ({}))) as {
|
||||
name?: string;
|
||||
patterns?: string[];
|
||||
dryRun?: boolean;
|
||||
create?: boolean;
|
||||
};
|
||||
if (!body.name) return json({ ok: false, error: 'name is required' }, { status: 400 });
|
||||
try {
|
||||
const res = await openBeta({
|
||||
name: body.name,
|
||||
patterns: body.patterns ?? ['*'],
|
||||
dryRun: body.dryRun ?? false,
|
||||
create: body.create ?? false
|
||||
});
|
||||
if (!res.dryRun) void kick();
|
||||
return json({ ok: true, result: res });
|
||||
} catch (err) {
|
||||
if (err instanceof BetaError) {
|
||||
return json({ ok: false, error: err.message, kind: err.kind, details: err.details }, { status: 409 });
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
export async function PATCH({ request }: { request: Request }) {
|
||||
const body = (await request.json().catch(() => ({}))) as { name?: string; dryRun?: boolean };
|
||||
if (!body.name) return json({ ok: false, error: 'name is required' }, { status: 400 });
|
||||
try {
|
||||
const res = await updateBeta(body.name, body.dryRun ?? false);
|
||||
return json({ ok: true, result: res });
|
||||
} catch (err) {
|
||||
if (err instanceof BetaError) {
|
||||
return json({ ok: false, error: err.message, kind: err.kind, details: err.details }, { status: 409 });
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user