-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhealthcheck.js
More file actions
22 lines (20 loc) · 929 Bytes
/
Copy pathhealthcheck.js
File metadata and controls
22 lines (20 loc) · 929 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Docker HEALTHCHECK probe — not imported by the app (see Dockerfile note).
//
// Deliberately probes a RENDERED page, not /api/health. /api/health is dependency-free
// by design, so it answers 200 while every marketing page 500s on an i18n or
// message-catalog regression — and since nothing declares `depends_on: service_healthy`
// for this service, the only consumer of this probe is the STATUS column a human reads.
// A cheaper probe that proves less is a bad trade there. /en proves the App Router
// served HTML with messages resolved; the 5s timeout was never what a render failed.
const http = require("http");
const req = http.get(
{ host: "127.0.0.1", port: process.env.PORT || 3000, path: "/en", timeout: 4000 },
(res) => {
process.exit(res.statusCode && res.statusCode < 500 ? 0 : 1);
}
);
req.on("error", () => process.exit(1));
req.on("timeout", () => {
req.destroy();
process.exit(1);
});