Files
awoooi/docs/runbooks/RUNBOOK-OLLAMA-FAILOVER.md
ogt 541a32a9cb
Some checks failed
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 2m38s
CD Pipeline / build-and-deploy (push) Failing after 24m19s
CD Pipeline / post-deploy-checks (push) Has been skipped
feat(sre): enforce typed controlled automation
2026-07-16 17:32:01 +08:00

75 lines
3.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Ollama付費 Critic 容災 Runbook
狀態:`global_product_governance_v2`2026-07-16 Asia/Taipei。
## 唯一 production 順序
1. `ollama_gcp_a` — GCP-A Ollamacloud data boundary。
2. `ollama_gcp_b` — GCP-B Ollamacloud data boundary。
3. `ollama_local` — host111 Ollama唯一 local-only hop。
4. `claude` — Anthropic Claude API付費 canaryfallback。
5. `gemini` — Gemini API最後付費備援。
Host110 不再是 Ollama provider、proxy 或 fallback。任何告警、runtime
manifest、Ansible PlayBook、verifier 或 UI 若將 host110 顯示為 Ollama
identity必須標成 `asset_identity_drift`,不得切換或自動重建舊 transport。
GCP-A/B 目前的 direct public HTTP 是暫時 transport不能算完整 production
closure。P0 replacement 是 WireGuard `10.77.114.x` mesh完成 replay、canary、
runtime readback 後才能關閉 public listener。
## 只讀診斷
```bash
bash scripts/ops/ollama111-fallback-proxy-diagnose.sh
```
輸出只包含 canonical provider、data boundary、HTTP 健康狀態與 production
route readback 狀態;不輸出 key、prompt、response 或 host110 proxy 資訊。
判讀:
| 證據 | 判定 | 安全下一步 |
|---|---|---|
| GCP-A healthy | 保持第一順位 | 不切換 |
| GCP-A unavailable、GCP-B healthy | 第二順位可用 | 建立 GCP-A transport work item不改固定順序 |
| GCP-A/B unavailable、host111 healthy | local hop 可用 | 保持 local-only privacy boundary |
| host111 unavailable | local-only 任務 fail closed | 由 host111 Ansible executor check/apply/verify |
| Claude/Gemini 被使用 | 前三跳皆有 bounded unavailable receipts | 驗證 sanitized receipt、token/cost cap、rollback |
| 任一 circuit open | 該 candidate 不得滑到別台主機或別 domain | 保留 exact failure receipt等待 cooldown同 domain repair |
## Alert 與自動化契約
每個 failoverrecovery lifecycle 必須顯示:
- canonical source 與 provider identity
- Ollama RCAClaude 或 Gemini Critic 是否實際呼叫;
- deterministic policy decision
- executor若沒有必須明示 `none`
- independent verifier 與 receipt ID
- token、cost、latency及 paid budget state
- rollbackno-write terminal
- KM、RAG、MCP、PlayBook durable acknowledgement。
只讀 route/status 查詢不得觸發 failover Telegram、切換 provider 或修改 Redis。
同一 canonical transition 依 TTL 去重selected primary 與 observed fallback 必須
分開呈現,不能把 fallback 說成 primary 已切換。
## Privacy 與成本
- `require_local=true` 只能使用 host111GCP-A/B 不得因自架 Ollama 被誤認為 local。
- Claude/Gemini 只接收已提交 synthetic fixture 或具可信 sanitization receipt 的資料。
- provider key 只由 protected runtime secret reference 注入;禁止讀回或記錄明文。
- 付費 lane 必須先有 run-owned TTL lease、request/token/daily/monthly cost cap、
generation accounting receipt 和 paired rollback。
- 單一 canary scenario 只能比較該 fixture 的正確率、延遲與成本,不能宣稱模型全面勝出。
## Runtime closure
不能用「health 200」、「CD success」或 Telegram 卡片單獨結案。完整 terminal
`Detect → Normalize → Correlate → Decide → Check → Controlled Apply → Verify → Retry/Rollback → Learn/Writeback`
若 GCP mesh、host111 reachability、paid accounting、independent verifier 或 learning
ack 任一缺失,狀態維持 `partial/degraded/blocked_with_safe_next_action`