Restart a server after its updates, and check that it came back

An update run can name a second Semaphore playbook that restarts the server
once the updates are in and it says a restart is due. The run keeps the
maintenance window up, follows the restart, waits for the server to report
again and checks from its uptime (or its restart flag clearing) that it did
start again. A server that only needs a restart has a Restart button on the
Updates page, and a patch plan can carry the restart playbook too.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-11-10 23:45:52 +01:00
1 parent 97df28c6dc
commit e4f3a54189
19 files changed
+10275 -87

No files matched your search

+14 -7
View File
@@ -88,7 +88,7 @@ export default function Updates({ user }: { user: CurrentUser }) {
function WaitingNow({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
const canRun = user.role === "admin" || user.role === "operator";
// The server being updated now (its drawer is open), and a counter that makes the runs card look again after one was started.
const [updating, setUpdating] = useState<UpdatesServer | null>(null);
const [updating, setUpdating] = useState<{ server: UpdatesServer; mode: "update" | "restart" } | null>(null);
const [runsKey, setRunsKey] = useState(0);
const [servers, setServers] = useState<UpdatesServer[] | null>(null);
const [agentLatest, setAgentLatest] = useState<AgentLatest | null>(null);
@@ -101,7 +101,7 @@ function WaitingNow({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
useEffect(() => {
if (!wantedUpdate || !servers || !canRun) return;
const server = servers.find((s) => String(s.id) === wantedUpdate);
if (server) setUpdating(server);
if (server) setUpdating({ server, mode: "update" });
setParams(
(prev) => {
const next = new URLSearchParams(prev);
@@ -188,7 +188,7 @@ function WaitingNow({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
</div>
{tabs}
<p className="text-secondary">
What the agents say is waiting to be installed on each server, and the Docker containers that have a newer image. {canRun ? "Update… applies a server's updates through a Semaphore playbook: it silences the server, runs the playbook, waits for the server to report again and tells you what is left." : "Operators can apply a server's updates from here."}
What the agents say is waiting to be installed on each server, and the Docker containers that have a newer image. {canRun ? "Update… applies a server's updates through a Semaphore playbook: it silences the server, runs the playbook, waits for the server to report again and tells you what is left — and can restart it afterwards, with a second playbook, if it says a restart is due. Restart… does only the restart." : "Operators can apply a server's updates, and restart a server that needs it, from here."}
</p>
<ErrorNotice error={error} />
@@ -266,9 +266,16 @@ function WaitingNow({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
</td>
{canRun && (
<td className="stack-wide">
<button type="button" className="btn btn-sm btn-outline-primary" disabled={r.count === null || r.count === 0 || r.server.lastSeenAt === null} title={r.count ? "Apply this server's updates through a Semaphore playbook" : "Nothing is waiting, or the agent hasn't said"} onClick={() => setUpdating(r.server)}>
Update…
</button>
<div className="btn-list flex-nowrap">
<button type="button" className="btn btn-sm btn-outline-primary" disabled={r.count === null || r.count === 0 || r.server.lastSeenAt === null} title={r.count ? "Apply this server's updates through a Semaphore playbook" : "Nothing is waiting, or the agent hasn't said"} onClick={() => setUpdating({ server: r.server, mode: "update" })}>
Update…
</button>
{r.restart && (
<button type="button" className="btn btn-sm btn-outline-warning" disabled={r.server.lastSeenAt === null} title="This server says a restart is due: restart it through a Semaphore playbook" onClick={() => setUpdating({ server: r.server, mode: "restart" })}>
Restart…
</button>
)}
</div>
</td>
)}
</tr>
@@ -332,7 +339,7 @@ function WaitingNow({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
</div>
)}
{updating && <UpdateRunDrawer server={updating} onClose={() => setUpdating(null)} onStarted={() => setRunsKey((k) => k + 1)} />}
{updating && <UpdateRunDrawer server={updating.server} mode={updating.mode} onClose={() => setUpdating(null)} onStarted={() => setRunsKey((k) => k + 1)} />}
</>
);
}