Add per-node health checks with status indicators and scheduled probes.

This commit is contained in:
2026-07-19 22:40:21 +02:00
parent 5307ba1a7b
commit aac9e82766
20 changed files with 1674 additions and 65 deletions
+16 -12
View File
@@ -11,6 +11,7 @@ import (
"time"
"codeberg.org/SquidSE/ClusterCanvas/service/internal/auth"
"codeberg.org/SquidSE/ClusterCanvas/service/internal/health"
"codeberg.org/SquidSE/ClusterCanvas/service/internal/runner"
"codeberg.org/SquidSE/ClusterCanvas/service/internal/settings"
)
@@ -77,10 +78,11 @@ type meResponse struct {
// App holds shared API dependencies.
type App struct {
ConfigDir string
Key []byte
Sessions *auth.SessionManager
Executor *runner.Executor
ConfigDir string
Key []byte
Sessions *auth.SessionManager
Executor *runner.Executor
HealthChecker *health.Checker
pendingTOTPMu sync.Mutex
pendingTOTP map[string]string // username -> secret (setup only)
@@ -91,18 +93,20 @@ func newApp(configDir string) (*App, error) {
if err != nil {
// Key is required for setup complete / auth; status still works without it.
app := &App{
ConfigDir: configDir,
pendingTOTP: map[string]string{},
Executor: runner.NewExecutor(configDir, nil),
ConfigDir: configDir,
pendingTOTP: map[string]string{},
Executor: runner.NewExecutor(configDir, nil),
HealthChecker: health.NewChecker(configDir, nil),
}
return app, nil
}
app := &App{
ConfigDir: configDir,
Key: key,
Sessions: auth.NewSessionManager(configDir, key),
pendingTOTP: map[string]string{},
Executor: runner.NewExecutor(configDir, key),
ConfigDir: configDir,
Key: key,
Sessions: auth.NewSessionManager(configDir, key),
pendingTOTP: map[string]string{},
Executor: runner.NewExecutor(configDir, key),
HealthChecker: health.NewChecker(configDir, key),
}
return app, nil
}