-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ECS health checks for API tasks (#3632)
* Refactor GET /api/health endpoint handler * Add healthcheck script * Configure ECS healthcheck for API tasks * Update tests for healthcheck endpoint * Use request logger * Bump query execution timeout to 1s
- Loading branch information
1 parent
1babe4f
commit 58eed8b
Showing
4 changed files
with
51 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Usage: node healthcheck.js [url] [timeout] | ||
// Exits with error (status code 1) when HTTP request errors or responds with non-200 status. | ||
const got = require('got'); | ||
|
||
const url = process.argv[2] || 'http://localhost:3000/api/health'; | ||
const timeout = Number.parseInt(process.argv[3], 10) || 5000; | ||
|
||
console.log(url); | ||
|
||
got(url, { timeout }).then((res) => { | ||
const { statusCode } = res; | ||
console.log(res.statusCode); | ||
if (statusCode !== 200) { | ||
process.exit(1); | ||
} | ||
process.exit(0); | ||
}).catch((e) => { | ||
console.error(e); | ||
process.exit(1); | ||
}); |
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