fix(agentserver): hide upstream errors from clients
CI / changes (push) Successful in 8s
CI / commitlint (push) Has been skipped
CI / openapi (push) Has been skipped
CI / web (push) Has been skipped
CI / go (push) Successful in 58s
CI / bird2 (push) Successful in 14s
CI / release (push) Successful in 3m23s
CI / changes (push) Successful in 8s
CI / commitlint (push) Has been skipped
CI / openapi (push) Has been skipped
CI / web (push) Has been skipped
CI / go (push) Successful in 58s
CI / bird2 (push) Successful in 14s
CI / release (push) Successful in 3m23s
Generic 502 detail как в httpapi; добавлен docs/production-checklist.md. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
# Production checklist
|
||||
|
||||
Краткий чеклист перед выводом EvoBGP в production (10+ клиентов, нестабильная сеть).
|
||||
|
||||
## Обязательно
|
||||
|
||||
- `EVOBGP_SEED_DEMO=0` — отключить demo-tenant и токен `Bearer dev`.
|
||||
- `EVOBGP_DEV_INSECURE` не задавать или `0` — не использовать lab-флаги в prod.
|
||||
- `EVOBGP_BUNDLE_SEED_HEX` — задать стабильный hex-ключ подписи бандлов; сохранить pubkey для нод.
|
||||
- PostgreSQL с TLS (`sslmode` не `disable`) при доступе вне private network.
|
||||
- `EVOBGP_CORS_ORIGINS` — явный whitelist origin веб-панели.
|
||||
- `EVOBGP_STALE_ON_UPSTREAM_ERROR=1` (по умолчанию) — stale snapshot при сбоях CDN/ASN/DoH.
|
||||
|
||||
## Рекомендуется
|
||||
|
||||
- `EVOBGP_JOB_MAX_CONCURRENT=16`, `EVOBGP_DB_MAX_CONNS=25`, `EVOBGP_COLLECT_CONCURRENCY=16` при росте tenants.
|
||||
- `EVOBGP_NODE_DISPATCH_INSECURE_TLS=0` — только валидный TLS к agent.
|
||||
- Ограничить `/metrics` сетевой политикой или reverse proxy.
|
||||
- Профиль `evobgp-all` или HA API + персистентная `job_audit` (PostgreSQL).
|
||||
- Мониторинг drift: `evobgp-deploy`, `last_applied_revision_id` vs published.
|
||||
|
||||
## Не использовать в prod
|
||||
|
||||
- `EVOBGP_CDN_ALLOW_PRIVATE=1` — только тесты/lab.
|
||||
- Plaintext `EVOBGP_API_KEYS` без ротации (break-glass — временно).
|
||||
- Ручное редактирование `evobgp_*.conf` на нодах без ревизии.
|
||||
@@ -14,6 +14,8 @@ import (
|
||||
"evobgp/internal/nodecli"
|
||||
)
|
||||
|
||||
const upstreamErrorDetail = "upstream request failed"
|
||||
|
||||
// Config holds evobgp-agent serve settings.
|
||||
type Config struct {
|
||||
Listen string
|
||||
@@ -85,7 +87,7 @@ func (s *Server) handleBirdProtocols(w http.ResponseWriter, r *http.Request) {
|
||||
out, err := birdfmt.ShowProtocols(ctx, sock, strings.TrimSpace(s.cfg.BirdcBin))
|
||||
if err != nil {
|
||||
log.Printf("agentserver: bird protocols: %v", err)
|
||||
writeProblem(w, http.StatusBadGateway, err.Error())
|
||||
writeProblem(w, http.StatusBadGateway, upstreamErrorDetail)
|
||||
return
|
||||
}
|
||||
writeJSON(w, http.StatusOK, map[string]any{
|
||||
@@ -126,7 +128,7 @@ func (s *Server) handleSync(w http.ResponseWriter, r *http.Request) {
|
||||
})
|
||||
if err != nil {
|
||||
log.Printf("agentserver: sync: %v", err)
|
||||
writeProblem(w, http.StatusBadGateway, err.Error())
|
||||
writeProblem(w, http.StatusBadGateway, upstreamErrorDetail)
|
||||
return
|
||||
}
|
||||
if s.cfg.OnSyncSuccess != nil {
|
||||
|
||||
Reference in New Issue
Block a user