-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add jq-based healthcheck script for checking the readiness endpoint
- Loading branch information
matt
committed
Sep 5, 2024
1 parent
8f7fb5f
commit e6885d3
Showing
2 changed files
with
22 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
|
||
# Note that the response from the readiness endpoint at http://localhost:8070 | ||
# is a JSON object of the following structure: | ||
# | ||
# { | ||
# "ready": [ | ||
# // Objects describing services that are ready. | ||
# ], | ||
# "not_ready": [ | ||
# // Objects describing services that are not ready. | ||
# ] | ||
# } | ||
# | ||
# `curl` the readiness endpoint and check if the `not_ready` array is empty. | ||
# Pipe the output from `jq` to `grep` to check if the length is 0. | ||
|
||
curl -s http://localhost:8070/ | jq '.not_ready | length' | grep -q 0 |