Browse Source

fix(elastic): Do not wait forever for Elasticsearch to come up

Fixes https://github.com/pelias/docker/issues/34
fix-es5-startup
Julian Simioni 6 years ago
parent
commit
8fd4ffd8a4
No known key found for this signature in database
GPG Key ID: B9EEB0C6EE0910A1
  1. 15
      cmd/elastic.sh

15
cmd/elastic.sh

@ -21,11 +21,22 @@ register 'elastic' 'status' 'HTTP status code of the elasticsearch service' elas
function elastic_wait(){ function elastic_wait(){
echo 'waiting for elasticsearch service to come up'; echo 'waiting for elasticsearch service to come up';
until test $(elastic_status) -eq 200; do retry_count=30
printf '.'
i=1
while [[ "$i" -le "$retry_count" ]]; do
if [[ $(elastic_status) -eq 200 ]]; then
echo
exit 0
fi
sleep 2 sleep 2
printf "."
i=$(($i + 1))
done done
echo echo
echo "Elasticsearch did not come up, check configuration"
exit 1
} }
register 'elastic' 'wait' 'wait for elasticsearch to start up' elastic_wait register 'elastic' 'wait' 'wait for elasticsearch to start up' elastic_wait

Loading…
Cancel
Save