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,203 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { page } from '$app/stores';
|
||||
import DiffViewer from '$ui/components/DiffViewer.svelte';
|
||||
|
||||
interface FileRow {
|
||||
id: number;
|
||||
server: string;
|
||||
verb: string;
|
||||
rel_path: string;
|
||||
sha256_before: string | null;
|
||||
sha256_after: string | null;
|
||||
size_before: number | null;
|
||||
size_after: number | null;
|
||||
}
|
||||
interface ServerRow {
|
||||
deployment_id: string;
|
||||
server: string;
|
||||
files_changed: number;
|
||||
restart_state: string;
|
||||
players: number | null;
|
||||
checked_at: string | null;
|
||||
restarted_at: string | null;
|
||||
attempts: number;
|
||||
error: string | null;
|
||||
}
|
||||
interface Detail {
|
||||
deployment: {
|
||||
id: string;
|
||||
action: string;
|
||||
started_at: string;
|
||||
finished_at: string | null;
|
||||
triggered_by: string | null;
|
||||
};
|
||||
servers: ServerRow[];
|
||||
files: FileRow[];
|
||||
}
|
||||
|
||||
let detail = $state<Detail | null>(null);
|
||||
let openFile = $state<{ id: number; before: string | null; after: string | null; verb: string; relPath: string } | null>(null);
|
||||
|
||||
onMount(async () => {
|
||||
const id = $page.params.id;
|
||||
const res = await fetch(`/api/deployments/${id}`);
|
||||
detail = (await res.json()) as Detail;
|
||||
});
|
||||
|
||||
async function loadDiff(f: FileRow) {
|
||||
const res = await fetch(`/api/deployments/${$page.params.id}/file/${f.id}`);
|
||||
const body = (await res.json()) as { before: string | null; after: string | null; verb: string; relPath: string };
|
||||
openFile = { id: f.id, ...body };
|
||||
}
|
||||
|
||||
// Group files by server for the layout
|
||||
let byServer = $derived(() => {
|
||||
if (!detail) return new Map<string, FileRow[]>();
|
||||
const m = new Map<string, FileRow[]>();
|
||||
for (const f of detail.files) {
|
||||
if (!m.has(f.server)) m.set(f.server, []);
|
||||
m.get(f.server)!.push(f);
|
||||
}
|
||||
return m;
|
||||
});
|
||||
</script>
|
||||
|
||||
{#if detail}
|
||||
<h1>{detail.deployment.action}</h1>
|
||||
<p class="meta">
|
||||
started {detail.deployment.started_at}
|
||||
{#if detail.deployment.finished_at} · finished {detail.deployment.finished_at}{/if}
|
||||
· <code>{detail.deployment.id}</code>
|
||||
</p>
|
||||
|
||||
<h2>Servers</h2>
|
||||
<div class="server-grid">
|
||||
{#each detail.servers as s (s.server)}
|
||||
<div class="srv srv-{s.restart_state}">
|
||||
<div class="name">{s.server}</div>
|
||||
<div class="line">state: {s.restart_state}</div>
|
||||
{#if s.players !== null}<div class="line">players: {s.players}</div>{/if}
|
||||
{#if s.error}<div class="line err">{s.error}</div>{/if}
|
||||
{#if s.restarted_at}<div class="line dim">restarted {s.restarted_at}</div>{/if}
|
||||
<div class="line dim">attempts: {s.attempts}</div>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
<h2>Files</h2>
|
||||
{#each [...byServer().entries()] as [srv, files] (srv)}
|
||||
<div class="file-group">
|
||||
<h3>{srv}</h3>
|
||||
{#each files as f (f.id)}
|
||||
<button class="file-row" onclick={() => loadDiff(f)}>
|
||||
<span class="verb verb-{f.verb}">{f.verb}</span>
|
||||
<code>{f.rel_path}</code>
|
||||
<span class="sizes">
|
||||
{#if f.size_before !== null}{f.size_before}b{/if}
|
||||
{#if f.size_before !== null && f.size_after !== null} → {/if}
|
||||
{#if f.size_after !== null}{f.size_after}b{/if}
|
||||
</span>
|
||||
</button>
|
||||
{/each}
|
||||
</div>
|
||||
{/each}
|
||||
|
||||
{#if openFile}
|
||||
<div class="diff-scrim" onclick={() => (openFile = null)} onkeydown={(e) => { if (e.key === 'Escape') openFile = null; }} role="button" tabindex="-1">
|
||||
<div class="diff-modal" onclick={(e) => e.stopPropagation()} role="none">
|
||||
<button class="close" onclick={() => (openFile = null)}>close</button>
|
||||
<DiffViewer before={openFile.before} after={openFile.after} verb={openFile.verb} relPath={openFile.relPath} />
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{:else}
|
||||
<p class="empty">loading…</p>
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
h1 { color: #ff6060; margin: 0 0 4px; font-family: ui-monospace, monospace; font-size: 18px; }
|
||||
h2 {
|
||||
margin: 24px 0 8px;
|
||||
font-size: 13px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
color: #888;
|
||||
}
|
||||
h3 { margin: 12px 0 4px; font-size: 13px; color: #ddd; font-family: ui-monospace, monospace; }
|
||||
.meta { color: #666; font-size: 12px; margin: 0 0 20px; font-family: ui-monospace, monospace; }
|
||||
.server-grid {
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
|
||||
}
|
||||
.srv {
|
||||
background: #141414;
|
||||
border: 1px solid #333;
|
||||
border-radius: 4px;
|
||||
padding: 10px;
|
||||
}
|
||||
.srv-done { border-color: #2d4a2d; }
|
||||
.srv-failed { border-color: #4a2d2d; }
|
||||
.srv-pending { border-color: #3a2f00; }
|
||||
.name { font-weight: 600; margin-bottom: 4px; }
|
||||
.line { font-size: 12px; color: #bbb; }
|
||||
.line.dim { color: #666; }
|
||||
.line.err { color: #ff6060; }
|
||||
.file-group { margin-bottom: 12px; }
|
||||
.file-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
width: 100%;
|
||||
background: #141414;
|
||||
border: 1px solid #2a2a2a;
|
||||
border-radius: 3px;
|
||||
padding: 4px 8px;
|
||||
margin: 2px 0;
|
||||
color: #ddd;
|
||||
cursor: pointer;
|
||||
font: inherit;
|
||||
text-align: left;
|
||||
}
|
||||
.file-row:hover { border-color: #444; }
|
||||
.verb {
|
||||
padding: 1px 6px;
|
||||
border-radius: 3px;
|
||||
font-size: 11px;
|
||||
font-family: ui-monospace, monospace;
|
||||
}
|
||||
.verb-added { background: #2d4a2d; color: #a8e6a8; }
|
||||
.verb-updated { background: #2d3a4a; color: #a8c8e6; }
|
||||
.verb-removed { background: #4a2d2d; color: #ff8080; }
|
||||
.verb-held { background: #3a2f00; color: #ffcc55; }
|
||||
.sizes { margin-left: auto; color: #666; font-size: 11px; font-family: ui-monospace, monospace; }
|
||||
code { font-family: ui-monospace, monospace; color: #ddd; }
|
||||
.empty { color: #666; }
|
||||
.diff-scrim {
|
||||
position: fixed; inset: 0;
|
||||
background: rgba(0, 0, 0, 0.75);
|
||||
z-index: 100;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
}
|
||||
.diff-modal {
|
||||
max-width: 1000px;
|
||||
width: 92%;
|
||||
max-height: 92vh;
|
||||
overflow: auto;
|
||||
background: #0a0a0a;
|
||||
border: 1px solid #444;
|
||||
border-radius: 6px;
|
||||
padding: 16px;
|
||||
}
|
||||
.close {
|
||||
float: right;
|
||||
background: #222;
|
||||
color: #ddd;
|
||||
border: 1px solid #444;
|
||||
border-radius: 3px;
|
||||
padding: 4px 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user