feat: Add healthcheck for docker deployments
fix: Missing healthcheck.js fix: missing healthcheck.js fix: HEALTHCHECK commandpull/640/head
parent
fd5c33dd5d
commit
92098e136c
@ -0,0 +1,23 @@
|
|||||||
|
const http = require('http');
|
||||||
|
const options = {
|
||||||
|
host: 'localhost',
|
||||||
|
port: 1337,
|
||||||
|
timeout: 2000
|
||||||
|
};
|
||||||
|
|
||||||
|
const healthCheck = http.request(options, (res) => {
|
||||||
|
console.log(`HEALTHCHECK STATUS: ${res.statusCode}`);
|
||||||
|
if (res.statusCode == 200) {
|
||||||
|
process.exit(0);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
healthCheck.on('error', function (err) {
|
||||||
|
console.error('ERROR');
|
||||||
|
process.exit(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
healthCheck.end();
|
||||||
Loading…
Reference in New Issue