mirror of
https://github.com/sartography/spiffworkflow-backend.git
synced 2025-02-24 13:28:31 +00:00
added wait to be up script w/ burnettk
This commit is contained in:
parent
c75c1a03ae
commit
6a5e145664
12
bin/deploy
12
bin/deploy
@ -9,14 +9,4 @@ set -o errtrace -o errexit -o nounset -o pipefail
|
|||||||
|
|
||||||
git pull
|
git pull
|
||||||
./bin/docker_restart
|
./bin/docker_restart
|
||||||
|
./bin/wait_for_server_to_be_up
|
||||||
echo "waiting for backend to come up..."
|
|
||||||
attempts=0
|
|
||||||
while [[ "$(curl -s -o /dev/null -w '%{http_code}' http://localhost:7000/admin/token)" != "200" ]]; do
|
|
||||||
if [[ "$attempts" -gt "100" ]]; then
|
|
||||||
>&2 echo "ERROR: Server not up after 100 attempts. There is probably a problem"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
attempts=$(( attempts + 1 ))
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
|
24
bin/wait_for_server_to_be_up
Executable file
24
bin/wait_for_server_to_be_up
Executable file
@ -0,0 +1,24 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
function error_handler() {
|
||||||
|
>&2 echo "Exited with BAD EXIT CODE '${2}' in ${0} script at line: ${1}."
|
||||||
|
exit "$2"
|
||||||
|
}
|
||||||
|
trap 'error_handler ${LINENO} $?' ERR
|
||||||
|
set -o errtrace -o errexit -o nounset -o pipefail
|
||||||
|
|
||||||
|
max_attempts="${1:-}"
|
||||||
|
if [[ -z "$max_attempts" ]]; then
|
||||||
|
max_attempts=100
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "waiting for backend to come up..."
|
||||||
|
attempts=0
|
||||||
|
while [[ "$(curl -s -o /dev/null -w '%{http_code}' http://localhost:7000/admin/token)" != "200" ]]; do
|
||||||
|
if [[ "$attempts" -gt "$max_attempts" ]]; then
|
||||||
|
>&2 echo "ERROR: Server not up after $max_attempts attempts. There is probably a problem"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
attempts=$(( attempts + 1 ))
|
||||||
|
sleep 1
|
||||||
|
done
|
Loading…
x
Reference in New Issue
Block a user