File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,11 +33,28 @@ if [ -x /usr/local/bin/temporal-elasticsearch-tool ]; then
3333else
3434 echo ' Using curl for Elasticsearch setup'
3535 echo ' WARNING: curl will be removed from admin-tools in v1.30.'
36- echo ' Waiting for Elasticsearch port to be available...'
37- nc -z -w 10 $ES_HOST $ES_PORT
38- echo ' Elasticsearch port is available'
36+ echo ' Waiting for Elasticsearch to be ready...'
37+ max_attempts=30
38+ attempt=0
39+ until curl -s -f " $ES_SCHEME ://$ES_HOST :$ES_PORT /_cluster/health?wait_for_status=yellow&timeout=1s" ; do
40+ attempt=$(( attempt + 1 ))
41+ if [ $attempt -ge $max_attempts ]; then
42+ echo " ERROR: Elasticsearch did not become ready after $max_attempts attempts"
43+ echo " Last error from curl:"
44+ curl " $ES_SCHEME ://$ES_HOST :$ES_PORT /_cluster/health?wait_for_status=yellow&timeout=1s" 2>&1 || true
45+ exit 1
46+ fi
47+ echo " Elasticsearch not ready yet, waiting... (attempt $attempt /$max_attempts )"
48+ sleep 2
49+ done
50+ echo ' '
51+ echo ' Elasticsearch is ready'
52+ echo ' Creating index template...'
3953 curl -X PUT --fail " $ES_SCHEME ://$ES_HOST :$ES_PORT /_template/temporal_visibility_v1_template" -H ' Content-Type: application/json' --data-binary " @/etc/temporal/schema/elasticsearch/visibility/index_template_$ES_VERSION .json"
54+ echo ' '
55+ echo ' Creating index...'
4056 curl --head --fail " $ES_SCHEME ://$ES_HOST :$ES_PORT /$ES_VISIBILITY_INDEX " 2> /dev/null || curl -X PUT --fail " $ES_SCHEME ://$ES_HOST :$ES_PORT /$ES_VISIBILITY_INDEX "
57+ echo ' '
4158fi
4259
4360echo ' Cassandra and Elasticsearch setup complete'
Original file line number Diff line number Diff line change @@ -27,11 +27,28 @@ if [ -x /usr/local/bin/temporal-elasticsearch-tool ]; then
2727else
2828 echo ' Using curl for Elasticsearch setup'
2929 echo ' WARNING: curl will be removed from admin-tools in v1.30.'
30- echo ' Waiting for Elasticsearch port to be available...'
31- nc -z -w 10 $ES_HOST $ES_PORT
32- echo ' Elasticsearch port is available'
30+ echo ' Waiting for Elasticsearch to be ready...'
31+ max_attempts=30
32+ attempt=0
33+ until curl -s -f " $ES_SCHEME ://$ES_HOST :$ES_PORT /_cluster/health?wait_for_status=yellow&timeout=1s" ; do
34+ attempt=$(( attempt + 1 ))
35+ if [ $attempt -ge $max_attempts ]; then
36+ echo " ERROR: Elasticsearch did not become ready after $max_attempts attempts"
37+ echo " Last error from curl:"
38+ curl " $ES_SCHEME ://$ES_HOST :$ES_PORT /_cluster/health?wait_for_status=yellow&timeout=1s" 2>&1 || true
39+ exit 1
40+ fi
41+ echo " Elasticsearch not ready yet, waiting... (attempt $attempt /$max_attempts )"
42+ sleep 2
43+ done
44+ echo ' '
45+ echo ' Elasticsearch is ready'
46+ echo ' Creating index template...'
3347 curl -X PUT --fail " $ES_SCHEME ://$ES_HOST :$ES_PORT /_template/temporal_visibility_v1_template" -H ' Content-Type: application/json' --data-binary " @/etc/temporal/schema/elasticsearch/visibility/index_template_$ES_VERSION .json"
48+ echo ' '
49+ echo ' Creating index...'
3450 curl --head --fail " $ES_SCHEME ://$ES_HOST :$ES_PORT /$ES_VISIBILITY_INDEX " 2> /dev/null || curl -X PUT --fail " $ES_SCHEME ://$ES_HOST :$ES_PORT /$ES_VISIBILITY_INDEX "
51+ echo ' '
3552fi
3653
3754echo ' MySQL and Elasticsearch setup complete'
Original file line number Diff line number Diff line change @@ -30,11 +30,28 @@ if [ -x /usr/local/bin/temporal-elasticsearch-tool ]; then
3030else
3131 echo ' Using curl for Elasticsearch setup'
3232 echo ' WARNING: curl will be removed from admin-tools in v1.30.'
33- echo ' Waiting for Elasticsearch port to be available...'
34- nc -z -w 10 $ES_HOST $ES_PORT
35- echo ' Elasticsearch port is available'
33+ echo ' Waiting for Elasticsearch to be ready...'
34+ max_attempts=30
35+ attempt=0
36+ until curl -s -f -k -u " $ES_USER :$ES_PWD " " $ES_SCHEME ://$ES_HOST :$ES_PORT /_cluster/health?wait_for_status=yellow&timeout=1s" ; do
37+ attempt=$(( attempt + 1 ))
38+ if [ $attempt -ge $max_attempts ]; then
39+ echo " ERROR: Elasticsearch did not become ready after $max_attempts attempts"
40+ echo " Last error from curl:"
41+ curl -k -u " $ES_USER :$ES_PWD " " $ES_SCHEME ://$ES_HOST :$ES_PORT /_cluster/health?wait_for_status=yellow&timeout=1s" 2>&1 || true
42+ exit 1
43+ fi
44+ echo " Elasticsearch not ready yet, waiting... (attempt $attempt /$max_attempts )"
45+ sleep 2
46+ done
47+ echo ' '
48+ echo ' Elasticsearch is ready'
49+ echo ' Creating index template...'
3650 curl -X PUT --fail -k -u " $ES_USER :$ES_PWD " " $ES_SCHEME ://$ES_HOST :$ES_PORT /_template/temporal_visibility_v1_template" -H ' Content-Type: application/json' --data-binary " @/etc/temporal/schema/elasticsearch/visibility/index_template_$ES_VERSION .json"
51+ echo ' '
52+ echo ' Creating index...'
3753 curl -k -u " $ES_USER :$ES_PWD " --head --fail " $ES_SCHEME ://$ES_HOST :$ES_PORT /$ES_VISIBILITY_INDEX " 2> /dev/null || curl -k -u " $ES_USER :$ES_PWD " -X PUT --fail " $ES_SCHEME ://$ES_HOST :$ES_PORT /$ES_VISIBILITY_INDEX "
54+ echo ' '
3855fi
3956
4057echo ' PostgreSQL and Elasticsearch (TLS) setup complete'
Original file line number Diff line number Diff line change @@ -27,11 +27,28 @@ if [ -x /usr/local/bin/temporal-elasticsearch-tool ]; then
2727else
2828 echo ' Using curl for Elasticsearch setup'
2929 echo ' WARNING: curl will be removed from admin-tools in v1.30.'
30- echo ' Waiting for Elasticsearch port to be available...'
31- nc -z -w 10 $ES_HOST $ES_PORT
32- echo ' Elasticsearch port is available'
30+ echo ' Waiting for Elasticsearch to be ready...'
31+ max_attempts=30
32+ attempt=0
33+ until curl -s -f " $ES_SCHEME ://$ES_HOST :$ES_PORT /_cluster/health?wait_for_status=yellow&timeout=1s" ; do
34+ attempt=$(( attempt + 1 ))
35+ if [ $attempt -ge $max_attempts ]; then
36+ echo " ERROR: Elasticsearch did not become ready after $max_attempts attempts"
37+ echo " Last error from curl:"
38+ curl " $ES_SCHEME ://$ES_HOST :$ES_PORT /_cluster/health?wait_for_status=yellow&timeout=1s" 2>&1 || true
39+ exit 1
40+ fi
41+ echo " Elasticsearch not ready yet, waiting... (attempt $attempt /$max_attempts )"
42+ sleep 2
43+ done
44+ echo ' '
45+ echo ' Elasticsearch is ready'
46+ echo ' Creating index template...'
3347 curl -X PUT --fail " $ES_SCHEME ://$ES_HOST :$ES_PORT /_template/temporal_visibility_v1_template" -H ' Content-Type: application/json' --data-binary " @/etc/temporal/schema/elasticsearch/visibility/index_template_$ES_VERSION .json"
48+ echo ' '
49+ echo ' Creating index...'
3450 curl --head --fail " $ES_SCHEME ://$ES_HOST :$ES_PORT /$ES_VISIBILITY_INDEX " 2> /dev/null || curl -X PUT --fail " $ES_SCHEME ://$ES_HOST :$ES_PORT /$ES_VISIBILITY_INDEX "
51+ echo ' '
3552fi
3653
3754echo ' PostgreSQL and Elasticsearch setup complete'
Original file line number Diff line number Diff line change @@ -27,11 +27,28 @@ if [ -x /usr/local/bin/temporal-elasticsearch-tool ]; then
2727else
2828 echo ' Using curl for OpenSearch setup'
2929 echo ' WARNING: curl will be removed from admin-tools in v1.30.'
30- echo ' Waiting for OpenSearch port to be available...'
31- nc -z -w 10 $ES_HOST $ES_PORT
32- echo ' OpenSearch port is available'
30+ echo ' Waiting for OpenSearch to be ready...'
31+ max_attempts=30
32+ attempt=0
33+ until curl -s -f " $ES_SCHEME ://$ES_HOST :$ES_PORT /_cluster/health?wait_for_status=yellow&timeout=1s" ; do
34+ attempt=$(( attempt + 1 ))
35+ if [ $attempt -ge $max_attempts ]; then
36+ echo " ERROR: OpenSearch did not become ready after $max_attempts attempts"
37+ echo " Last error from curl:"
38+ curl " $ES_SCHEME ://$ES_HOST :$ES_PORT /_cluster/health?wait_for_status=yellow&timeout=1s" 2>&1 || true
39+ exit 1
40+ fi
41+ echo " OpenSearch not ready yet, waiting... (attempt $attempt /$max_attempts )"
42+ sleep 2
43+ done
44+ echo ' '
45+ echo ' OpenSearch is ready'
46+ echo ' Creating index template...'
3347 curl -X PUT --fail " $ES_SCHEME ://$ES_HOST :$ES_PORT /_template/temporal_visibility_v1_template" -H ' Content-Type: application/json' --data-binary " @/etc/temporal/schema/elasticsearch/visibility/index_template_$ES_VERSION .json"
48+ echo ' '
49+ echo ' Creating index...'
3450 curl --head --fail " $ES_SCHEME ://$ES_HOST :$ES_PORT /$ES_VISIBILITY_INDEX " 2> /dev/null || curl -X PUT --fail " $ES_SCHEME ://$ES_HOST :$ES_PORT /$ES_VISIBILITY_INDEX "
51+ echo ' '
3552fi
3653
3754echo ' PostgreSQL and OpenSearch setup complete'
You can’t perform that action at this time.
0 commit comments