Skip to content

Commit

Permalink
Add a retry on getting config
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasm-ttd committed Sep 25, 2024
1 parent 3f78aeb commit dd46a03
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions scripts/aws/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,35 @@ echo "Starting syslog-ng..."

# -- load config from identity service
echo "Loading config from identity service via proxy..."
set +e
#wait for config service
RETRY_COUNT=0
MAX_RETRY=10
while true; do
RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" -x socks5h://127.0.0.1:3305 http://127.0.0.1:27015/getConfig)
if [ "$RESPONSE" -eq "200" ]; then
echo "Config server running"
break;
else
echo "Config server still starting..."
fi
RETRY_COUNT=$(( RETRY_COUNT + 1))
if [ $RETRY_COUNT -gt $MAX_RETRY ]; then
echo "Config Server did not return a response. Exiting"
exit 1
fi
sleep 5

done

IDENTITY_SERVICE_CONFIG=$(curl -s -x socks5h://127.0.0.1:3305 http://127.0.0.1:27015/getConfig);
if jq -e . >/dev/null 2>&1 <<<"${IDENTITY_SERVICE_CONFIG}"; then
echo "Identity service returned valid config"
else
echo "Failed to get a valid config from identity service"
exit 1
fi
set -e

export OVERRIDES_CONFIG="/app/conf/config-overrides.json"
echo "${IDENTITY_SERVICE_CONFIG}" > "${OVERRIDES_CONFIG}";
Expand Down

0 comments on commit dd46a03

Please sign in to comment.