add docker instance getter

This commit is contained in:
Kenneth Bingham
2026-03-19 22:50:42 -04:00
parent fa25e04cf6
commit c41384353f
3 changed files with 99 additions and 14 deletions
+24 -11
View File
@@ -3,10 +3,10 @@
This directory contains the Docker Compose project for self-hosting a
complete zrok2 instance with a Ziti overlay network.
For the full self-hosting guide, see:
**<https://docs.zrok.io/docs/self-hosting/docker/>**
For the full self-hosting guide, see deployments:
**<https://netfoundry.io/docs/zrok/category/deployment>**
## Quick Start
## Quick start
```bash
cp .env.example .env
@@ -14,27 +14,40 @@ cp .env.example .env
docker compose up -d
```
## Files
Or download the essential Docker Compose files without cloning the repository:
```bash
curl -sSfL https://get.openziti.io/zrok2-instance/fetch.bash | bash
cd zrok2-instance
```
## Essential files
| File | Purpose |
|------|---------|
| `compose.yml` | Core services (Ziti, zrok2, PostgreSQL) |
| ---- | ------- |
| `compose.yml` | Core services: Ziti overlay, zrok2, PostgreSQL, RabbitMQ |
| `compose.caddy.yml` | Optional TLS overlay with Caddy |
| `Caddyfile` | Caddy reverse proxy configuration |
| `.env.example` | Documented environment variable template |
| `entrypoint-init.bash` | Bootstrap script for the `zrok2-init` one-shot container |
| `fetch.bash` | Download script — fetches these files into a `zrok2-instance/` directory |
## Architecture
## Services
The stack deploys these services:
- **ziti-controller** — Ziti control plane (PKI, identities, policies)
- **ziti-router** — Ziti data plane (SDK traffic)
- **postgresql** — zrok2 database (default; SQLite3 available)
- **zrok2-init** — one-shot bootstrap (generates config, creates identities)
- **rabbitmq** — AMQP message bus for the dynamic frontend's real-time
share mapping updates (required for named public shares via
`zrok2 share public --name-selection`)
- **zrok2-init** — one-shot bootstrap (generates config, creates
identities, sets up the `dynamicProxyController` gRPC service)
- **zrok2-controller** — zrok2 API and admin
- **zrok2-frontend** — public share frontend
- **zrok2-frontend** — AMQP-backed dynamic public share frontend
Optional metrics pipeline (enable with `--profile metrics`):
- **rabbitmq** — metrics message queue
- **influxdb** — metrics time-series storage
- **zrok2-metrics-bridge** — reads Ziti usage events and publishes to
RabbitMQ for the zrok2 controller to write to InfluxDB
+71
View File
@@ -0,0 +1,71 @@
#!/usr/bin/env bash
#
# Download the zrok2 Docker Compose self-hosting project.
#
# Usage:
# curl -sSfL https://get.openziti.io/zrok2-instance/fetch.bash | bash
#
# Creates a zrok2-instance/ directory with the essential files listed in
# README.md. See the full guide at
# https://netfoundry.io/docs/zrok/self-hosting/deployment/docker
set -o errexit -o nounset -o pipefail
BASE="https://get.openziti.io/zrok2-instance"
# Essential files from README.md (user-facing compose project).
# CI test scripts (dangerous.*.test.bash, compose.canary.yml, etc.) are
# excluded — they are only needed for development.
# The zrok2-bootstrap.bash library is NOT downloaded — it is included in
# the openziti/zrok2 container image at /usr/local/bin/zrok2-bootstrap
# and sourced automatically by entrypoint-init.bash on first run.
FILES=(
compose.yml
compose.caddy.yml
.env.example
entrypoint-init.bash
)
DEST="zrok2-instance"
dir_is_empty() { [[ -z "$(ls -A "$1" 2>/dev/null)" ]]; }
if [[ "$(basename "${PWD}")" == "${DEST}" ]]; then
# Already inside a directory named zrok2-instance
if dir_is_empty "${PWD}"; then
DEST="."
else
echo "Current directory is '${DEST}' but is not empty." >&2
exit 1
fi
elif [[ -d "${DEST}" ]]; then
if ! dir_is_empty "${DEST}"; then
echo "Directory '${DEST}' already exists and is not empty." >&2
exit 1
fi
# exists and is empty — reuse it
else
mkdir "${DEST}"
fi
echo "Downloading zrok2 Docker Compose project to ${DEST}/ ..."
for f in "${FILES[@]}"; do
curl -sSfL "${BASE}/${f}" -o "${DEST}/${f}"
echo " ${f}"
done
if [[ "${DEST}" == "." ]]; then
echo ""
echo "Done. Next steps:"
echo " cp .env.example .env"
echo " # edit .env — set ZROK2_DNS_ZONE, ZROK2_ADMIN_TOKEN, and ZITI_PWD"
echo " docker compose up -d"
else
echo ""
echo "Done. Next steps:"
echo " cd ${DEST}"
echo " cp .env.example .env"
echo " # edit .env — set ZROK2_DNS_ZONE, ZROK2_ADMIN_TOKEN, and ZITI_PWD"
echo " docker compose up -d"
fi
@@ -36,14 +36,15 @@ insecure ports 18080 (controller) and 8080 (frontend) directly to the internet.
Download and extract the Compose project into a new `zrok2-instance` directory:
```bash
curl -sSfL https://get.zrok.io/docker | tar -xz -C zrok2-instance
curl -sSfL https://get.openziti.io/zrok2-instance/fetch.bash | bash
cd zrok2-instance
```
Or clone the repository:
This downloads the essential Docker Compose project files. Alternatively, clone the
repository, e.g., if you wish to build `zrok2` from source with `compose.build.yml`:
```bash
git clone https://github.com/openziti/zrok.git
git clone --depth 1 https://github.com/openziti/zrok.git
cd zrok/docker/compose/zrok2-instance
```