Do a different DB Ready check for Influx 1 vs 2

This commit is contained in:
Dave Conroy
2022-04-21 12:12:57 -07:00
parent df5532c128
commit 9a1a5efbd9

View File

@@ -333,14 +333,25 @@ check_availability() {
;; ;;
"influx" ) "influx" )
counter=0 counter=0
code_received=0 case "${INFLUX_VERSION,,}" in
while [ "${code_received}" != "200" ]; do 1 )
code_received=$(curl -XGET -sSL -o /dev/null -w ''%{http_code}'' ${DB_HOST}:${DB_PORT}/health) while ! (nc -z ${DB_HOST#*//} ${DB_PORT}) ; do
if [ "${code_received}" = "200" ] ; then break ; fi sleep 5
sleep 5 (( counter+=5 ))
(( counter+=5 )) print_warn "InfluxDB Host '${DB_HOST#*//}' is not accessible, retrying.. ($counter seconds so far)"
print_warn "InfluxDB Host '${DB_HOST}' is not accessible, retrying.. ($counter seconds so far)" done
done ;;
2 )
code_received=0
while [ "${code_received}" != "200" ]; do
code_received=$(curl -XGET -sSL -o /dev/null -w ''%{http_code}'' ${DB_HOST}:${DB_PORT}/health)
if [ "${code_received}" = "200" ] ; then break ; fi
sleep 5
(( counter+=5 ))
print_warn "InfluxDB Host '${DB_HOST}' is not accessible, retrying.. ($counter seconds so far)"
done
;;
esac
;; ;;
"mongo" ) "mongo" )
counter=0 counter=0