Skip to content

Commit

Permalink
Merge pull request #1230 from openziti/fix_docker_race_condition
Browse files Browse the repository at this point in the history
Fix docker race condition
  • Loading branch information
gberl002 authored Aug 10, 2023
2 parents fce0c2d + 964d425 commit adcb03b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
3 changes: 3 additions & 0 deletions quickstart/docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,20 @@ First, decide what you are trying to do. Are you trying to:
1. copy the `ziti` CLI to `./ziti-bin`: `cp /path/to/ziti ./ziti-bin`
1. run the script `./createLocalImage.sh` which will create a `openziti/quickstart:latest` tag
using the `ziti` CLI located in `./ziti-bin`
1. Optionally, you may provide an argument for the image tag. `./createLocalImage.sh <tagname>`

## Build Docker Image for Docker-related Changes
1. change to this directory from checkout root: `cd quickstart/docker`
1. run the script `./createLocalImage.sh` which will create a `openziti/quickstart:latest` tag
using the latest `ziti` [release from GitHub](https://github.com/openziti/ziti/releases/latest)
1. Optionally, you may provide an argument for the image tag. `./createLocalImage.sh <tagname>`

## Build Docker Image with Specific ziti Version
1. change to this directory from checkout root: `cd quickstart/docker`
1. set `ZITI_VERSION_OVERRIDE` to desired version: `export ZITI_VERSION_OVERRIDE=v0.28.4`
1. run the script `./createLocalImage.sh` which will create a `openziti/quickstart:latest` tag
using the specified version of `ziti` [from GitHub](https://github.com/openziti/ziti/releases/tag/v0.28.4)
1. Optionally, you may provide an argument for the image tag. `./createLocalImage.sh <tagname>`

## ERROR: existing instance for "ziti-builder"
When running the `./createLocalImage.sh` script, you might get this error:
Expand Down
2 changes: 1 addition & 1 deletion quickstart/docker/createLocalImage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ else
echo ""
fi

$SCRIPT_DIR/pushLatestDocker.sh local
$SCRIPT_DIR/pushLatestDocker.sh local "${1}"
8 changes: 7 additions & 1 deletion quickstart/docker/image/run-router.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ if [[ "${ZITI_ROUTER_NAME-}" != "" ]]; then
echo "_ZITI_ROUTER_NAME set to: ${_ZITI_ROUTER_NAME}"
fi

# Wait until the file exists, then give one more second for the file to be completely written
until [ -f "${ZITI_HOME}/ziti.env" ]
do
sleep 1
done
sleep 1
. ${ZITI_HOME}/ziti.env

# wait for the controller to come online
Expand Down Expand Up @@ -48,7 +54,7 @@ if [ ! -f "${_UNIQUE_NAME}" ]; then
createPrivateRouterConfig "${ZITI_ROUTER_NAME}"
fi

found=$(ziti edge list edge-routers 'name = "'"${ZITI_ROUTER_NAME}"'"' | grep -c "${ZITI_ROUTER_NAME}")
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
Expand Down
8 changes: 7 additions & 1 deletion quickstart/docker/pushLatestDocker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ if [ -z "${ZITI_VERSION}" ]; then
exit 1
fi

IMAGE_TAG="${2-}"
if [ -z "${IMAGE_TAG}" ]; then
IMAGE_TAG="latest"
echo "image tag name was not provided, using default '${IMAGE_TAG}'"
fi

docker buildx create --use --name=ziti-builder

if [ "local" == "${1}" ]; then
Expand All @@ -28,5 +34,5 @@ fi
docker buildx build ${_BUILDX_PLATFORM} "${SCRIPT_DIR}/image" \
--build-arg ZITI_VERSION_OVERRIDE="v${ZITI_VERSION}" \
--tag "openziti/quickstart:${ZITI_VERSION}" \
--tag "openziti/quickstart:latest" \
--tag "openziti/quickstart:${IMAGE_TAG}" \
${_BUILDX_ACTION}

0 comments on commit adcb03b

Please sign in to comment.