2023-02-15 20:04:26 +01:00
|
|
|
services:
|
2023-10-20 19:46:36 +02:00
|
|
|
zrok-init:
|
2023-02-15 23:41:46 +01:00
|
|
|
image: busybox
|
|
|
|
# matches uid:gid of "nobody" in zrok container image
|
|
|
|
command: chown -Rc 65534:65534 /mnt/.zrok
|
|
|
|
user: root
|
|
|
|
volumes:
|
|
|
|
- zrok_env:/mnt/.zrok
|
2023-10-20 19:46:36 +02:00
|
|
|
|
2023-02-15 23:41:46 +01:00
|
|
|
zrok-enable:
|
2023-10-20 19:46:36 +02:00
|
|
|
image: ${ZROK_CONTAINER_IMAGE:-docker.io/openziti/zrok}
|
2023-02-15 23:41:46 +01:00
|
|
|
depends_on:
|
2023-10-20 19:46:36 +02:00
|
|
|
zrok-init:
|
2023-02-15 23:41:46 +01:00
|
|
|
condition: service_completed_successfully
|
|
|
|
entrypoint:
|
|
|
|
- bash
|
2023-10-20 19:46:36 +02:00
|
|
|
- -euc
|
2023-02-15 23:41:46 +01:00
|
|
|
- |
|
2023-10-20 19:46:36 +02:00
|
|
|
if [[ -n "$(jq '.ziti_identity' ~/.zrok/environment.json 2>/dev/null)" ]]; then
|
|
|
|
echo "INFO: zrok environment is already enabled"
|
2023-02-15 23:41:46 +01:00
|
|
|
exit 0
|
|
|
|
else
|
2023-10-20 19:46:36 +02:00
|
|
|
zrok config set apiEndpoint ${ZROK_API_ENDPOINT:-https://api.zrok.io}
|
2023-02-15 23:41:46 +01:00
|
|
|
echo "INFO: running: zrok $$(sed -E "s/${ZROK_ENABLE_TOKEN}/************/" <<< $${@})"
|
2023-10-20 19:46:36 +02:00
|
|
|
exec zrok "$${@}"
|
2023-02-15 23:41:46 +01:00
|
|
|
fi
|
2023-10-20 19:46:36 +02:00
|
|
|
command: -- enable --headless --description "${ZROK_ENVIRONMENT_NAME:-docker private access}" ${ZROK_ENABLE_TOKEN}
|
2023-02-15 23:41:46 +01:00
|
|
|
volumes:
|
|
|
|
- zrok_env:/mnt/.zrok
|
|
|
|
environment:
|
|
|
|
HOME: /mnt
|
2023-10-20 19:46:36 +02:00
|
|
|
|
|
|
|
zrok-access:
|
|
|
|
image: ${ZROK_CONTAINER_IMAGE:-docker.io/openziti/zrok}
|
2023-02-22 03:28:02 +01:00
|
|
|
command: access private --headless --bind 0.0.0.0:9191 ${ZROK_ACCESS_TOKEN}
|
2023-02-15 23:41:46 +01:00
|
|
|
depends_on:
|
|
|
|
zrok-enable:
|
|
|
|
condition: service_completed_successfully
|
2023-02-15 20:04:26 +01:00
|
|
|
ports:
|
2023-02-15 23:41:46 +01:00
|
|
|
- 9191:9191 # expose the zrok private access proxy to the Docker host
|
2023-02-15 20:04:26 +01:00
|
|
|
volumes:
|
2023-02-15 23:41:46 +01:00
|
|
|
- zrok_env:/mnt/.zrok
|
2023-02-15 20:04:26 +01:00
|
|
|
environment:
|
|
|
|
HOME: /mnt
|
|
|
|
PFXLOG_NO_JSON: "true"
|
2023-02-15 23:41:46 +01:00
|
|
|
|
|
|
|
# alternatively, access the zrok private access proxy from another container
|
|
|
|
demo-client:
|
|
|
|
depends_on:
|
2023-10-20 19:46:36 +02:00
|
|
|
- zrok-access
|
2023-02-15 20:04:26 +01:00
|
|
|
image: busybox
|
2023-02-15 23:41:46 +01:00
|
|
|
entrypoint:
|
|
|
|
- sh
|
|
|
|
- -c
|
|
|
|
- |
|
|
|
|
while true; do
|
|
|
|
echo 'INFO: trying wget';
|
2023-10-20 19:46:36 +02:00
|
|
|
wget -q -O - http://zrok-access:9191/ip;
|
2023-02-15 23:41:46 +01:00
|
|
|
sleep 3;
|
|
|
|
done
|
|
|
|
|
|
|
|
volumes:
|
|
|
|
zrok_env:
|