chore: expose pid + uptime on /health for crash-detection monitors

Adds `pid` and `uptime` fields to the /health response so external monitors
(and the local E2E watchdog) can detect a silent process restart between
two checks — e.g. an unhandled rejection that crashes Node and Docker
quietly relaunches the container.

Also adds .gitignore patterns for a local-only E2E suite that lives in
tests/e2e/local/ on individual machines and is never pushed.
This commit is contained in:
Paul Nothaft
2026-04-27 15:30:03 +02:00
parent 822be9a9b2
commit 8d0fb8e157
2 changed files with 14 additions and 5 deletions
+6
View File
@@ -100,6 +100,12 @@ backup/
# Local artifacts from browser tooling
.playwright-mcp/
# Local-only E2E suite (never pushed; runs as pre-push gate on this machine)
tests/e2e/local/
playwright-local-results/
e2e-test.log
scripts/e2e-local.sh
# Local SQLite files in backend
backend/*.sqlite*
backend/*.db
+8 -5
View File
@@ -486,21 +486,24 @@ app.get('/robots.txt', async (req, res) => {
}
});
// Health check endpoint
// Health check endpoint. `pid` + `uptime` let monitors (and the local E2E
// watchdog) detect a silent process restart between two checks.
app.get('/health', async (req, res) => {
try {
// Check database connectivity
await db.raw('SELECT 1');
res.json({
status: 'ok',
timestamp: new Date().toISOString()
timestamp: new Date().toISOString(),
pid: process.pid,
uptime: process.uptime()
});
} catch (error) {
logger.error('Health check failed:', error);
res.status(503).json({
status: 'error',
timestamp: new Date().toISOString()
timestamp: new Date().toISOString(),
pid: process.pid,
uptime: process.uptime()
});
}
});