Files
edgeguard-native/internal/models/backend.go
Debian 0ac91a7c59 feat: per-Backend timeout server + Alerts-Deeplink + Retention + Cert-Prune — v1.3.4
- feat(backends): per-Backend `server_timeout_seconds` (nullable, Default 60s).
  Rendert `timeout server <N>s` im HAProxy-Backend-Block — für langsam
  antwortende Upstreams (KI-/Inferenz-Server mit gepufferter Antwort).
  Migration 0044 (+CHECK 1..86400), Model/Repo/Template/UI + Render-Test.
- fix(ui): Dashboard-Alert-Karte verlinkt auf /alerts?tab=events; Alerts-Seite
  respektiert ?tab= (Deeplink landete bisher auf leerem Channels-Tab).
- feat(scheduler): alert_events-Retention (90d) im täglichen Cleanup-Tick —
  Schutz vor unbounded growth der node-lokalen Health-Event-History.
- fix(cluster): Cert-Sync prunt jetzt lokale .pem die der Primary nicht mehr
  hat (Waisen gelöschter Domains); schützt _default.pem + eigenen Node-Cert.
- fix(security): x/text v0.37→v0.39 (GO-2026-5970, Infinite-Loop; via ACME+goose
  aktiv aufgerufen — govulncheck-Release-Gate).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-27 15:59:55 +02:00

43 lines
2.2 KiB
Go

package models
import "time"
// Backend ist eine Pool-Definition (Name, Scheme, Healthcheck, LB-Algo).
// Die konkreten Upstream-Server leben in BackendServer (1:N).
type Backend struct {
ID int64 `gorm:"primaryKey" json:"id"`
Name string `gorm:"column:name;uniqueIndex" json:"name"`
Scheme string `gorm:"column:scheme" json:"scheme"`
HealthCheckPath *string `gorm:"column:health_check_path" json:"health_check_path,omitempty"`
LBAlgorithm string `gorm:"column:lb_algorithm" json:"lb_algorithm"`
WebSocket bool `gorm:"column:websocket" json:"websocket"`
ForceHTTP1 bool `gorm:"column:force_http1" json:"force_http1"`
// ServerTimeoutSeconds überschreibt `timeout server` für dieses
// Backend (Sekunden). nil = defaults-Timeout (60s). Für langsam
// antwortende Upstreams (KI-/Inferenz-Server ohne Streaming).
ServerTimeoutSeconds *int `gorm:"column:server_timeout_seconds" json:"server_timeout_seconds,omitempty"`
Active bool `gorm:"column:active" json:"active"`
CreatedAt time.Time `gorm:"column:created_at" json:"created_at"`
UpdatedAt time.Time `gorm:"column:updated_at" json:"updated_at"`
}
func (Backend) TableName() string { return "backends" }
// BackendServer ist ein konkreter Upstream im Pool. weight steuert das
// LB-Verhältnis (roundrobin/leastconn); backup wird nur bedient wenn
// alle non-backup-Server down sind.
type BackendServer struct {
ID int64 `gorm:"primaryKey" json:"id"`
BackendID int64 `gorm:"column:backend_id" json:"backend_id"`
Name string `gorm:"column:name" json:"name"`
Address string `gorm:"column:address" json:"address"`
Port int `gorm:"column:port" json:"port"`
Weight int `gorm:"column:weight" json:"weight"`
Backup bool `gorm:"column:backup" json:"backup"`
Active bool `gorm:"column:active" json:"active"`
CreatedAt time.Time `gorm:"column:created_at" json:"created_at"`
UpdatedAt time.Time `gorm:"column:updated_at" json:"updated_at"`
}
func (BackendServer) TableName() string { return "backend_servers" }