Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add healthcheck for docker deployments
fix: Missing healthcheck.js fix: missing healthcheck.js fix: HEALTHCHECK command
- Loading branch information
1 parent
fd5c33d
commit 92098e1
Showing
4 changed files
with
50 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); |