Created
September 13, 2015 15:20
-
-
Save deviantony/ddb93425dc6f011c4d8b to your computer and use it in GitHub Desktop.
SH entrypoint for docker-compose to manage dependency startup.
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
#!/usr/bin/env sh | |
# Wait for a HTTP service to be OK (return code 200) before trying to start another service. | |
echo "Stalling for SERVICE" | |
while true; do | |
status=$(curl --write-out %{http_code} --silent --output /dev/null http://service.domain/endpoint) | |
echo "Status: ${status}" | |
if [ "${status}" == "200" ]; then | |
break | |
else | |
echo "SERVICE is not yet available. Waiting..." | |
sleep 10 | |
fi | |
done | |
echo "Starting OTHER_SERVICE" | |
// Start your other service here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment