Skip to content

Commit

Permalink
Use $hostname in vtadmin script as other scripts do (#13236)
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Lord <[email protected]>
Co-authored-by: Matt Lord <[email protected]>
  • Loading branch information
vitess-bot[bot] and mattlord authored Jun 5, 2023
1 parent 172dcfe commit b3eab36
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions examples/common/scripts/vtadmin-up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ vtadmin_api_port=14200
vtadmin_web_port=14201

vtadmin \
--addr ":${vtadmin_api_port}" \
--http-origin "http://localhost:${vtadmin_web_port}" \
--addr "${hostname}:${vtadmin_api_port}" \
--http-origin "http://${hostname}:${vtadmin_web_port}" \
--http-tablet-url-tmpl "http://{{ .Tablet.Hostname }}:15{{ .Tablet.Alias.Uid }}" \
--tracer "opentracing-jaeger" \
--grpc-tracing \
Expand All @@ -29,23 +29,23 @@ echo ${vtadmin_api_pid} > "${log_dir}/vtadmin-api.pid"

echo "\
vtadmin-api is running!
- API: http://localhost:${vtadmin_api_port}
- API: http://${hostname}:${vtadmin_api_port}
- Logs: ${log_dir}/vtadmin-api.out
- PID: ${vtadmin_api_pid}
"

# Wait for vtadmin to successfully discover the cluster
expected_cluster_result="{\"result\":{\"clusters\":[{\"id\":\"${cluster_name}\",\"name\":\"${cluster_name}\"}]},\"ok\":true}"
for _ in {0..300}; do
result=$(curl -s "http://localhost:${vtadmin_api_port}/api/clusters")
result=$(curl -s "http://${hostname}:${vtadmin_api_port}/api/clusters")
if [[ ${result} == "${expected_cluster_result}" ]]; then
break
fi
sleep 0.1
done

# Check one last time
[[ $(curl -s "http://localhost:${vtadmin_api_port}/api/clusters") == "${expected_cluster_result}" ]] || fail "vtadmin failed to discover the running example Vitess cluster."
[[ $(curl -s "http://${hostname}:${vtadmin_api_port}/api/clusters") == "${expected_cluster_result}" ]] || fail "vtadmin failed to discover the running example Vitess cluster."

# Download nvm and node
if [[ -z ${NVM_DIR} ]]; then
Expand Down Expand Up @@ -74,7 +74,7 @@ nvm install "$NODE_VERSION" || fail "Could not install and use nvm $NODE_VERSION
# other Vitess components.)
npm --prefix "$web_dir" --silent install

VITE_VTADMIN_API_ADDRESS="http://localhost:${vtadmin_api_port}" \
VITE_VTADMIN_API_ADDRESS="http://${hostname}:${vtadmin_api_port}" \
VITE_ENABLE_EXPERIMENTAL_TABLET_DEBUG_VARS="true" \
npm run --prefix "$web_dir" build

Expand All @@ -86,7 +86,7 @@ echo ${vtadmin_web_pid} > "${log_dir}/vtadmin-web.pid"

echo "\
vtadmin-web is running!
- Browser: http://localhost:${vtadmin_web_port}
- Browser: http://${hostname}:${vtadmin_web_port}
- Logs: ${log_dir}/vtadmin-web.out
- PID: ${vtadmin_web_pid}
"

0 comments on commit b3eab36

Please sign in to comment.