2
0
mirror of https://github.com/VinylDNS/vinyldns synced 2025-08-22 10:10:12 +00:00
vinyldns/bin/docker-up-vinyldns.sh

62 lines
1.6 KiB
Bash
Raw Normal View History

2018-07-31 11:30:21 -04:00
#!/usr/bin/env bash
######################################################################
# Starts up the api, portal, and dependent services via
# docker-compose. The api will be available on localhost:9000 and the
# portal will be on localhost:9001
2018-07-31 11:30:21 -04:00
######################################################################
DIR=$( cd $(dirname $0) ; pwd -P )
echo "Starting portal server and all dependencies in the background..."
docker-compose -f "$DIR"/../docker/docker-compose-build.yml up -d
2018-07-31 11:30:21 -04:00
VINYLDNS_URL="http://localhost:9000"
echo "Waiting for API to be ready at ${VINYLDNS_URL} ..."
2018-07-31 11:30:21 -04:00
DATA=""
RETRY=40
while [ "$RETRY" -gt 0 ]
2018-07-31 11:30:21 -04:00
do
DATA=$(curl -I -s "${VINYLDNS_URL}/ping" -o /dev/null -w "%{http_code}")
2018-07-31 11:30:21 -04:00
if [ $? -eq 0 ]
then
echo "Succeeded in connecting to VinylDNS API!"
2018-07-31 11:30:21 -04:00
break
else
echo "Retrying Again" >&2
let RETRY-=1
sleep 1
if [ "$RETRY" -eq 0 ]
2018-07-31 11:30:21 -04:00
then
echo "Exceeded retries waiting for VinylDNS API to be ready, failing"
2018-07-31 11:30:21 -04:00
exit 1
fi
fi
done
VINYLDNS_URL="http://localhost:9001"
echo "Waiting for portal to be ready at ${VINYLDNS_URL} ..."
2018-07-31 11:30:21 -04:00
DATA=""
RETRY=40
while [ "$RETRY" -gt 0 ]
2018-07-31 11:30:21 -04:00
do
DATA=$(curl -I -s "${VINYLDNS_URL}" -o /dev/null -w "%{http_code}")
2018-07-31 11:30:21 -04:00
if [ $? -eq 0 ]
then
echo "Succeeded in connecting to VinylDNS portal!"
2018-07-31 11:30:21 -04:00
break
else
echo "Retrying Again" >&2
let RETRY-=1
sleep 1
if [ "$RETRY" -eq 0 ]
2018-07-31 11:30:21 -04:00
then
echo "Exceeded retries waiting for VinylDNS portal to be ready, failing"
2018-07-31 11:30:21 -04:00
exit 1
fi
fi
done