Fold alerts under their host, recurring maintenance, run playbooks from alerts, and an Updates page

- Servers can say what they run on (or it is worked out from the Proxmox node); when the host is
  down the guests' offline alerts fold under it: held back, not counted, not notified, still recorded.
- Recurring maintenance schedules made into ordinary windows a week ahead (maintenance_schedules).
- Run a Semaphore template limited to a server from its page or an alert, and watch the run.
- Agents report pending updates (apt, dnf, zypper, Windows Update); an Updates page lists them.
- Migrations 0024 and 0025.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-10-17 01:35:15 +02:00
1 parent 44e393f172
commit 171511c6db
45 files changed
+6772 -44

No files matched your search

+30
View File
@@ -282,6 +282,15 @@ export const servers = sqliteTable("servers", {
// card always shows) once a server IS actually linked, so unlinking stays
// reachable.
hideProxmoxLink: integer("hide_proxmox_link", { mode: "boolean" }).notNull().default(false),
// The server this one runs on (a VM on its host), set by an admin. Null means "work it out": a guest linked to a Proxmox node runs on
// the server named after that node. When the parent stops reporting, this server's own offline alert is folded under the parent's.
parentServerId: integer("parent_server_id"),
// What the agent says is waiting to be installed, as JSON: {manager, count, security, rebootRequired, reportedAt}. Null until it reports.
pendingUpdates: text("pending_updates"),
// When updates were first seen waiting (and none were before) — how long the oldest has been waiting. Null when none are.
updatesPendingSince: text("updates_pending_since"),
});
export const scheduledTasks = sqliteTable("scheduled_tasks", {
@@ -505,3 +514,24 @@ export const shareLinks = sqliteTable("share_links", {
expiresAt: text("expires_at"), // ISO; null = never
lastUsedAt: text("last_used_at"), // ISO
});
// ─── Recurring maintenance ──────────────────────────────────────────────────
// "Every Sunday 02:00–04:00 on these servers": a schedule kept here, turned into ordinary maintenance windows a week ahead (each marked
// `schedule:<id>:<date>` in maintenance_windows.source). The windows are what silence alerts; the schedule only says when they come.
export const maintenanceSchedules = sqliteTable("maintenance_schedules", {
id: integer("id").primaryKey({ autoIncrement: true }),
name: text("name").notNull(), // e.g. "Patch night"
reason: text("reason"),
// JSON: {type: "server" | "integration" | "dns_provider", id: number}[] — polymorphic, so no foreign key; a deleted target is skipped.
targets: text("targets").notNull(),
days: text("days").notNull(), // JSON: weekdays it happens on, 0 = Sunday … 6 = Saturday
startTime: text("start_time").notNull(), // "HH:MM" on the clock of `timezone`
durationMinutes: integer("duration_minutes").notNull(),
timezone: text("timezone").notNull(), // IANA name, so "02:00" stays 02:00 across summer and winter time
enabled: integer("enabled", { mode: "boolean" }).notNull().default(true),
createdBy: text("created_by"),
createdAt: text("created_at")
.notNull()
.default(sql`(current_timestamp)`),
});