You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
465 B
JavaScript
22 lines
465 B
JavaScript
5 years ago
|
var http = require("http");
|
||
|
|
||
|
var options = {
|
||
|
timeout: 2000,
|
||
|
host: 'localhost',
|
||
|
port: process.env.PORT || 8080,
|
||
|
path: '/healthz' // must be the same as HEALTHCHECK in Dockerfile
|
||
|
};
|
||
|
|
||
|
var request = http.request(options, (res) => {
|
||
|
console.info('STATUS: ' + res.statusCode);
|
||
|
process.exitCode = (res.statusCode === 200) ? 0 : 1;
|
||
|
process.exit();
|
||
|
});
|
||
|
|
||
|
request.on('error', function(err) {
|
||
|
console.error('ERROR', err);
|
||
|
process.exit(1);
|
||
|
});
|
||
|
|
||
|
request.end();
|