-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Separation of node health and initialization state from rln_re…
…lay (#2612) * Separation of node health and initialization state from rln_relay status. Make (only) health endpoint avail early and install others in the last stage of node setup. * Proper json report from /health, adjusted and fixed test, added convenient script for checking node health * Stop wakunode2 if configured rest server cannot be started * Fix wakuRlnRelay protocol existence check * Fix typo * Removed unused imports from touched files. * Added missing /health test for all
- Loading branch information
1 parent
1a23700
commit 6d135b0
Showing
10 changed files
with
391 additions
and
103 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,55 @@ | ||
#!/usr/bin/env bash | ||
|
||
# optional argument to specgify the ip address | ||
ip_address=$1 | ||
plain_text_out=false | ||
|
||
# Parse command line arguments | ||
POSITIONAL_ARGS=() | ||
|
||
while [[ $# -gt 0 ]]; do | ||
case $1 in | ||
-p|--plain) | ||
plain_text_out=true | ||
shift # past argument | ||
;; | ||
-*|--*) | ||
echo "Unknown option $1" | ||
exit 1 | ||
;; | ||
*) | ||
POSITIONAL_ARGS+=("$1") # save positional arg | ||
shift # past argument | ||
;; | ||
esac | ||
done | ||
|
||
set -- "${POSITIONAL_ARGS[@]}" # restore positional parameters | ||
|
||
# Check if an IP address is provided as an argument | ||
if [[ -n "$1" ]]; then | ||
ip_address="$1" | ||
else | ||
ip_address="localhost:8645" | ||
fi | ||
|
||
# check if curl is available | ||
if ! command -v curl &> /dev/null | ||
then | ||
echo "curl could not be found" | ||
exit 1 | ||
fi | ||
|
||
response=$(curl -s GET http://${ip_address}/health) | ||
|
||
if [[ -z "${response}" ]]; then | ||
echo -e "$(date +'%H:%M:%S')\tnode health status is: unknown\n" | ||
exit 1 | ||
fi | ||
|
||
if ! command -v jq &> /dev/null || [[ "$plain_text_out" = true ]]; then | ||
echo -e "$(date +'%H:%M:%S')\tnode health status is: ${response}\n" | ||
else | ||
echo -e "$(date +'%H:%M:%S')\tnode health status is:\n" | ||
echo "${response}" | jq . | ||
fi |
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
Oops, something went wrong.