feat(api): open incidents and notify channels when monitors go down

Results are evaluated as they arrive. Transitions open or resolve the
monitor's incident and queue a notification per enabled channel in the
same transaction; every API replica delivers the outbox with leases and
exponential retries. Organizations manage webhook and email channels,
can send test notifications and list incidents. Email requires
UPTIME_SMTP_URL.

Closes #14
Closes #15
Closes #16

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
Sebastian UnterschützandClaude Opus 5.5 committed 2026-11-22 01:23:37 +01:00
1 parent 01ef543e62
commit 5f42e3e650
12 files changed
+822 -13

No files matched your search

+5
View File
@@ -13,6 +13,7 @@ import (
"git.zb-server.de/ZB-Server/uptimesebi/internal/config"
"git.zb-server.de/ZB-Server/uptimesebi/internal/i18n"
"git.zb-server.de/ZB-Server/uptimesebi/internal/migrations"
"git.zb-server.de/ZB-Server/uptimesebi/internal/notify"
"git.zb-server.de/ZB-Server/uptimesebi/internal/platform"
"git.zb-server.de/ZB-Server/uptimesebi/internal/sealed"
"git.zb-server.de/ZB-Server/uptimesebi/internal/tenant"
@@ -57,6 +58,9 @@ func run(log *slog.Logger, level *slog.LevelVar, args []string) error {
if err != nil {
return err
}
if _, err := notify.ParseSMTP(cfg.SMTPURL); err != nil {
return err
}
deps, err := platform.Connect(ctx, cfg.Storage, log)
if err != nil {
return err
@@ -74,6 +78,7 @@ func run(log *slog.Logger, level *slog.LevelVar, args []string) error {
r.StaticFS("/static", web.Static())
srv.Mount(r)
go srv.RunScheduler(ctx)
go srv.RunNotifier(ctx)
return platform.Serve(ctx, log, platform.NewHTTPServer(cfg.Listen, r), health, 5*time.Second, cfg.ShutdownTimeout)
}