Files
sailing-analytics/java/target/status
T
Axel Uhl 17093b4dc6 availability checks now return non-2XX response code if unavailable; status script adjusted;
the java/target/status script now uses the consolidated
/sailingserver/api/v1/status end point and returns a 200 response if and
only if the RacingEventService has loaded all races it needs to load and
replication reports availability. In all other cases, non-2XX codes
are reported, such as 503 (not available) or 404 (not found)

Change-Id: I55ca3c98de993be0e6fff8e02837d17dd54431f6
2019-02-04 13:27:42 +01:00

45 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# source variables
. `pwd`/env.sh
echo "Configuration for this server is:"
echo ""
echo "SERVER_NAME: $SERVER_NAME"
echo "MEMORY: $MEMORY"
echo "SERVER_PORT: $SERVER_PORT"
echo "TELNET_PORT: $TELNET_PORT"
echo "MONGODB_HOST: $MONGODB_HOST"
echo "MONGODB_PORT: $MONGODB_PORT"
echo "MONGODB_NAME: $MONGODB_NAME"
echo "MONGODB_URI: $MONGODB_URI"
echo "EXPEDITION_PORT: $EXPEDITION_PORT"
echo "REPLICATION_HOST: $REPLICATION_HOST"
echo "REPLICATION_CHANNEL: $REPLICATION_CHANNEL"
echo "ADDITIONAL_ARGS: $ADDITIONAL_JAVA_ARGS"
echo ""
echo "INSTALL_FROM_RELEASE: $INSTALL_FROM_RELEASE"
echo "DEPLOY_TO: $DEPLOY_TO"
echo "BUILD_BEFORE_START: $BUILD_BEFORE_START"
echo "USE_ENVRIONMENT: $USE_ENVIRONMENT"
echo ""
echo "JAVA_HOME: $JAVA_HOME"
echo "INSTANCE_ID: $INSTANCE_ID"
echo ""
STATUS=$(curl -i http://127.0.0.1:$SERVER_PORT/sailingserver/api/v1/status 2>/dev/null)
RESPONSE_STATUS_CODE=$(echo $STATUS | head -n 1 | cut -d ' ' -f 2)
echo "AVAILABILITY_STATUS: $RESPONSE_STATUS_CODE"
echo "AVAILABILITY_DETAILS:"
echo "$STATUS" | grep "^\{" | jq .
if [[ $RESPONSE_STATUS_CODE =~ 2.. ]]; then
echo "Server $SERVER_NAME is available on $SERVER_PORT"
exit 0
else
echo "Server $SERVER_NAME is not available."
exit 1
fi