forked from snxraven/peardock
Ship remaining roadmap items: encrypted registry vault, peer invite/revoke, Swarm/plugins behind flags, binary streams, engine create validation, deploy rollback, schema validation, fleet/access UI, metrics, fuzz/load/soak tests, systemd packaging, and release tooling. Mark ROADMAP fully complete.
31 lines
812 B
JavaScript
Executable File
31 lines
812 B
JavaScript
Executable File
#!/usr/bin/env node
|
|
/**
|
|
* Local healthcheck for peardock server process supervision.
|
|
* Checks Docker socket reachability (same as server dependency).
|
|
* Exit 0 = healthy, 1 = unhealthy.
|
|
*
|
|
* Usage: node scripts/healthcheck.js
|
|
* Docker HEALTHCHECK / systemd ExecStartPost / k8s probe compatible.
|
|
*/
|
|
import Docker from 'dockerode'
|
|
|
|
const timeoutMs = Number(process.env.HEALTHCHECK_TIMEOUT_MS) || 5000
|
|
|
|
const docker = new Docker({ socketPath: process.env.DOCKER_SOCKET || '/var/run/docker.sock' })
|
|
|
|
const timer = setTimeout(() => {
|
|
console.error('healthcheck: timeout')
|
|
process.exit(1)
|
|
}, timeoutMs)
|
|
|
|
try {
|
|
await docker.ping()
|
|
clearTimeout(timer)
|
|
console.log('ok docker')
|
|
process.exit(0)
|
|
} catch (err) {
|
|
clearTimeout(timer)
|
|
console.error('healthcheck failed:', err.message)
|
|
process.exit(1)
|
|
}
|