-
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.
feat(provider): add liveness healthchecks
- Loading branch information
1 parent
e96755c
commit 56e078f
Showing
5 changed files
with
54 additions
and
8 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,31 @@ | ||
#!/bin/sh | ||
|
||
# Ensure the script fails if any part of a pipeline fails | ||
set -o pipefail | ||
|
||
# HTTP check | ||
if ! timeout 5s curl -o /dev/null -fsk https://127.0.0.1:8443/status; then | ||
echo "HTTP check failed" | ||
exit 1 | ||
fi | ||
|
||
# gRPC check | ||
if ! timeout 5s curl -k -v --http2-prior-knowledge https://127.0.0.1:8444 2>&1 | grep -qi 'application/grpc'; then | ||
echo "gRPC check failed" | ||
exit 1 | ||
fi | ||
|
||
# RPC node sync check | ||
current_time=$(date -u +%s) | ||
latest_block_time_str=$(curl -s $AKASH_NODE/status | jq -r '.result.sync_info.latest_block_time') | ||
latest_block_time=$(date -u -d "$latest_block_time_str" +%s) | ||
|
||
# Allow for a 60 seconds drift | ||
let "time_diff = current_time - latest_block_time" | ||
if [ "$time_diff" -gt 60 ] || [ "$time_diff" -lt -60 ]; then | ||
echo "RPC node sync check failed" | ||
exit 1 | ||
fi | ||
|
||
echo "All checks passed" | ||
exit 0 |
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