Files
Notizarr/apps/server/healthcheck.js
T
2026-09-07 09:54:30 +00:00

19 lines
615 B
JavaScript

// Zero-dependency healthcheck used by the Docker HEALTHCHECK directive for
// both the dev and prod images (see docker/docker-compose.yml and
// apps/server/Dockerfile). Deliberately plain JS with no imports beyond
// node:http so it works from the pruned production image without needing
// the TypeScript toolchain.
import http from 'node:http'
const port = process.env.PORT_WEB ?? 8080
const req = http.get(`http://127.0.0.1:${port}/health`, (res) => {
process.exit(res.statusCode === 200 ? 0 : 1)
})
req.on('error', () => process.exit(1))
req.setTimeout(3000, () => {
req.destroy()
process.exit(1)
})