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

add a quickstart function to wait for the public router #1281

Merged
merged 2 commits into from
Sep 1, 2023
Merged
Changes from 1 commit
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
22 changes: 22 additions & 0 deletions quickstart/docker/image/ziti-cli-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,28 @@ function _wait_for_controller {
done
}

function _wait_for_public_router {
local advertised_host_port="${ZITI_ROUTER_NAME}:${ZITI_ROUTER_PORT}"
local COUNTDOWN=30
qrkourier marked this conversation as resolved.
Show resolved Hide resolved
until [[ -s "${ZITI_HOME}/${ZITI_ROUTER_NAME}.cert" ]] \
&& openssl s_client \
-connect "${advertised_host_port}" \
-servername "${ZITI_ROUTER_NAME}" \
-alpn "ziti-edge,h2,http/1.1" \
-cert "${ZITI_HOME}/${ZITI_ROUTER_NAME}.cert" \
-key "${ZITI_HOME}/${ZITI_ROUTER_NAME}.key" \
<>/dev/null 2>&1 # client cert needed for a zero exit code
do
if (( COUNTDOWN-- )); then
echo "INFO: waiting for https://${advertised_host_port}"
sleep 3
else
echo "ERROR: timed out waiting for https://${advertised_host_port}" >&2
return 1
fi
done
}

function _setup_ziti_home {
_setup_ziti_network
if [[ "${ZITI_HOME-}" == "" ]]; then export ZITI_HOME="${HOME}/.ziti/quickstart/${ZITI_NETWORK-}"; else echo "ZITI_HOME overridden: ${ZITI_HOME}"; fi
Expand Down