diff --git a/elasticsearch/config/configure_s3.sh b/elasticsearch/config/configure_s3.sh index 1a160f8e..b09df73b 100644 --- a/elasticsearch/config/configure_s3.sh +++ b/elasticsearch/config/configure_s3.sh @@ -76,15 +76,15 @@ function CreateRepo() repository="$repository_name-$version" s3_path="$path/$version" - curl ${auth} -X PUT "$elastic_ip_port/_snapshot/$repository" -H 'Content-Type: application/json' -d' - { - "type": "s3", - "settings": { - "bucket": "'$bucket_name'", - "base_path": "'$s3_path'" - } - } - ' + >&2 echo "Create S3 repository" + + until curl ${auth} -X PUT "$elastic_ip_port/_snapshot/$repository" -H 'Content-Type: application/json' -d' {"type": "s3", "settings": { "bucket": "'$bucket_name'", "base_path": "'$s3_path'"} }'; do + >&2 echo "Elastic is unavailable, S3 repository not created - sleeping" + sleep 5 + done + + >&2 echo "S3 repository created" + } diff --git a/elasticsearch/config/load_settings.sh b/elasticsearch/config/load_settings.sh index 831fda28..e5a22bdc 100644 --- a/elasticsearch/config/load_settings.sh +++ b/elasticsearch/config/load_settings.sh @@ -100,13 +100,16 @@ done if [ $ENABLE_CONFIGURE_S3 ]; then #Wait for Elasticsearch to be ready to create the repository sleep 10 - + >&2 echo "Configure S3" if [ "x$S3_PATH" != "x" ]; then - + >&2 echo "S3_PATH" + >&2 echo $S3_PATH if [ "x$S3_ELASTIC_MAJOR" != "x" ]; then + >&2 echo "Elasticsearch major version:" + >&2 echo $S3_ELASTIC_MAJOR bash /usr/share/elasticsearch/config/configure_s3.sh $el_url $S3_BUCKET_NAME $S3_PATH $S3_REPOSITORY_NAME $S3_ELASTIC_MAJOR - else + >&2 echo "Elasticserach major version not given" bash /usr/share/elasticsearch/config/configure_s3.sh $el_url $S3_BUCKET_NAME $S3_PATH $S3_REPOSITORY_NAME fi