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:
2026-09-12 00:23:51 -04:00
commit d99711563e
67 changed files with 9415 additions and 0 deletions
+134
View File
@@ -0,0 +1,134 @@
<script lang="ts">
import { onMount } from 'svelte';
interface ServerRow {
server: string;
restart_state: string;
files_changed: number;
players: number | null;
error: string | null;
}
interface Deployment {
id: string;
action: string;
started_at: string;
finished_at: string | null;
triggered_by: string | null;
servers: ServerRow[];
}
let deployments = $state<Deployment[]>([]);
let loading = $state(true);
onMount(async () => {
const res = await fetch('/api/deployments');
const body = (await res.json()) as { deployments: Deployment[] };
deployments = body.deployments;
loading = false;
});
function isActive(d: Deployment): boolean {
return d.servers.some((s) => s.restart_state === 'pending' || s.restart_state === 'failed');
}
function chipColor(state: string): { bg: string; fg: string } {
switch (state) {
case 'done': return { bg: '#2d4a2d', fg: '#a8e6a8' };
case 'failed': return { bg: '#4a2d2d', fg: '#ff8080' };
case 'pending': return { bg: '#3a2f00', fg: '#ffcc55' };
case 'manual': return { bg: '#333', fg: '#aaa' };
default: return { bg: '#222', fg: '#888' };
}
}
function ago(iso: string): string {
const d = Date.now() - new Date(iso).getTime();
if (d < 60_000) return 'just now';
if (d < 3_600_000) return `${Math.floor(d / 60_000)}m ago`;
if (d < 86_400_000) return `${Math.floor(d / 3_600_000)}h ago`;
return `${Math.floor(d / 86_400_000)}d ago`;
}
let active = $derived(deployments.filter(isActive));
let history = $derived(deployments.filter((d) => !isActive(d)));
</script>
<h1>Deployments</h1>
{#if loading}
<p class="empty">loading…</p>
{:else}
<section>
<h2>Active</h2>
{#if active.length === 0}
<p class="empty">nothing active</p>
{:else}
{#each active as d (d.id)}
{@render deployRow(d)}
{/each}
{/if}
</section>
<section>
<h2>History (7 days)</h2>
{#if history.length === 0}
<p class="empty">no completed deployments in the retention window</p>
{:else}
{#each history as d (d.id)}
{@render deployRow(d)}
{/each}
{/if}
</section>
{/if}
{#snippet deployRow(d: Deployment)}
<a class="row" href="/deployments/{d.id}">
<div class="head">
<span class="action">{d.action}</span>
<span class="when">{ago(d.started_at)}</span>
</div>
<div class="chips">
{#each d.servers as s (s.server)}
{@const c = chipColor(s.restart_state)}
<span class="chip" style="background:{c.bg};color:{c.fg}" title={s.error ?? ''}>
{s.server}{s.players !== null && s.players > 0 ? ` (${s.players}p)` : ''}
</span>
{/each}
</div>
<div class="id">{d.id}</div>
</a>
{/snippet}
<style>
h1 { color: #ff6060; margin: 0 0 20px; }
h2 {
margin: 30px 0 10px;
font-size: 13px;
text-transform: uppercase;
letter-spacing: 0.5px;
color: #888;
}
.row {
display: block;
background: #141414;
border: 1px solid #333;
border-radius: 6px;
padding: 12px;
margin-bottom: 8px;
color: #ddd;
text-decoration: none;
}
.row:hover { border-color: #555; }
.head { display: flex; justify-content: space-between; margin-bottom: 8px; }
.action { font-family: ui-monospace, monospace; font-size: 13px; }
.when { color: #666; font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.chip {
padding: 2px 6px;
border-radius: 3px;
font-size: 11px;
font-family: ui-monospace, monospace;
}
.id { color: #444; font-family: ui-monospace, monospace; font-size: 11px; }
.empty { color: #666; font-size: 13px; }
</style>