fix(pipeline): harden upstream resilience and production shutdown

DoH через DoWithRetry; CDN preview через UpstreamHTTPDo; частичный fail CDN (EVOBGP_CDN_PARTIAL_OK); безопасный доступ к Job.Meta; drain jobs при SIGTERM; ValidateProductionEnforce при EVOBGP_PRODUCTION=1.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
Denozordec
2026-07-31 12:11:52 +07:00
co-authored by Cursor
parent 1e04e91dd8
commit 53ce80c9ff
14 changed files with 228 additions and 16 deletions
+10
View File
@@ -29,6 +29,9 @@ func main() {
os.Exit(dbcli.Run(os.Args[2:]))
}
cfg := config.Load()
if err := config.ValidateProductionEnforce(); err != nil {
log.Fatal(err)
}
opts := httpapi.Options{
APIKeys: os.Getenv("EVOBGP_API_KEYS"),
DatabaseURL: cfg.DatabaseURL,
@@ -86,6 +89,13 @@ func main() {
<-ctx.Done()
shutdownCtx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
defer cancel()
n := srv.Jobs().RequestCancelAll()
if n > 0 {
log.Printf("draining %d job(s)…", n)
if err := srv.Jobs().Drain(shutdownCtx); err != nil {
log.Printf("job drain: %v", err)
}
}
if err := httpSrv.Shutdown(shutdownCtx); err != nil {
log.Printf("HTTP shutdown: %v", err)
}
+10
View File
@@ -24,6 +24,9 @@ func main() {
os.Exit(dbcli.Run(os.Args[2:]))
}
cfg := config.Load()
if err := config.ValidateProductionEnforce(); err != nil {
log.Fatal(err)
}
seedDemo := os.Getenv("EVOBGP_SEED_DEMO") != "0"
opts := httpapi.Options{
APIKeys: os.Getenv("EVOBGP_API_KEYS"),
@@ -78,6 +81,13 @@ func main() {
<-ctx.Done()
shutdownCtx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
defer cancel()
n := srv.Jobs().RequestCancelAll()
if n > 0 {
log.Printf("draining %d job(s)…", n)
if err := srv.Jobs().Drain(shutdownCtx); err != nil {
log.Printf("job drain: %v", err)
}
}
if err := httpSrv.Shutdown(shutdownCtx); err != nil {
log.Printf("HTTP shutdown: %v", err)
}