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

Fix router config overwrite on docker compose up #1296

Merged
merged 3 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
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
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# Release 0.30.4

## What's New

* Bugfixes

## Component Updates and Bug Fixes

* github.com/openziti/ziti: [v0.30.3 -> v0.30.4](https://github.com/openziti/ziti/compare/v0.30.3...v0.30.4)
* Fixed an issue causing router configs to be rewritten when docker compose was brought up with existing configs

# Release 0.30.3

## What's New
Expand Down
34 changes: 17 additions & 17 deletions quickstart/docker/image/run-router.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ if [[ "${_ZITI_ROUTER_NAME}" != "" ]]; then
export ZITI_ROUTER_NAME="${_ZITI_ROUTER_NAME}"
echo "ZITI_ROUTER_NAME set to: ${ZITI_ROUTER_NAME}"
fi
_UNIQUE_NAME="${ZITI_HOME}/${ZITI_ROUTER_NAME}-${HOSTNAME}.init"
if [ ! -f "${_UNIQUE_NAME}" ]; then
echo "system has not been initialized. initializing..."
"${ZITI_BIN_DIR-}/ziti" edge login ${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}:${ZITI_CTRL_EDGE_ADVERTISED_PORT} -u $ZITI_USER -p $ZITI_PWD -y

"${ZITI_BIN_DIR-}/ziti" edge login ${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}:${ZITI_CTRL_EDGE_ADVERTISED_PORT} -u $ZITI_USER -p $ZITI_PWD -y
gberl002 marked this conversation as resolved.
Show resolved Hide resolved
_CONFIG_PATH="${ZITI_HOME}/${ZITI_ROUTER_NAME}.yaml"
if [ ! -f "${_CONFIG_PATH}" ]; then
echo "config has not been generated, generating config..."

echo "---------- Creating edge-router ${ZITI_ROUTER_NAME}...."

Expand All @@ -53,21 +54,20 @@ if [ ! -f "${_UNIQUE_NAME}" ]; then
echo "CREATING PRIVATE ROUTER CONFIG: ${ZITI_ROUTER_NAME}"
createPrivateRouterConfig "${ZITI_ROUTER_NAME}"
fi

found=$("${ZITI_BIN_DIR-}/ziti" edge list edge-routers 'name = "'"${ZITI_ROUTER_NAME}"'"' | grep -c "${ZITI_ROUTER_NAME}")
if [[ found -gt 0 ]]; then
echo "---------- Found existing edge-router ${ZITI_ROUTER_NAME}...."
else
"${ZITI_BIN_DIR}/ziti" edge create edge-router "${ZITI_ROUTER_NAME}" -o "${ZITI_HOME}/${ZITI_ROUTER_NAME}.jwt" -t -a "${ZITI_ROUTER_ROLES}"
sleep 1
echo "---------- Enrolling edge-router ${ZITI_ROUTER_NAME}...."
"${ZITI_BIN_DIR}/ziti" router enroll "${ZITI_HOME}/${ZITI_ROUTER_NAME}.yaml" --jwt "${ZITI_HOME}/${ZITI_ROUTER_NAME}.jwt"
echo ""
fi
echo "system initialized. writing marker file"
echo "system initialized" > "${_UNIQUE_NAME}"
echo " Found existing config file ${_CONFIG_PATH}, not creating a new config."
echo " If you would like to overwrite this config, delete the file and restart the container."
fi

found=$("${ZITI_BIN_DIR-}/ziti" edge list edge-routers 'name = "'"${ZITI_ROUTER_NAME}"'"' | grep -c "${ZITI_ROUTER_NAME}")
if [[ found -gt 0 ]]; then
echo "---------- Found existing edge-router ${ZITI_ROUTER_NAME}...."
else
echo "system has been initialized. starting the process."
"${ZITI_BIN_DIR}/ziti" edge create edge-router "${ZITI_ROUTER_NAME}" -o "${ZITI_HOME}/${ZITI_ROUTER_NAME}.jwt" -t -a "${ZITI_ROUTER_ROLES}"
gberl002 marked this conversation as resolved.
Show resolved Hide resolved
sleep 1
echo "---------- Enrolling edge-router ${ZITI_ROUTER_NAME}...."
"${ZITI_BIN_DIR}/ziti" router enroll "${ZITI_HOME}/${ZITI_ROUTER_NAME}.yaml" --jwt "${ZITI_HOME}/${ZITI_ROUTER_NAME}.jwt"
echo ""
fi

unset ZITI_USER
Expand Down
Loading