Files

80 lines
2.9 KiB
YAML

services:
quickstart:
image: ${ZITI_CLI_IMAGE:-docker.io/openziti/ziti-controller}:${ZITI_CLI_TAG:-latest}
restart: unless-stopped
networks:
quickstart:
# this allows other containers to use the same external DNS name to reach the quickstart container from within the
# Docker network that clients outside the Docker network use to reach the quickstart container via port forwarding
aliases:
- ${ZITI_CTRL_ADVERTISED_ADDRESS:-ziti-controller}
- ${ZITI_ROUTER_ADVERTISED_ADDRESS:-ziti-router}
entrypoint:
- bash
- -euc
- |
ZITI_CMD+=" --ctrl-address ${ZITI_CTRL_ADVERTISED_ADDRESS:-quickstart}"\
" --ctrl-port ${ZITI_CTRL_ADVERTISED_PORT:-1280}"\
" --router-address ${ZITI_ROUTER_ADVERTISED_ADDRESS:-${ZITI_CTRL_ADVERTISED_ADDRESS:-quickstart}}"\
" --router-port ${ZITI_ROUTER_PORT:-3022}"\
" --password ${ZITI_PWD:-admin}"
echo "DEBUG: run command is: ziti $${@} $${ZITI_CMD}"
exec ziti "$${@}" $${ZITI_CMD}
command: -- edge quickstart --home /home/ziggy/quickstart
user: ${ZIGGY_UID:-1000}
environment:
PFXLOG_NO_JSON: "${PFXLOG_NO_JSON:-true}"
ZITI_ROUTER_NAME: ${ZITI_ROUTER_NAME:-quickstart-router}
volumes:
# store the quickstart state in a named volume "ziti_home" or store the quickstart state on the Docker host in a
# directory, ZITI_HOME
- ${ZITI_HOME:-ziti_home}:/home/ziggy
ports:
- ${ZITI_INTERFACE:-0.0.0.0}:${ZITI_CTRL_ADVERTISED_PORT:-1280}:${ZITI_CTRL_ADVERTISED_PORT:-1280}
- ${ZITI_INTERFACE:-0.0.0.0}:${ZITI_ROUTER_PORT:-3022}:${ZITI_ROUTER_PORT:-3022}
expose:
- ${ZITI_CTRL_ADVERTISED_PORT:-1280}
- ${ZITI_ROUTER_PORT:-3022}
depends_on:
quickstart-init:
condition: service_completed_successfully
healthcheck:
test:
- CMD
- ziti
- agent
- stats
interval: 3s
timeout: 3s
retries: 5
start_period: 30s
# this service is used to initialize the ziti_home volume by setting the owner to the UID of the user running the
# quickstart container
quickstart-init:
image: busybox
command: chown -Rc ${ZIGGY_UID:-1000} /home/ziggy
user: root
volumes:
# store the quickstart state in a named volume "ziti_home" or store the quickstart state on the Docker host in a
# directory, ZITI_HOME
- ${ZITI_HOME:-ziti_home}:/home/ziggy
# add a health check for the quickstart network
quickstart-check:
image: busybox
command: echo "Ziti is cooking"
depends_on:
quickstart:
condition: service_healthy
# define a custom network so that we can also define a DNS alias for the quickstart container
networks:
quickstart:
driver: bridge
volumes:
# this will not be used if you switch from named volume to bind mount volume
ziti_home:
driver: local