Add agent uninstall script and UI reveal

Lets a server be cleanly removed from agent management: uninstall.sh
stops/disables the systemd timer and deletes the unit files, the
installed script, and the credentials env file, without touching the
server's entry or task history in the app. install.sh now prints the
uninstall command on success, and the Servers page has an "Uninstall"
button that reveals the same command (safe to show anytime since it
carries no secret).
This commit is contained in:
bobban committed 2026-09-02 22:21:05 +02:00
1 parent 5269499520
commit 0615866311
5 files changed
+79

No files matched your search

+15
View File
@@ -7,6 +7,7 @@ export default function ServersAdmin() {
const [hostname, setHostname] = useState("");
const [description, setDescription] = useState("");
const [newToken, setNewToken] = useState<{ server: ServerRecord; token: string } | null>(null);
const [uninstallFor, setUninstallFor] = useState<ServerRecord | null>(null);
const [error, setError] = useState<string | null>(null);
const load = () => api.servers.list().then((res) => setServers(res.servers));
@@ -96,6 +97,17 @@ export default function ServersAdmin() {
</section>
)}
{uninstallFor && (
<section className="token-reveal uninstall-reveal">
<h3>Uninstall agent from {uninstallFor.name}</h3>
<p>Run this on the server to stop and remove the agent (its entry here is kept):</p>
<pre className="install-command">{`curl -fsSL ${window.location.origin}/agent/linux/uninstall.sh | bash`}</pre>
<button onClick={() => setUninstallFor(null)} className="btn">
Dismiss
</button>
</section>
)}
<section className="server-list">
<h2>Servers</h2>
<table>
@@ -119,6 +131,9 @@ export default function ServersAdmin() {
<button onClick={() => handleRotate(s.id)} className="btn btn-small">
Rotate token
</button>
<button onClick={() => setUninstallFor(s)} className="btn btn-small">
Uninstall
</button>
<button onClick={() => handleDelete(s.id)} className="btn btn-small btn-danger">
Delete
</button>
+5
View File
@@ -375,6 +375,11 @@ tr.stale {
margin-bottom: 1.5rem;
}
.uninstall-reveal {
background: var(--surface);
border: 1px solid var(--border);
}
.token-value {
display: block;
background: var(--surface);