Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use $hostname in vtadmin script as all other scripts do #13231

Merged
merged 1 commit into from
Jun 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}
"