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,125 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { page } from '$app/stores';
|
||||
import { statusByServer } from '$ui/stores/servers.js';
|
||||
|
||||
interface Server {
|
||||
name: string;
|
||||
komodo_type: string;
|
||||
komodo_name: string;
|
||||
komodo_server: string | null;
|
||||
iw4m_match: string | null;
|
||||
iw4m_value: string | null;
|
||||
last_players: number | null;
|
||||
last_checked_at: string | null;
|
||||
held: Array<{ target: string; slug: string }>;
|
||||
}
|
||||
interface DeploymentRow {
|
||||
id: string;
|
||||
action: string;
|
||||
started_at: string;
|
||||
finished_at: string | null;
|
||||
servers: Array<{ server: string; restart_state: string; players: number | null; error: string | null; files_changed: number }>;
|
||||
}
|
||||
|
||||
let server = $state<Server | null>(null);
|
||||
let history = $state<DeploymentRow[]>([]);
|
||||
let name = $derived($page.params.name ?? '');
|
||||
|
||||
onMount(async () => {
|
||||
const [srvRes, depRes] = await Promise.all([fetch('/api/servers'), fetch('/api/deployments')]);
|
||||
const srvBody = (await srvRes.json()) as { servers: Server[] };
|
||||
const depBody = (await depRes.json()) as { deployments: DeploymentRow[] };
|
||||
server = srvBody.servers.find((s) => s.name === name) ?? null;
|
||||
history = depBody.deployments.filter((d) => d.servers.some((s) => s.server === name));
|
||||
});
|
||||
|
||||
let live = $derived($statusByServer.get(name)?.players);
|
||||
</script>
|
||||
|
||||
{#if server}
|
||||
<h1>{server.name}</h1>
|
||||
<div class="stats">
|
||||
<div class="stat">
|
||||
<div class="k">players</div>
|
||||
<div class="v">{live ?? server.last_players ?? '—'}</div>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<div class="k">komodo</div>
|
||||
<div class="v">{server.komodo_type} · {server.komodo_name}</div>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<div class="k">iw4m</div>
|
||||
<div class="v">{server.iw4m_match ?? '—'} · {server.iw4m_value ?? '—'}</div>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<div class="k">held by beta</div>
|
||||
<div class="v">{server.held.length === 0 ? '—' : server.held.map((h) => h.target).join(', ')}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h2>Deployment history</h2>
|
||||
{#if history.length === 0}
|
||||
<p class="empty">no deployments recorded on this server</p>
|
||||
{:else}
|
||||
{#each history as d (d.id)}
|
||||
{@const mine = d.servers.find((s) => s.server === name)!}
|
||||
<a class="row row-{mine.restart_state}" href="/deployments/{d.id}">
|
||||
<span class="a">{d.action}</span>
|
||||
<span class="s">{mine.restart_state}{mine.players !== null && mine.players > 0 ? ` (${mine.players}p)` : ''}</span>
|
||||
<span class="f">{mine.files_changed} file{mine.files_changed === 1 ? '' : 's'}</span>
|
||||
<span class="w">{d.started_at}</span>
|
||||
{#if mine.error}<span class="err">{mine.error}</span>{/if}
|
||||
</a>
|
||||
{/each}
|
||||
{/if}
|
||||
{:else}
|
||||
<p class="empty">loading…</p>
|
||||
{/if}
|
||||
|
||||
<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;
|
||||
}
|
||||
.stats {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
|
||||
gap: 10px;
|
||||
}
|
||||
.stat {
|
||||
background: #141414;
|
||||
border: 1px solid #333;
|
||||
border-radius: 4px;
|
||||
padding: 10px;
|
||||
}
|
||||
.k { color: #666; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
|
||||
.v { color: #ddd; font-family: ui-monospace, monospace; margin-top: 4px; }
|
||||
.row {
|
||||
display: grid;
|
||||
grid-template-columns: 200px 160px 100px 220px 1fr;
|
||||
gap: 12px;
|
||||
padding: 8px 12px;
|
||||
background: #141414;
|
||||
border: 1px solid #2a2a2a;
|
||||
border-radius: 4px;
|
||||
margin: 4px 0;
|
||||
color: #ddd;
|
||||
text-decoration: none;
|
||||
font-size: 12px;
|
||||
font-family: ui-monospace, monospace;
|
||||
}
|
||||
.row-done { border-left: 3px solid #2d4a2d; }
|
||||
.row-failed { border-left: 3px solid #4a2d2d; }
|
||||
.row-pending { border-left: 3px solid #3a2f00; }
|
||||
.a { color: #ddd; }
|
||||
.s { color: #aaa; }
|
||||
.f { color: #888; }
|
||||
.w { color: #666; }
|
||||
.err { color: #ff6060; }
|
||||
.empty { color: #666; }
|
||||
</style>
|
||||
Reference in New Issue
Block a user