競爭對手遷移指南
從 Traefik 遷移到 Webship,且不進行盲目切換。
將入口點、路由器、規則、服務、健康檢查、中介軟體以及 TLS 轉換為穩定的 Webship 路由和策略。
在改變流量之前定義遷移邊界。
首先僅移動 Webship 可以重現和驗證的行為。在其替代品通過類生產測試之前,將應用程序身份驗證、服務發現、腳本和專用緩存規則保留在現有源上。
首先翻譯最小的生產路徑。
來源片段標識了遷移概念;Webship 片段顯示了目標形態。用已在您的環境中驗證的值替換範例網域、地址、憑證、限制和健康檢查路徑。
http:
routers:
app:
rule: Host(`app.example.com`)
service: app
services:
app:
loadBalancer:
servers:
- url: http://127.0.0.1:8080listen = "0.0.0.0:443"
workers = 4
[reverse_proxy]
enabled = true
tls_termination = true
connect_timeout_ms = 2000
max_retries = 0
[reverse_proxy.protocols]
h1 = true
h2 = true
h3 = true
[reverse_proxy.tls]
cert = "/etc/letsencrypt/live/app.example.com/fullchain.pem"
key = "/etc/letsencrypt/live/app.example.com/privkey.pem"
[[reverse_proxy.routes]]
domain = "app.example.com"
path_prefix = "/"
upstreams = ["127.0.0.1:8080", "127.0.0.1:8081"]
load_balancing = "weighted-peak-ewma"
[[reverse_proxy.upstreams]]
address = "127.0.0.1:8080"
protocol = "http1"
health_check_path = "/health"
health_check_interval_ms = 5000
health_check_timeout_ms = 1000
[[reverse_proxy.upstreams]]
address = "127.0.0.1:8081"
protocol = "http1"
health_check_path = "/health"
health_check_interval_ms = 5000
health_check_timeout_ms = 1000
[[reverse_proxy.policies]]
name = "default"
hosts = []
path_prefixes = ["/"]
methods = []
max_body_bytes = 1048576
total_timeout_ms = 30000對應概念,而非語法。
技術指令不總是逐一對應。使用此表格找到對應的 Webship 配置區域,然後驗證有效配置和運行時行為。
| 當前概念或指令 | Webship 配置目標 |
|---|---|
entryPoints | listen + [reverse_proxy.protocols] |
routers rule | [[reverse_proxy.routes]] |
services loadBalancer servers | [[reverse_proxy.upstreams]] |
healthCheck | [[reverse_proxy.upstreams]].health_check_* |
TLS certificate | [reverse_proxy.tls] / [[sites]] cert + key |
使用可逆的五步切換。
在 Webship 通過代表性流量的正確性、容量、安全性、可觀察性和回滾門檻之前,保持舊的監聽器準備就緒。
- 1
可觀察的庫存行為
記錄監聽器、域、路由、上游、證書、重寫、身份驗證、快取規則、健康檢查、限制及操作整合。
- 2
翻譯一個邊界
將一個主機或路由移入嚴格的 TOML。在單獨的替代方案被證實之前,保留 Webship 後的供應商專用模組和應用邏輯。
- 3
離線並本地驗證
運行 --check-config 和 --print-effective-config,檢查刪節後的結果,本地探測健康狀況,並在啟用 HTTP/3 時對 TCP 和 UDP 進行 TLS 操作。
- 4
金絲雀真實流量
向 Webship 發送少量可觀察的流量。比較狀態碼、標頭、主體、延遲、上游健康狀況、快取行為、日誌和安全決策。
- 5
推廣並準備回滾
在測量階段增加流量。保持先前目標的健康狀態並可立即路由,直到達到約定的觀察窗口和負載閘門。
首先進行驗證。回滾請透過路由,而非編輯即時內容。
驗證候選文件,檢查已編輯的有效配置,並在更改流量前探測私有監聽器。在觀察窗口結束前,保留舊的二進位檔、配置、監聽器,以及 DNS 或負載平衡器目標。
/usr/local/bin/webship --check-config --config /etc/webship/production.toml
/usr/local/bin/webship --print-effective-config --config /etc/webship/production.toml
curl --http3-only --insecure https://127.0.0.1:443/health