Setup asks where alerts go, and sends each a test

notify.webhooks existed and setup never asked for one, so a new site
learnt of a parked model or a lost node from its users. `llmgw server
init --webhook URL` (repeatable) and a Notification webhooks field on
both setup screens take them now. Slack's address, Mattermost's and
Rocket.Chat's /hooks/ and Discord's …/slack are sent Slack's text, any
other the event as JSON; slack: or json: in front says which.

Once the control plane runs, they are added to the cluster's settings
beside the webhooks already there, none twice, and setup waits for the
control planes to start again on the change before sending each a test,
saying which answered. A webhook's path is its secret, so it is shown by
host only. A failure is said, not fatal: the cluster serves without its
alerts, and ctl notify test tries again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ilker ManapandClaude Opus 5.5 committed 2026-10-14 13:55:48 +02:00
1 parent 7c53380e68
commit d1e91868ee
10 files changed
+444 -13

No files matched your search

+28 -1
View File
@@ -50,6 +50,7 @@ func (w *lineWriter) Write(p []byte) (int, error) {
const (
fAdmin = iota
fHosts
fWebhooks
fPostgres
fMirror
fNode
@@ -70,6 +71,7 @@ type initModel struct {
focus int
admin textField
hosts textField
webhooks textField
bundle textField
bundleSHA textField
toggles [fCount]bool
@@ -103,6 +105,11 @@ func newInitModel(in *serverInit, found []string, askForm bool) initModel {
hosts.SetValue(strings.Join(in.hosts, ", "))
hosts.CharLimit = 400
hosts.Width = 40
webhooks := newTextField()
webhooks.Placeholder = "https://hooks.slack.com/services/…"
webhooks.SetValue(strings.Join(in.webhooks, ", "))
webhooks.CharLimit = 800
webhooks.Width = 40
bundle := newTextField()
bundle.Placeholder = "/media/usb/llmgw-bundle.tar"
bundle.SetValue(in.bundle)
@@ -114,7 +121,7 @@ func newInitModel(in *serverInit, found []string, askForm bool) initModel {
bundleSHA.CharLimit = 64
bundleSHA.Width = 64
sp := newSpinner()
m := initModel{in: in, found: found, form: askForm, admin: admin, hosts: hosts,
m := initModel{in: in, found: found, form: askForm, admin: admin, hosts: hosts, webhooks: webhooks,
bundle: bundle, bundleSHA: bundleSHA, spin: sp, width: 100}
m.toggles[fPostgres] = in.postgres
m.toggles[fMirror] = !in.noMirror
@@ -235,6 +242,17 @@ func (m initModel) formKey(k tea.KeyMsg) (tea.Model, tea.Cmd) {
m.moveFocus(0)
return m, nil
}
hooks := strings.TrimSpace(m.webhooks.Value())
if _, err := parseWebhooks([]string{hooks}); err != nil {
m.formError = err.Error()
m.focus = fWebhooks
m.moveFocus(0)
return m, nil
}
m.in.webhooks = nil
if hooks != "" {
m.in.webhooks = []string{hooks}
}
m.in.bundle, m.in.bundleSHA = bundle, sum
m.in.admin = admin
m.in.hosts = nil
@@ -260,6 +278,10 @@ func (m initModel) formKey(k tea.KeyMsg) (tea.Model, tea.Cmd) {
var cmd tea.Cmd
m.hosts, cmd = m.hosts.Update(k)
return m, cmd
case fWebhooks:
var cmd tea.Cmd
m.webhooks, cmd = m.webhooks.Update(k)
return m, cmd
case fBundle:
var cmd tea.Cmd
m.bundle, cmd = m.bundle.Update(k)
@@ -284,6 +306,7 @@ func (m *initModel) moveFocus(d int) {
}
m.admin.Blur()
m.hosts.Blur()
m.webhooks.Blur()
m.bundle.Blur()
m.bundleSHA.Blur()
switch m.focus {
@@ -291,6 +314,8 @@ func (m *initModel) moveFocus(d int) {
m.admin.Focus()
case fHosts:
m.hosts.Focus()
case fWebhooks:
m.webhooks.Focus()
case fBundle:
m.bundle.Focus()
case fBundleSHA:
@@ -409,6 +434,8 @@ func (m initModel) formView() string {
found = strings.Join(m.found, ", ")
}
b.WriteString(" " + sDim.Render("Already in the certificate: "+found+". Add a DNS name or NAT address here.") + "\n\n")
fmt.Fprintf(&b, "%s\n %s\n", label(fWebhooks, "Notification webhooks"), m.webhooks.View())
b.WriteString(" " + sDim.Render("Where a parked model, a lost node or a spent budget is said: Slack, Mattermost, or any URL taking JSON. Comma-separated; a test is sent.") + "\n\n")
b.WriteString(check(fPostgres, "PostgreSQL", "rather than SQLite; installed here, for several control planes or a larger store"))
if m.in.mirrorURL != "" {
b.WriteString(" Model mirror " + sDim.Render("at "+m.in.mirrorURL+", from --mirror") + "\n")