Vercel Daemons 新增 HTTP 活力檢查功能
Add liveness checks to your Daemons
summary_zh: Vercel 在其 Daemons 服務中新增 HTTP 活力檢查,允許使用者設定輕量級健康端點以監控 Daemon 的健康狀態。
- 活力檢查:HTTP 端點回傳 200 表示健康,500 表示不健康。
Vercel Daemons now support configuring HTTP liveness checks.
Start with an HTTP endpoint in your daemon that reports its health. Keep it lightweight so it responds quickly, and have it return an error status when the daemon is no longer healthy:
index.js
let alive = true;
startWorker({
onConnectionError: () => { alive = false }
})
require('http').createServer((req, res) => {
res.statusCode = alive ? 200 : 500;
res.end();
}).listen(1234)
A minimal health endpoint that fails the check when the worker is no longer healthy
The daemon configuration now accepts a livenessProbe value pointing at that endpoint:
vercel.json
{
"daemons": {
"worker": {
"root": "worker/",
"entrypoint": "Dockerfile",
"livenessProbe": {
"httpGet": { "port": 1234, "path": "/health" }
}
}
}
}
A daemon with an HTTP liveness probe on port 1234
Vercel periodically requests the endpoint and restarts the daemon's container when the check fails, catching a daemon that is still running but no longer healthy.
Read the Daemon documentation for more information about liveness checks, including default values and the optional tuning fields.