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,6 +333,15 @@ check_availability() {
;; ;;
"influx" ) "influx" )
counter=0 counter=0
case "${INFLUX_VERSION,,}" in
1 )
while ! (nc -z ${DB_HOST#*//} ${DB_PORT}) ; do
sleep 5
(( counter+=5 ))
print_warn "InfluxDB Host '${DB_HOST#*//}' is not accessible, retrying.. ($counter seconds so far)"
done
;;
2 )
code_received=0 code_received=0
while [ "${code_received}" != "200" ]; do while [ "${code_received}" != "200" ]; do
code_received=$(curl -XGET -sSL -o /dev/null -w ''%{http_code}'' ${DB_HOST}:${DB_PORT}/health) code_received=$(curl -XGET -sSL -o /dev/null -w ''%{http_code}'' ${DB_HOST}:${DB_PORT}/health)
@@ -342,6 +351,8 @@ check_availability() {
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
;; ;;
esac
;;
"mongo" ) "mongo" )
counter=0 counter=0
while ! (nc -z ${DB_HOST} ${DB_PORT}) ; do while ! (nc -z ${DB_HOST} ${DB_PORT}) ; do