diff --git a/CHANGES.md b/CHANGES.md index e9f87b1f2..903579350 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -14,7 +14,13 @@ [Unreleased](https://github.com/bird-house/birdhouse-deploy/tree/master) (latest) ------------------------------------------------------------------------------------------------------------------ -[//]: # (list changes here, using '-' for each new entry, remove this when items are added) +## Fixes: +- Scripts: fix [`check-instance-ready`](birdhouse/scripts/check-instance-ready) script. + + Previously employed `/canarie/node/service/stats` endpoint could be unreliable for some services under the node that + produced log collection errors to populate stats. Instead, use `/canarie/node/service/status` that check only if the + services are responsive according to configured endpoints under CanarieAPI. This status endpoint is the same one that + is employed by the CI test suite to check that the instance is ready before starting notebook tests. [1.23.0](https://github.com/bird-house/birdhouse-deploy/tree/1.23.0) (2023-02-10) ------------------------------------------------------------------------------------------------------------------ diff --git a/birdhouse/scripts/check-instance-ready b/birdhouse/scripts/check-instance-ready index b4504725b..e568bc9de 100755 --- a/birdhouse/scripts/check-instance-ready +++ b/birdhouse/scripts/check-instance-ready @@ -13,11 +13,13 @@ COMPOSE_DIR="`dirname "$THIS_DIR"`" if [ -f "$COMPOSE_DIR/env.local" ]; then # Get PAVICS_FQDN - . $COMPOSE_DIR/env.local + . "${COMPOSE_DIR}/env.local" fi +MONITOR_URL="https://${PAVICS_FQDN}/canarie/node/service/status" + set -x -curl --include --silent https://$PAVICS_FQDN/canarie/node/service/stats | head +curl --include --silent "${MONITOR_URL}" | head set +x echo " @@ -25,11 +27,11 @@ The curl above should return the HTTP response code 200 to confirm instance is r " set -x -HTTP_RESPONSE_CODE="`curl --write-out '%{http_code}' --output /dev/null --silent https://$PAVICS_FQDN/canarie/node/service/stats`" -if [ $HTTP_RESPONSE_CODE -ne 200 ]; then +HTTP_RESPONSE_CODE=$(curl --write-out '%{http_code}' --output /dev/null --silent "${MONITOR_URL}") +if [ "${HTTP_RESPONSE_CODE}" -ne 200 ]; then set +x echo " -HTTP response code received: $HTTP_RESPONSE_CODE (expected 200). +HTTP response code received: ${HTTP_RESPONSE_CODE} (expected 200). Will sleep for about 1 minute and try again since the canarie-api refresh every minute. @@ -37,5 +39,5 @@ Will retry only once more and exit immediately. " set -x sleep 65 - curl --include --silent https://$PAVICS_FQDN/canarie/node/service/stats | head + curl --include --silent "${MONITOR_URL}" | head fi