diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index ac8f2fba..4bbb32ea 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -72,7 +72,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: linux-amd64 - path: ${{ steps.solve_go_bin.outputs.go_bin }}/zrok + path: ${{ steps.solve_go_bin.outputs.go_bin }}/zrok2 if-no-files-found: error windows-build: @@ -122,7 +122,7 @@ jobs: - uses: actions/upload-artifact@v4 with: name: windows-amd64 - path: ./dist/**/zrok.exe + path: ./dist/**/zrok2.exe if-no-files-found: error pytest: diff --git a/.goreleaser-darwin.yml b/.goreleaser-darwin.yml index 264fce97..5d6d8208 100644 --- a/.goreleaser-darwin.yml +++ b/.goreleaser-darwin.yml @@ -2,7 +2,7 @@ version: 2 builds: - id: zrok-amd64 main: ./cmd/zrok - binary: zrok + binary: zrok2 ldflags: "-s -w -X github.com/openziti/zrok/v2/build.Version={{.Tag}} -X github.com/openziti/zrok/v2/build.Hash={{.ShortCommit}}" env: - CGO_ENABLED=1 @@ -12,15 +12,15 @@ builds: - amd64 hooks: post: - - cmd: 'codesign -s "Developer ID Application: NetFoundry Inc" -v dist/zrok-amd64_darwin_amd64_v1/zrok --options=runtime' + - cmd: 'codesign -s "Developer ID Application: NetFoundry Inc" -v dist/zrok-amd64_darwin_amd64_v1/zrok2 --options=runtime' output: true - - cmd: zip "dist/zrok-amd64_darwin_amd64_v1/zrok.zip" dist/zrok-amd64_darwin_amd64_v1/zrok - - cmd: xcrun notarytool submit "dist/zrok-amd64_darwin_amd64_v1/zrok.zip" --apple-id {{ .Env.AC_USERNAME }} --password {{ .Env.AC_PASSWORD }} --team-id MN5S649TXM --wait + - cmd: zip "dist/zrok-amd64_darwin_amd64_v1/zrok2.zip" dist/zrok-amd64_darwin_amd64_v1/zrok2 + - cmd: xcrun notarytool submit "dist/zrok-amd64_darwin_amd64_v1/zrok2.zip" --apple-id {{ .Env.AC_USERNAME }} --password {{ .Env.AC_PASSWORD }} --team-id MN5S649TXM --wait output: true - id: zrok-arm64 main: ./cmd/zrok - binary: zrok + binary: zrok2 ldflags: "-s -w -X github.com/openziti/zrok/v2/build.Version={{.Tag}} -X github.com/openziti/zrok/v2/build.Hash={{.ShortCommit}}" env: - CGO_ENABLED=1 @@ -30,8 +30,8 @@ builds: - arm64 hooks: post: - - cmd: 'codesign -s "Developer ID Application: NetFoundry Inc" -v dist/zrok-arm64_darwin_arm64_v8.0/zrok --options=runtime' + - cmd: 'codesign -s "Developer ID Application: NetFoundry Inc" -v dist/zrok-arm64_darwin_arm64_v8.0/zrok2 --options=runtime' output: true - - cmd: zip "dist/zrok-arm64_darwin_arm64_v8.0/zrok.zip" dist/zrok-arm64_darwin_arm64_v8.0/zrok - - cmd: xcrun notarytool submit "dist/zrok-arm64_darwin_arm64_v8.0/zrok.zip" --apple-id {{ .Env.AC_USERNAME }} --password {{ .Env.AC_PASSWORD }} --team-id MN5S649TXM --wait + - cmd: zip "dist/zrok-arm64_darwin_arm64_v8.0/zrok2.zip" dist/zrok-arm64_darwin_arm64_v8.0/zrok2 + - cmd: xcrun notarytool submit "dist/zrok-arm64_darwin_arm64_v8.0/zrok2.zip" --apple-id {{ .Env.AC_USERNAME }} --password {{ .Env.AC_PASSWORD }} --team-id MN5S649TXM --wait output: true diff --git a/.goreleaser-linux-amd64.yml b/.goreleaser-linux-amd64.yml index 6f6d456d..0b254462 100644 --- a/.goreleaser-linux-amd64.yml +++ b/.goreleaser-linux-amd64.yml @@ -2,7 +2,7 @@ version: 2 builds: - id: zrok-amd64 main: ./cmd/zrok - binary: zrok + binary: zrok2 ldflags: "-s -w -X github.com/openziti/zrok/v2/build.Version={{.Tag}} -X github.com/openziti/zrok/v2/build.Hash={{.ShortCommit}}" env: - CGO_ENABLED=1 @@ -12,7 +12,7 @@ builds: - amd64 nfpms: - - package_name: zrok + - package_name: zrok2 id: zrok-cli vendor: NetFoundry homepage: https://zrok.io/ @@ -51,18 +51,18 @@ nfpms: # Contents to add to the package. contents: - - src: /opt/openziti/bin/zrok - dst: /usr/bin/zrok + - src: /opt/openziti/bin/zrok2 + dst: /usr/bin/zrok2 type: "symlink" - - package_name: zrok-share + - package_name: zrok2-share id: zrok-share vendor: NetFoundry homepage: https://zrok.io/ maintainer: support@zrok.io description: |- - This package provides zrok-share.service. To enable, edit the "/opt/openziti/etc/zrok/zrok-share.env" file with the - desired target for sharing, and run "systemctl enable --now zrok-share.service". + This package provides zrok2-share.service. To enable, edit the "/opt/openziti/etc/zrok2/zrok2-share.env" file with the + desired target for sharing, and run "systemctl enable --now zrok2-share.service". license: Apache 2.0 # do not bundle the built binaries, only supporting files @@ -90,10 +90,10 @@ nfpms: # GoReleaser will automatically add the binaries here dependencies: - - zrok + - zrok2 # this allows users to satisfy the requirement for jq another way, not with the package manager, e.g. - # apt install --no-recommends zrok-share + # apt install --no-recommends zrok2-share recommends: - jq @@ -101,49 +101,49 @@ nfpms: # yum and dnf do not automatically install "weak deps" aka "recommends", so we need to add them as a dependency rpm: dependencies: - - zrok + - zrok2 - jq # Contents to add to the package. contents: - dst: /lib/systemd/system/ - src: ./nfpm/zrok-share.service + src: ./nfpm/zrok2-share.service - dst: /usr/lib/systemd/user/ - src: ./nfpm/zrok-share@.service + src: ./nfpm/zrok2-share@.service - - dst: /opt/openziti/etc/zrok + - dst: /opt/openziti/etc/zrok2 type: dir file_info: mode: 0755 - dst: /opt/openziti/bin/ - src: ./nfpm/zrok-share.bash + src: ./nfpm/zrok2-share.bash file_info: mode: 0755 - dst: /opt/openziti/bin/ - src: ./nfpm/zrok-enable.bash + src: ./nfpm/zrok2-enable.bash file_info: mode: 0755 - - dst: /opt/openziti/etc/zrok/ - src: ./nfpm/zrok-share.env + - dst: /opt/openziti/etc/zrok2/ + src: ./nfpm/zrok2-share.env type: config|noreplace - - dst: /opt/openziti/etc/zrok/ + - dst: /opt/openziti/etc/zrok2/ src: ./etc/caddy/multiple_upstream.Caddyfile type: config|noreplace - - package_name: zrok-agent + - package_name: zrok2-agent id: zrok-agent vendor: NetFoundry homepage: https://zrok.io/ maintainer: support@zrok.io description: | - This package provides zrok-agent.service. Enable your zrok account on this device with "zrok enable". Run - "systemctl enable --user --now zrok-agent.service" to enable the service for the current user and visit the agent - UI by running "zrok agent console". + This package provides zrok2-agent.service. Enable your zrok account on this device with "zrok2 enable". Run + "systemctl enable --user --now zrok2-agent.service" to enable the service for the current user and visit the agent + UI by running "zrok2 agent console". license: Apache 2.0 # do not bundle the built binaries, only supporting files @@ -171,19 +171,19 @@ nfpms: # GoReleaser will automatically add the binaries here dependencies: - - zrok + - zrok2 # this allows users to satisfy the requirement for jq another way, not with the package manager, e.g. - # apt install --no-recommends zrok-share + # apt install --no-recommends zrok2-share recommends: [] overrides: # yum and dnf do not automatically install "weak deps" aka "recommends", so we need to add them as a dependency rpm: dependencies: - - zrok + - zrok2 # Contents to add to the package. contents: - dst: /usr/lib/systemd/user/ - src: ./nfpm/zrok-agent.service + src: ./nfpm/zrok2-agent.service diff --git a/.goreleaser-linux-arm64.yml b/.goreleaser-linux-arm64.yml index 185e0903..09acbfeb 100644 --- a/.goreleaser-linux-arm64.yml +++ b/.goreleaser-linux-arm64.yml @@ -2,7 +2,7 @@ version: 2 builds: - id: zrok-armv8 main: ./cmd/zrok - binary: zrok + binary: zrok2 ldflags: "-s -w -X github.com/openziti/zrok/v2/build.Version={{.Tag}} -X github.com/openziti/zrok/v2/build.Hash={{.ShortCommit}}" env: - CC=aarch64-linux-gnu-gcc @@ -16,7 +16,7 @@ builds: - 8 nfpms: - - package_name: zrok + - package_name: zrok2 id: zrok-cli vendor: NetFoundry homepage: https://zrok.io/ @@ -55,18 +55,18 @@ nfpms: # Contents to add to the package. contents: - - src: /opt/openziti/bin/zrok - dst: /usr/bin/zrok + - src: /opt/openziti/bin/zrok2 + dst: /usr/bin/zrok2 type: "symlink" - - package_name: zrok-share + - package_name: zrok2-share id: zrok-share vendor: NetFoundry homepage: https://zrok.io/ maintainer: support@zrok.io description: |- - This package provides zrok-share.service. To enable, edit the "/opt/openziti/etc/zrok/zrok-share.env" file with the - desired target for sharing, and run "systemctl enable --now zrok-share.service". + This package provides zrok2-share.service. To enable, edit the "/opt/openziti/etc/zrok2/zrok2-share.env" file with the + desired target for sharing, and run "systemctl enable --now zrok2-share.service". license: Apache 2.0 # do not bundle the built binaries, only supporting files @@ -94,10 +94,10 @@ nfpms: # GoReleaser will automatically add the binaries here dependencies: - - zrok + - zrok2 # this allows users to satisfy the requirement for jq another way, not with the package manager, e.g. - # apt install --no-recommends zrok-share + # apt install --no-recommends zrok2-share recommends: - jq @@ -105,49 +105,49 @@ nfpms: # yum and dnf do not automatically install "weak deps" aka "recommends", so we need to add them as a dependency rpm: dependencies: - - zrok + - zrok2 - jq # Contents to add to the package. contents: - dst: /lib/systemd/system/ - src: ./nfpm/zrok-share.service + src: ./nfpm/zrok2-share.service - dst: /usr/lib/systemd/user/ - src: ./nfpm/zrok-share@.service + src: ./nfpm/zrok2-share@.service - - dst: /opt/openziti/etc/zrok + - dst: /opt/openziti/etc/zrok2 type: dir file_info: mode: 0755 - dst: /opt/openziti/bin/ - src: ./nfpm/zrok-share.bash + src: ./nfpm/zrok2-share.bash file_info: mode: 0755 - dst: /opt/openziti/bin/ - src: ./nfpm/zrok-enable.bash + src: ./nfpm/zrok2-enable.bash file_info: mode: 0755 - - dst: /opt/openziti/etc/zrok/ - src: ./nfpm/zrok-share.env + - dst: /opt/openziti/etc/zrok2/ + src: ./nfpm/zrok2-share.env type: config|noreplace - - dst: /opt/openziti/etc/zrok/ + - dst: /opt/openziti/etc/zrok2/ src: ./etc/caddy/multiple_upstream.Caddyfile type: config|noreplace - - package_name: zrok-agent + - package_name: zrok2-agent id: zrok-agent vendor: NetFoundry homepage: https://zrok.io/ maintainer: support@zrok.io description: | - This package provides zrok-agent.service. Enable your zrok account on this device with "zrok enable". Run - "systemctl enable --user --now zrok-agent.service" to enable the service for the current user and visit the agent - UI by running "zrok agent console". + This package provides zrok2-agent.service. Enable your zrok account on this device with "zrok2 enable". Run + "systemctl enable --user --now zrok2-agent.service" to enable the service for the current user and visit the agent + UI by running "zrok2 agent console". license: Apache 2.0 # do not bundle the built binaries, only supporting files @@ -175,19 +175,19 @@ nfpms: # GoReleaser will automatically add the binaries here dependencies: - - zrok + - zrok2 # this allows users to satisfy the requirement for jq another way, not with the package manager, e.g. - # apt install --no-recommends zrok-share + # apt install --no-recommends zrok2-share recommends: [] overrides: # yum and dnf do not automatically install "weak deps" aka "recommends", so we need to add them as a dependency rpm: dependencies: - - zrok + - zrok2 # Contents to add to the package. contents: - dst: /usr/lib/systemd/user/ - src: ./nfpm/zrok-agent.service + src: ./nfpm/zrok2-agent.service diff --git a/.goreleaser-linux-armel.yml b/.goreleaser-linux-armel.yml index ac24c130..a90e5e20 100644 --- a/.goreleaser-linux-armel.yml +++ b/.goreleaser-linux-armel.yml @@ -5,7 +5,7 @@ version: 2 builds: - id: zrok-armel main: ./cmd/zrok - binary: zrok + binary: zrok2 ldflags: - "-s -w -X github.com/openziti/zrok/v2/build.Version={{.Tag}} -X github.com/openziti/zrok/v2/build.Hash={{.ShortCommit}}" env: @@ -20,7 +20,7 @@ builds: - 7 nfpms: - - package_name: zrok + - package_name: zrok2 id: zrok-cli vendor: NetFoundry homepage: https://zrok.io/ @@ -59,18 +59,18 @@ nfpms: # Contents to add to the package. contents: - - src: /opt/openziti/bin/zrok - dst: /usr/bin/zrok + - src: /opt/openziti/bin/zrok2 + dst: /usr/bin/zrok2 type: "symlink" - - package_name: zrok-share + - package_name: zrok2-share id: zrok-share vendor: NetFoundry homepage: https://zrok.io/ maintainer: support@zrok.io description: |- - This package provides zrok-share.service. To enable, edit the "/opt/openziti/etc/zrok/zrok-share.env" file with the - desired target for sharing, and run "systemctl enable --now zrok-share.service". + This package provides zrok2-share.service. To enable, edit the "/opt/openziti/etc/zrok2/zrok2-share.env" file with the + desired target for sharing, and run "systemctl enable --now zrok2-share.service". license: Apache 2.0 # do not bundle the built binaries, only supporting files @@ -98,10 +98,10 @@ nfpms: # GoReleaser will automatically add the binaries here dependencies: - - zrok + - zrok2 # this allows users to satisfy the requirement for jq another way, not with the package manager, e.g. - # apt install --no-recommends zrok-share + # apt install --no-recommends zrok2-share recommends: - jq @@ -109,49 +109,49 @@ nfpms: # yum and dnf do not automatically install "weak deps" aka "recommends", so we need to add them as a dependency rpm: dependencies: - - zrok + - zrok2 - jq # Contents to add to the package. contents: - dst: /lib/systemd/system/ - src: ./nfpm/zrok-share.service + src: ./nfpm/zrok2-share.service - dst: /usr/lib/systemd/user/ - src: ./nfpm/zrok-share@.service + src: ./nfpm/zrok2-share@.service - - dst: /opt/openziti/etc/zrok + - dst: /opt/openziti/etc/zrok2 type: dir file_info: mode: 0755 - dst: /opt/openziti/bin/ - src: ./nfpm/zrok-share.bash + src: ./nfpm/zrok2-share.bash file_info: mode: 0755 - dst: /opt/openziti/bin/ - src: ./nfpm/zrok-enable.bash + src: ./nfpm/zrok2-enable.bash file_info: mode: 0755 - - dst: /opt/openziti/etc/zrok/ - src: ./nfpm/zrok-share.env + - dst: /opt/openziti/etc/zrok2/ + src: ./nfpm/zrok2-share.env type: config|noreplace - - dst: /opt/openziti/etc/zrok/ + - dst: /opt/openziti/etc/zrok2/ src: ./etc/caddy/multiple_upstream.Caddyfile type: config|noreplace - - package_name: zrok-agent + - package_name: zrok2-agent id: zrok-agent vendor: NetFoundry homepage: https://zrok.io/ maintainer: support@zrok.io description: | - This package provides zrok-agent.service. Enable your zrok account on this device with "zrok enable". Run - "systemctl enable --user --now zrok-agent.service" to enable the service for the current user and visit the agent - UI by running "zrok agent console". + This package provides zrok2-agent.service. Enable your zrok account on this device with "zrok2 enable". Run + "systemctl enable --user --now zrok2-agent.service" to enable the service for the current user and visit the agent + UI by running "zrok2 agent console". license: Apache 2.0 # do not bundle the built binaries, only supporting files @@ -179,19 +179,19 @@ nfpms: # GoReleaser will automatically add the binaries here dependencies: - - zrok + - zrok2 # this allows users to satisfy the requirement for jq another way, not with the package manager, e.g. - # apt install --no-recommends zrok-share + # apt install --no-recommends zrok2-share recommends: [] overrides: # yum and dnf do not automatically install "weak deps" aka "recommends", so we need to add them as a dependency rpm: dependencies: - - zrok + - zrok2 # Contents to add to the package. contents: - dst: /usr/lib/systemd/user/ - src: ./nfpm/zrok-agent.service + src: ./nfpm/zrok2-agent.service diff --git a/.goreleaser-linux-armhf.yml b/.goreleaser-linux-armhf.yml index adf787b8..12f1b7f4 100644 --- a/.goreleaser-linux-armhf.yml +++ b/.goreleaser-linux-armhf.yml @@ -3,7 +3,7 @@ version: 2 builds: - id: zrok-armhf main: ./cmd/zrok - binary: zrok + binary: zrok2 ldflags: - "-s -w -X github.com/openziti/zrok/v2/build.Version={{.Tag}} -X github.com/openziti/zrok/v2/build.Hash={{.ShortCommit}}" env: @@ -18,7 +18,7 @@ builds: - 7 nfpms: - - package_name: zrok + - package_name: zrok2 id: zrok-cli vendor: NetFoundry homepage: https://zrok.io/ @@ -57,18 +57,18 @@ nfpms: # Contents to add to the package. contents: - - src: /opt/openziti/bin/zrok - dst: /usr/bin/zrok + - src: /opt/openziti/bin/zrok2 + dst: /usr/bin/zrok2 type: "symlink" - - package_name: zrok-share + - package_name: zrok2-share id: zrok-share vendor: NetFoundry homepage: https://zrok.io/ maintainer: support@zrok.io description: |- - This package provides zrok-share.service. To enable, edit the "/opt/openziti/etc/zrok/zrok-share.env" file with the - desired target for sharing, and run "systemctl enable --now zrok-share.service". + This package provides zrok2-share.service. To enable, edit the "/opt/openziti/etc/zrok2/zrok2-share.env" file with the + desired target for sharing, and run "systemctl enable --now zrok2-share.service". license: Apache 2.0 # do not bundle the built binaries, only supporting files @@ -96,10 +96,10 @@ nfpms: # GoReleaser will automatically add the binaries here dependencies: - - zrok + - zrok2 # this allows users to satisfy the requirement for jq another way, not with the package manager, e.g. - # apt install --no-recommends zrok-share + # apt install --no-recommends zrok2-share recommends: - jq @@ -107,49 +107,49 @@ nfpms: # yum and dnf do not automatically install "weak deps" aka "recommends", so we need to add them as a dependency rpm: dependencies: - - zrok + - zrok2 - jq # Contents to add to the package. contents: - dst: /lib/systemd/system/ - src: ./nfpm/zrok-share.service + src: ./nfpm/zrok2-share.service - dst: /usr/lib/systemd/user/ - src: ./nfpm/zrok-share@.service + src: ./nfpm/zrok2-share@.service - - dst: /opt/openziti/etc/zrok + - dst: /opt/openziti/etc/zrok2 type: dir file_info: mode: 0755 - dst: /opt/openziti/bin/ - src: ./nfpm/zrok-share.bash + src: ./nfpm/zrok2-share.bash file_info: mode: 0755 - dst: /opt/openziti/bin/ - src: ./nfpm/zrok-enable.bash + src: ./nfpm/zrok2-enable.bash file_info: mode: 0755 - - dst: /opt/openziti/etc/zrok/ - src: ./nfpm/zrok-share.env + - dst: /opt/openziti/etc/zrok2/ + src: ./nfpm/zrok2-share.env type: config|noreplace - - dst: /opt/openziti/etc/zrok/ + - dst: /opt/openziti/etc/zrok2/ src: ./etc/caddy/multiple_upstream.Caddyfile type: config|noreplace - - package_name: zrok-agent + - package_name: zrok2-agent id: zrok-agent vendor: NetFoundry homepage: https://zrok.io/ maintainer: support@zrok.io description: | - This package provides zrok-agent.service. Enable your zrok account on this device with "zrok enable". Run - "systemctl enable --user --now zrok-agent.service" to enable the service for the current user and visit the agent - UI by running "zrok agent console". + This package provides zrok2-agent.service. Enable your zrok account on this device with "zrok2 enable". Run + "systemctl enable --user --now zrok2-agent.service" to enable the service for the current user and visit the agent + UI by running "zrok2 agent console". license: Apache 2.0 # do not bundle the built binaries, only supporting files @@ -177,19 +177,19 @@ nfpms: # GoReleaser will automatically add the binaries here dependencies: - - zrok + - zrok2 # this allows users to satisfy the requirement for jq another way, not with the package manager, e.g. - # apt install --no-recommends zrok-share + # apt install --no-recommends zrok2-share recommends: [] overrides: # yum and dnf do not automatically install "weak deps" aka "recommends", so we need to add them as a dependency rpm: dependencies: - - zrok + - zrok2 # Contents to add to the package. contents: - dst: /usr/lib/systemd/user/ - src: ./nfpm/zrok-agent.service + src: ./nfpm/zrok2-agent.service diff --git a/.goreleaser-windows.yml b/.goreleaser-windows.yml index d33ac157..d664cb10 100644 --- a/.goreleaser-windows.yml +++ b/.goreleaser-windows.yml @@ -1,7 +1,7 @@ version: 2 builds: - main: ./cmd/zrok - binary: zrok + binary: zrok2 ldflags: "-s -w -X github.com/openziti/zrok/v2/build.Version={{.Tag}} -X github.com/openziti/zrok/v2/build.Hash={{.ShortCommit}}" env: - CGO_ENABLED=1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 19485d9e..ed5c5fa0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,34 +2,43 @@ ## v2.0.0 -FEATURE: Major changes to how "unique names" and "reserved sharing" work. See the [zrok v2 Migration Guide](https://docs.zrok.io) for details. Reserved sharing, including the `zrok reserve`, `zrok release` and `zrok share reserved` commands have been removed. Namespaces and reserved names replace these concepts in a much more powerful, flexible way which can accomplis what reserved sharing did in a much better way. (https://github.com/openziti/zrok/issues/726) +FEATURE: Major changes to how "unique names" and "reserved sharing" work. See the [zrok v2 Migration Guide](https://docs.zrok.io) for details. Reserved sharing, including the `zrok reserve`, `zrok release` and `zrok share reserved` commands have been removed. Namespaces and reserved names replace these concepts in a much more powerful, flexible way which can accomplish what reserved sharing did in a much better way. (https://github.com/openziti/zrok/issues/726) -FEATURE: `zrok share private` now includes a `--share-token` flag, which allows a user to create a vanity token for private shares. Now that reserved sharing has been replaced with namespaces, the `--share-token` flag allows private sharing to retain custom, persistent share token names. (https://github.com/openziti/zrok/issues/1070) +FEATURE: `zrok2 share private` now includes a `--share-token` flag, which allows a user to create a vanity token for private shares. Now that reserved sharing has been replaced with namespaces, the `--share-token` flag allows private sharing to retain custom, persistent share token names. (https://github.com/openziti/zrok/issues/1070) -FEATURE: `zrok modify name` command available to "upgrade" an ephemeral share name to a reserved share name. If you share something ephemerally and later decide that you want to persist that name for future use you can just `zrok modify name -r` that name and retain it indefinitely (or conversely `zrok modify name -r=false` to schedule a reserved name to be released when an associated share is terminated). (https://github.com/openziti/zrok/issues/1066) +FEATURE: `zrok2 modify name` command available to "upgrade" an ephemeral share name to a reserved share name. If you share something ephemerally and later decide that you want to persist that name for future use you can just `zrok2 modify name -r` that name and retain it indefinitely (or conversely `zrok2 modify name -r=false` to schedule a reserved name to be released when an associated share is terminated). (https://github.com/openziti/zrok/issues/1066) -FEATURE: New `zrok list names`, `zrok list namespaces`, `zrok list environments`, `zrok list shares`, and `zrok list accesses` commands available to query the environments, shares, and accesses contained in the user's account; supports filtering on activity, accesses, shares, descriptions, host, ip address, and other relevant search criteria. By default outputs human-readable tabular output, but has a `--json` option to emit the values as JSON. (https://github.com/openziti/zrok/issues/1107) +FEATURE: New `zrok2 list names`, `zrok2 list namespaces`, `zrok2 list environments`, `zrok2 list shares`, and `zrok2 list accesses` commands available to query the environments, shares, and accesses contained in the user's account; supports filtering on activity, accesses, shares, descriptions, host, ip address, and other relevant search criteria. By default outputs human-readable tabular output, but has a `--json` option to emit the values as JSON. (https://github.com/openziti/zrok/issues/1107) -FEATURE: New `zrok delete environment` command that allows for deleting environments other than the current enabled environment. Use `zrok list environments --idle` to find idle environments and remove them using `zrok delete environment`. (https://github.com/openziti/zrok/issues/1107) +FEATURE: New `zrok2 delete environment` command that allows for deleting environments other than the current enabled environment. Use `zrok2 list environments --idle` to find idle environments and remove them using `zrok2 delete environment`. (https://github.com/openziti/zrok/issues/1107) - -FEATURE: New `zrok access dynamicProxy` which is designed to work with the new namespaces/names functionality. Rather than parsing the `Host` header and trying to extract a share token, the new `dynamicProxy` receives mapping updates from the zrok controller, allowing it to support any kind of mapped name. See the [zrok dynamicProxy Guide](https://docs.zrok.io) for details on setting up the new frontend. `zrok access public` remains available for legacy-style setups. (https://github.com/openziti/zrok/issues/1041) +FEATURE: New `zrok2 access dynamicProxy` which is designed to work with the new namespaces/names functionality. Rather than parsing the `Host` header and trying to extract a share token, the new `dynamicProxy` receives mapping updates from the zrok controller, allowing it to support any kind of mapped name. See the [zrok dynamicProxy Guide](https://docs.zrok.io) for details on setting up the new frontend. `zrok2 access public` remains available for legacy-style setups. (https://github.com/openziti/zrok/issues/1041) FEATURE: The zrok Agent now includes significantly improved handling for subordinate processes in error states. Errors encountered during agent reloading and also during active runtime are retried using an exponential falloff approach. Errored accesses or shares are given transient `err_XXXX` tokens, which can be used to manage (release) these processes. (https://github.com/openziti/zrok/issues/1000) -FEATURE: The zrok Agent has been updated for v2 name selections. Now that "reserved shares" have been replaced with reserved names, the zrok Agent will automatically restart any share which contains a name selection with a reserved name. The Agent continues to automatically manage `zrok access private` processes as always. +FEATURE: The zrok Agent has been updated for v2 name selections. Now that "reserved shares" have been replaced with reserved names, the zrok Agent will automatically restart any share which contains a name selection with a reserved name. The Agent continues to automatically manage `zrok2 access private` processes as always. -FEATURE: `zrok overview` now includes a human-readable default output, that formats the details of your zrok account in an easy-to-understand format. The classic JSON output is still available using the `--json` flag. (https://github.com/openziti/zrok/issues/1064) +FEATURE: `zrok2 overview` now includes a human-readable default output, that formats the details of your zrok account in an easy-to-understand format. The classic JSON output is still available using the `--json` flag. (https://github.com/openziti/zrok/issues/1064) -FEATURE: `zrok admin migrate` now supports a `--down ` flag, which allows for reverse-migration by a specified number of migrations +FEATURE: `zrok2 admin migrate` now supports a `--down ` flag, which allows for reverse-migration by a specified number of migrations CHANGE: The root package path was migrated from `github.com/openziti/zrok` to `github.com/openziti/zrok/v2` to accomodate golang v2+ package naming semantics. -CHANGE: `zrok status` now shows `EnvZId` instead of `Ziti Identity` in output. (https://github.com/openziti/zrok/issues/1107) +CHANGE: **Binary renamed from `zrok` to `zrok2`**. This allows zrok v1 and v2 to coexist on the same system without conflicts. All command invocations now use `zrok2` (e.g., `zrok2 enable`, `zrok2 share public`). (https://github.com/openziti/zrok/issues/1124) + +CHANGE: **Environment directory changed from `~/.zrok` to `~/.zrok2`**. This provides complete isolation between v1 and v2 environments. Users running `zrok2 enable` will create a new environment in `~/.zrok2`; existing `~/.zrok` environments are not affected. (https://github.com/openziti/zrok/issues/1124) + +CHANGE: **Environment variables renamed from `ZROK_*` to `ZROK2_*`**. All environment variables now use the `ZROK2_` prefix (e.g., `ZROK2_API_ENDPOINT`, `ZROK2_ADMIN_TOKEN`, `ZROK2_ENABLE_TOKEN`). This ensures v1 and v2 environment configurations do not interfere with each other. (https://github.com/openziti/zrok/issues/1124) + +CHANGE: **Linux packages renamed to `zrok2`, `zrok2-share`, `zrok2-agent`**. Systemd service files renamed to `zrok2-agent.service`, `zrok2-share.service`, `zrok2-share@.service`. Configuration directory changed to `/opt/openziti/etc/zrok2`. (https://github.com/openziti/zrok/issues/1124) + +CHANGE: **Removed `env_v0_3` compatibility layer**. Since zrok2 uses `~/.zrok2` exclusively and will never touch `~/.zrok`, the v0.3 environment migration code has been removed. The update infrastructure remains for future version upgrades. + +CHANGE: `zrok2 status` now shows `EnvZId` instead of `Ziti Identity` in output. (https://github.com/openziti/zrok/issues/1107) CHANGE: `defaultFrontend` configuration replaced with new `defaultNamespace`, which provides the logical equivalent of the old name-handling configuration (https://github.com/openziti/zrok/issues/1065) -CHANGE: `zrok admin create frontend`, `zrok admin update frontend` now include a new `--dynamic` flag which allows setting/changing the value of the `dynamic` property in the frontend. Setting `dynamic` is required when configuring a `dynamicProxy` frontend. `zrok admin list frontends` now displays the `dynamic` value of the frontends in the system. `zrok admin list frontends` includes a new `--extra` flag to display the additional/v1 properties maintained for frontends. (https://github.com/openziti/zrok/issues/1096) +CHANGE: `zrok2 admin create frontend`, `zrok2 admin update frontend` now include a new `--dynamic` flag which allows setting/changing the value of the `dynamic` property in the frontend. Setting `dynamic` is required when configuring a `dynamicProxy` frontend. `zrok2 admin list frontends` now displays the `dynamic` value of the frontends in the system. `zrok2 admin list frontends` includes a new `--extra` flag to display the additional/v1 properties maintained for frontends. (https://github.com/openziti/zrok/issues/1096) CHANGE: Completely overhauled the core ziti automation logic. The legacy `controller/zrokEdgeSdk` package has been replaced with a much more streamlined, clearer package `controller/automation`. This makes comprehending the controller code a lot simpler. (https://github.com/openziti/zrok/issues/1054) diff --git a/agent/access.go b/agent/access.go index 0b1e8c3a..6ed84623 100644 --- a/agent/access.go +++ b/agent/access.go @@ -3,7 +3,7 @@ package agent import ( "github.com/michaelquigley/df/dl" "github.com/openziti/zrok/v2/agent/proctree" - "github.com/openziti/zrok/v2/cmd/zrok/subordinate" + "github.com/openziti/zrok/v2/cmd/zrok2/subordinate" ) type AccessPrivateRequest struct { diff --git a/agent/accessPrivate.go b/agent/accessPrivate.go index f4176997..6924bacf 100644 --- a/agent/accessPrivate.go +++ b/agent/accessPrivate.go @@ -8,7 +8,7 @@ import ( "github.com/michaelquigley/df/dl" "github.com/openziti/zrok/v2/agent/agentGrpc" "github.com/openziti/zrok/v2/agent/proctree" - "github.com/openziti/zrok/v2/cmd/zrok/subordinate" + "github.com/openziti/zrok/v2/cmd/zrok2/subordinate" "github.com/openziti/zrok/v2/environment" ) @@ -19,7 +19,7 @@ func (a *Agent) AccessPrivate(req *AccessPrivateRequest) (frontendToken string, } if !root.IsEnabled() { - return "", errors.New("unable to load environment; did you 'zrok enable'?") + return "", errors.New("unable to load environment; did you 'zrok2 enable'?") } // build command using CommandBuilder diff --git a/agent/agent.go b/agent/agent.go index 2e03dddd..cf3646d1 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -38,7 +38,7 @@ type Agent struct { func NewAgent(cfg *AgentConfig, root env_core.Root) (*Agent, error) { if !root.IsEnabled() { - return nil, errors.Errorf("unable to load environment; did you 'zrok enable'?") + return nil, errors.Errorf("unable to load environment; did you 'zrok2 enable'?") } a := &Agent{ cfg: cfg, diff --git a/agent/bootHandler.go b/agent/bootHandler.go index c9fee7f4..7c76d76a 100644 --- a/agent/bootHandler.go +++ b/agent/bootHandler.go @@ -4,7 +4,7 @@ import ( "errors" "github.com/michaelquigley/df/dl" - "github.com/openziti/zrok/v2/cmd/zrok/subordinate" + "github.com/openziti/zrok/v2/cmd/zrok2/subordinate" "github.com/openziti/zrok/v2/sdk/golang/sdk" ) @@ -119,4 +119,4 @@ func NewAccessBootHandler(acc *access, bootErr *error) *UnifiedBootHandler { OperationType: "access", } return NewBootHandler(config, bootErr) -} \ No newline at end of file +} diff --git a/agent/share.go b/agent/share.go index 321aea3a..a7b8ab82 100644 --- a/agent/share.go +++ b/agent/share.go @@ -5,7 +5,7 @@ import ( "github.com/michaelquigley/df/dl" "github.com/openziti/zrok/v2/agent/proctree" - "github.com/openziti/zrok/v2/cmd/zrok/subordinate" + "github.com/openziti/zrok/v2/cmd/zrok2/subordinate" "github.com/openziti/zrok/v2/sdk/golang/sdk" ) @@ -83,4 +83,3 @@ func (s *share) monitor() { s.processExited = true s.agent.rmShare <- s } - diff --git a/agent/sharePrivate.go b/agent/sharePrivate.go index a3d1b29f..b955df1b 100644 --- a/agent/sharePrivate.go +++ b/agent/sharePrivate.go @@ -8,7 +8,7 @@ import ( "github.com/michaelquigley/df/dl" "github.com/openziti/zrok/v2/agent/agentGrpc" "github.com/openziti/zrok/v2/agent/proctree" - "github.com/openziti/zrok/v2/cmd/zrok/subordinate" + "github.com/openziti/zrok/v2/cmd/zrok2/subordinate" "github.com/openziti/zrok/v2/environment" "github.com/openziti/zrok/v2/sdk/golang/sdk" ) @@ -20,7 +20,7 @@ func (a *Agent) SharePrivate(req *SharePrivateRequest) (shareToken string, err e } if !root.IsEnabled() { - return "", errors.New("unable to load environment; did you 'zrok enable'?") + return "", errors.New("unable to load environment; did you 'zrok2 enable'?") } shr := &share{ diff --git a/agent/sharePublic.go b/agent/sharePublic.go index ba8218b8..f5e51b54 100644 --- a/agent/sharePublic.go +++ b/agent/sharePublic.go @@ -8,7 +8,7 @@ import ( "github.com/michaelquigley/df/dl" "github.com/openziti/zrok/v2/agent/agentGrpc" "github.com/openziti/zrok/v2/agent/proctree" - "github.com/openziti/zrok/v2/cmd/zrok/subordinate" + "github.com/openziti/zrok/v2/cmd/zrok2/subordinate" "github.com/openziti/zrok/v2/environment" "github.com/openziti/zrok/v2/sdk/golang/sdk" ) @@ -20,7 +20,7 @@ func (a *Agent) SharePublic(req *SharePublicRequest) (shareToken string, fronten } if !root.IsEnabled() { - return "", nil, errors.New("unable to load environment; did you 'zrok enable'?") + return "", nil, errors.New("unable to load environment; did you 'zrok2 enable'?") } shr := &share{ diff --git a/canary/dangerous.go b/canary/dangerous.go index 620254cd..31d2f50b 100644 --- a/canary/dangerous.go +++ b/canary/dangerous.go @@ -6,7 +6,7 @@ import ( ) func AcknowledgeDangerousCanary() error { - if _, ok := os.LookupEnv("ZROK_DANGEROUS_CANARY"); !ok { + if _, ok := os.LookupEnv("ZROK2_DANGEROUS_CANARY"); !ok { return fmt.Errorf("this is a dangerous canary; see canary docs for details on enabling") } return nil diff --git a/cmd/zrok/accessDynamicProxy.go b/cmd/zrok2/accessDynamicProxy.go similarity index 100% rename from cmd/zrok/accessDynamicProxy.go rename to cmd/zrok2/accessDynamicProxy.go diff --git a/cmd/zrok/accessPrivate.go b/cmd/zrok2/accessPrivate.go similarity index 98% rename from cmd/zrok/accessPrivate.go rename to cmd/zrok2/accessPrivate.go index 1a02d29b..9b3ddce6 100644 --- a/cmd/zrok/accessPrivate.go +++ b/cmd/zrok2/accessPrivate.go @@ -18,7 +18,7 @@ import ( "github.com/michaelquigley/df/dl" "github.com/openziti/zrok/v2/agent/agentClient" "github.com/openziti/zrok/v2/agent/agentGrpc" - "github.com/openziti/zrok/v2/cmd/zrok/subordinate" + "github.com/openziti/zrok/v2/cmd/zrok2/subordinate" "github.com/openziti/zrok/v2/endpoints" "github.com/openziti/zrok/v2/endpoints/proxy" "github.com/openziti/zrok/v2/endpoints/proxyUi" @@ -95,7 +95,7 @@ func (cmd *accessPrivateCommand) run(_ *cobra.Command, args []string) { } if !root.IsEnabled() { - tui.Error("unable to load environment; did you 'zrok enable'?", nil) + tui.Error("unable to load environment; did you 'zrok2 enable'?", nil) } detectAndRouteToAgent( diff --git a/cmd/zrok/accessPublic.go b/cmd/zrok2/accessPublic.go similarity index 100% rename from cmd/zrok/accessPublic.go rename to cmd/zrok2/accessPublic.go diff --git a/cmd/zrok/accessPublicValidate.go b/cmd/zrok2/accessPublicValidate.go similarity index 100% rename from cmd/zrok/accessPublicValidate.go rename to cmd/zrok2/accessPublicValidate.go diff --git a/cmd/zrok/accessTui.go b/cmd/zrok2/accessTui.go similarity index 100% rename from cmd/zrok/accessTui.go rename to cmd/zrok2/accessTui.go diff --git a/cmd/zrok/adminBootstrap.go b/cmd/zrok2/adminBootstrap.go similarity index 100% rename from cmd/zrok/adminBootstrap.go rename to cmd/zrok2/adminBootstrap.go diff --git a/cmd/zrok/adminCreateAccount.go b/cmd/zrok2/adminCreateAccount.go similarity index 100% rename from cmd/zrok/adminCreateAccount.go rename to cmd/zrok2/adminCreateAccount.go diff --git a/cmd/zrok/adminCreateFrontend.go b/cmd/zrok2/adminCreateFrontend.go similarity index 100% rename from cmd/zrok/adminCreateFrontend.go rename to cmd/zrok2/adminCreateFrontend.go diff --git a/cmd/zrok/adminCreateFrontendGrant.go b/cmd/zrok2/adminCreateFrontendGrant.go similarity index 100% rename from cmd/zrok/adminCreateFrontendGrant.go rename to cmd/zrok2/adminCreateFrontendGrant.go diff --git a/cmd/zrok/adminCreateIdentity.go b/cmd/zrok2/adminCreateIdentity.go similarity index 100% rename from cmd/zrok/adminCreateIdentity.go rename to cmd/zrok2/adminCreateIdentity.go diff --git a/cmd/zrok/adminCreateNamespace.go b/cmd/zrok2/adminCreateNamespace.go similarity index 100% rename from cmd/zrok/adminCreateNamespace.go rename to cmd/zrok2/adminCreateNamespace.go diff --git a/cmd/zrok/adminCreateNamespaceFrontend.go b/cmd/zrok2/adminCreateNamespaceFrontend.go similarity index 100% rename from cmd/zrok/adminCreateNamespaceFrontend.go rename to cmd/zrok2/adminCreateNamespaceFrontend.go diff --git a/cmd/zrok/adminCreateNamespaceGrant.go b/cmd/zrok2/adminCreateNamespaceGrant.go similarity index 100% rename from cmd/zrok/adminCreateNamespaceGrant.go rename to cmd/zrok2/adminCreateNamespaceGrant.go diff --git a/cmd/zrok/adminCreateOrgMember.go b/cmd/zrok2/adminCreateOrgMember.go similarity index 100% rename from cmd/zrok/adminCreateOrgMember.go rename to cmd/zrok2/adminCreateOrgMember.go diff --git a/cmd/zrok/adminCreateOrganization.go b/cmd/zrok2/adminCreateOrganization.go similarity index 100% rename from cmd/zrok/adminCreateOrganization.go rename to cmd/zrok2/adminCreateOrganization.go diff --git a/cmd/zrok/adminDeleteAccount.go b/cmd/zrok2/adminDeleteAccount.go similarity index 100% rename from cmd/zrok/adminDeleteAccount.go rename to cmd/zrok2/adminDeleteAccount.go diff --git a/cmd/zrok/adminDeleteFrontend.go b/cmd/zrok2/adminDeleteFrontend.go similarity index 100% rename from cmd/zrok/adminDeleteFrontend.go rename to cmd/zrok2/adminDeleteFrontend.go diff --git a/cmd/zrok/adminDeleteFrontendGrant.go b/cmd/zrok2/adminDeleteFrontendGrant.go similarity index 100% rename from cmd/zrok/adminDeleteFrontendGrant.go rename to cmd/zrok2/adminDeleteFrontendGrant.go diff --git a/cmd/zrok/adminDeleteIdentity.go b/cmd/zrok2/adminDeleteIdentity.go similarity index 100% rename from cmd/zrok/adminDeleteIdentity.go rename to cmd/zrok2/adminDeleteIdentity.go diff --git a/cmd/zrok/adminDeleteNamespace.go b/cmd/zrok2/adminDeleteNamespace.go similarity index 100% rename from cmd/zrok/adminDeleteNamespace.go rename to cmd/zrok2/adminDeleteNamespace.go diff --git a/cmd/zrok/adminDeleteNamespaceFrontend.go b/cmd/zrok2/adminDeleteNamespaceFrontend.go similarity index 100% rename from cmd/zrok/adminDeleteNamespaceFrontend.go rename to cmd/zrok2/adminDeleteNamespaceFrontend.go diff --git a/cmd/zrok/adminDeleteNamespaceGrant.go b/cmd/zrok2/adminDeleteNamespaceGrant.go similarity index 100% rename from cmd/zrok/adminDeleteNamespaceGrant.go rename to cmd/zrok2/adminDeleteNamespaceGrant.go diff --git a/cmd/zrok/adminDeleteOrgMember.go b/cmd/zrok2/adminDeleteOrgMember.go similarity index 100% rename from cmd/zrok/adminDeleteOrgMember.go rename to cmd/zrok2/adminDeleteOrgMember.go diff --git a/cmd/zrok/adminDeleteOrganization.go b/cmd/zrok2/adminDeleteOrganization.go similarity index 100% rename from cmd/zrok/adminDeleteOrganization.go rename to cmd/zrok2/adminDeleteOrganization.go diff --git a/cmd/zrok/adminGc.go b/cmd/zrok2/adminGc.go similarity index 100% rename from cmd/zrok/adminGc.go rename to cmd/zrok2/adminGc.go diff --git a/cmd/zrok/adminGenerate.go b/cmd/zrok2/adminGenerate.go similarity index 100% rename from cmd/zrok/adminGenerate.go rename to cmd/zrok2/adminGenerate.go diff --git a/cmd/zrok/adminGrants.go b/cmd/zrok2/adminGrants.go similarity index 100% rename from cmd/zrok/adminGrants.go rename to cmd/zrok2/adminGrants.go diff --git a/cmd/zrok/adminListFrontendNamespace.go b/cmd/zrok2/adminListFrontendNamespace.go similarity index 100% rename from cmd/zrok/adminListFrontendNamespace.go rename to cmd/zrok2/adminListFrontendNamespace.go diff --git a/cmd/zrok/adminListFrontends.go b/cmd/zrok2/adminListFrontends.go similarity index 100% rename from cmd/zrok/adminListFrontends.go rename to cmd/zrok2/adminListFrontends.go diff --git a/cmd/zrok/adminListNamespaceFrontend.go b/cmd/zrok2/adminListNamespaceFrontend.go similarity index 100% rename from cmd/zrok/adminListNamespaceFrontend.go rename to cmd/zrok2/adminListNamespaceFrontend.go diff --git a/cmd/zrok/adminListNamespaces.go b/cmd/zrok2/adminListNamespaces.go similarity index 100% rename from cmd/zrok/adminListNamespaces.go rename to cmd/zrok2/adminListNamespaces.go diff --git a/cmd/zrok/adminListOrgMembers.go b/cmd/zrok2/adminListOrgMembers.go similarity index 100% rename from cmd/zrok/adminListOrgMembers.go rename to cmd/zrok2/adminListOrgMembers.go diff --git a/cmd/zrok/adminListOrganizations.go b/cmd/zrok2/adminListOrganizations.go similarity index 100% rename from cmd/zrok/adminListOrganizations.go rename to cmd/zrok2/adminListOrganizations.go diff --git a/cmd/zrok/adminMigrate.go b/cmd/zrok2/adminMigrate.go similarity index 100% rename from cmd/zrok/adminMigrate.go rename to cmd/zrok2/adminMigrate.go diff --git a/cmd/zrok/adminUnbootstrap.go b/cmd/zrok2/adminUnbootstrap.go similarity index 100% rename from cmd/zrok/adminUnbootstrap.go rename to cmd/zrok2/adminUnbootstrap.go diff --git a/cmd/zrok/adminUpdateFrontend.go b/cmd/zrok2/adminUpdateFrontend.go similarity index 100% rename from cmd/zrok/adminUpdateFrontend.go rename to cmd/zrok2/adminUpdateFrontend.go diff --git a/cmd/zrok/adminUpdateNamespace.go b/cmd/zrok2/adminUpdateNamespace.go similarity index 100% rename from cmd/zrok/adminUpdateNamespace.go rename to cmd/zrok2/adminUpdateNamespace.go diff --git a/cmd/zrok/agentConsole.go b/cmd/zrok2/agentConsole.go similarity index 100% rename from cmd/zrok/agentConsole.go rename to cmd/zrok2/agentConsole.go diff --git a/cmd/zrok/agentEnroll.go b/cmd/zrok2/agentEnroll.go similarity index 94% rename from cmd/zrok/agentEnroll.go rename to cmd/zrok2/agentEnroll.go index 5d98e693..1b727779 100644 --- a/cmd/zrok/agentEnroll.go +++ b/cmd/zrok2/agentEnroll.go @@ -40,7 +40,7 @@ func (cmd *agentEnrollCommand) run(_ *cobra.Command, _ []string) { } if !root.IsEnabled() { - tui.Error("unable to load environment; did you 'zrok enable'?", nil) + tui.Error("unable to load environment; did you 'zrok2 enable'?", nil) } enrlPath, err := root.AgentEnrollment() @@ -50,7 +50,7 @@ func (cmd *agentEnrollCommand) run(_ *cobra.Command, _ []string) { _, err = agent.LoadEnrollment(enrlPath) if err == nil { - tui.Error("agent already enrolled; 'zrok agent unenroll' first", nil) + tui.Error("agent already enrolled; 'zrok2 agent unenroll' first", nil) } if !cmd.headless { diff --git a/cmd/zrok/agentReleaseAccess.go b/cmd/zrok2/agentReleaseAccess.go similarity index 100% rename from cmd/zrok/agentReleaseAccess.go rename to cmd/zrok2/agentReleaseAccess.go diff --git a/cmd/zrok/agentReleaseShare.go b/cmd/zrok2/agentReleaseShare.go similarity index 100% rename from cmd/zrok/agentReleaseShare.go rename to cmd/zrok2/agentReleaseShare.go diff --git a/cmd/zrok/agentShareHttpHealthcheck.go b/cmd/zrok2/agentShareHttpHealthcheck.go similarity index 100% rename from cmd/zrok/agentShareHttpHealthcheck.go rename to cmd/zrok2/agentShareHttpHealthcheck.go diff --git a/cmd/zrok/agentStart.go b/cmd/zrok2/agentStart.go similarity index 95% rename from cmd/zrok/agentStart.go rename to cmd/zrok2/agentStart.go index b06ade57..61622ca4 100644 --- a/cmd/zrok/agentStart.go +++ b/cmd/zrok2/agentStart.go @@ -43,7 +43,7 @@ func (cmd *agentStartCommand) run(_ *cobra.Command, _ []string) { } if !root.IsEnabled() { - tui.Error("unable to load environment; did you 'zrok enable'?", nil) + tui.Error("unable to load environment; did you 'zrok2 enable'?", nil) } cfg := agent.DefaultConfig() diff --git a/cmd/zrok/agentStatus.go b/cmd/zrok2/agentStatus.go similarity index 100% rename from cmd/zrok/agentStatus.go rename to cmd/zrok2/agentStatus.go diff --git a/cmd/zrok/agentUnenroll.go b/cmd/zrok2/agentUnenroll.go similarity index 89% rename from cmd/zrok/agentUnenroll.go rename to cmd/zrok2/agentUnenroll.go index 99f667d5..7673079d 100644 --- a/cmd/zrok/agentUnenroll.go +++ b/cmd/zrok2/agentUnenroll.go @@ -37,7 +37,7 @@ func (cmd *agentUnenrollCommand) run(_ *cobra.Command, _ []string) { } if !root.IsEnabled() { - tui.Error("unable to load environment; did you 'zrok enable'?", nil) + tui.Error("unable to load environment; did you 'zrok2 enable'?", nil) } enrlPath, err := root.AgentEnrollment() @@ -46,12 +46,12 @@ func (cmd *agentUnenrollCommand) run(_ *cobra.Command, _ []string) { } if _, err := os.Stat(enrlPath); os.IsNotExist(err) { - tui.Error("agent not enrolled; use 'zrok agent enroll' to enroll", nil) + tui.Error("agent not enrolled; use 'zrok2 agent enroll' to enroll", nil) } _, err = agent.LoadEnrollment(enrlPath) if err != nil { - tui.Warning("error loading agent enrollment; use 'zrok agent enroll' to enroll", err) + tui.Warning("error loading agent enrollment; use 'zrok2 agent enroll' to enroll", err) } zrok, err := root.Client() diff --git a/cmd/zrok/agentVersion.go b/cmd/zrok2/agentVersion.go similarity index 100% rename from cmd/zrok/agentVersion.go rename to cmd/zrok2/agentVersion.go diff --git a/cmd/zrok/browser_darwin.go b/cmd/zrok2/browser_darwin.go similarity index 100% rename from cmd/zrok/browser_darwin.go rename to cmd/zrok2/browser_darwin.go diff --git a/cmd/zrok/browser_linux.go b/cmd/zrok2/browser_linux.go similarity index 100% rename from cmd/zrok/browser_linux.go rename to cmd/zrok2/browser_linux.go diff --git a/cmd/zrok/browser_windows.go b/cmd/zrok2/browser_windows.go similarity index 100% rename from cmd/zrok/browser_windows.go rename to cmd/zrok2/browser_windows.go diff --git a/cmd/zrok/configGet.go b/cmd/zrok2/configGet.go similarity index 91% rename from cmd/zrok/configGet.go rename to cmd/zrok2/configGet.go index dc63ecc3..025f15b7 100644 --- a/cmd/zrok/configGet.go +++ b/cmd/zrok2/configGet.go @@ -19,7 +19,7 @@ func newConfigGetCommand() *configGetCommand { cmd := &cobra.Command{ Use: "get ", Short: "Get a value from the environment config", - Long: "Get a value from the environment config. Use 'zrok status' to list available configuration names and current values.", + Long: "Get a value from the environment config. Use 'zrok2 status' to list available configuration names and current values.", Args: cobra.ExactArgs(1), } command := &configGetCommand{cmd: cmd} diff --git a/cmd/zrok/configSet.go b/cmd/zrok2/configSet.go similarity index 94% rename from cmd/zrok/configSet.go rename to cmd/zrok2/configSet.go index 0ea43bd7..a1cc7c13 100644 --- a/cmd/zrok/configSet.go +++ b/cmd/zrok2/configSet.go @@ -24,7 +24,7 @@ func newConfigSetCommand() *configSetCommand { cmd := &cobra.Command{ Use: "set ", Short: "Set a value into the environment config", - Long: "Set a value into the environment config. Use 'zrok status' to list available configuration names and current values.", + Long: "Set a value into the environment config. Use 'zrok2 status' to list available configuration names and current values.", Args: cobra.ExactArgs(2), } command := &configSetCommand{cmd: cmd} @@ -63,7 +63,7 @@ func (cmd *configSetCommand) run(_ *cobra.Command, args []string) { } fmt.Println("zrok configuration updated") if env.IsEnabled() { - fmt.Printf("\n[%v]: because you have a %v-d environment, you won't see your config change until you run %v first!\n\n", tui.WarningLabel, tui.Code.Render("zrok enable"), tui.Code.Render("zrok disable")) + fmt.Printf("\n[%v]: because you have a %v-d environment, you won't see your config change until you run %v first!\n\n", tui.WarningLabel, tui.Code.Render("zrok2 enable"), tui.Code.Render("zrok2 disable")) } case "defaultNamespace": diff --git a/cmd/zrok/configUnset.go b/cmd/zrok2/configUnset.go similarity index 94% rename from cmd/zrok/configUnset.go rename to cmd/zrok2/configUnset.go index 3ffc3762..66a5bc11 100644 --- a/cmd/zrok/configUnset.go +++ b/cmd/zrok2/configUnset.go @@ -42,7 +42,7 @@ func (cmd *configUnsetCommand) run(_ *cobra.Command, args []string) { case "apiEndpoint": cfg.ApiEndpoint = "" if env.IsEnabled() { - fmt.Printf("\n[%v]: because you have a %v-d environment, you won't see your config change until you run %v first!\n\n", tui.WarningLabel, tui.Code.Render("zrok enable"), tui.Code.Render("zrok disable")) + fmt.Printf("\n[%v]: because you have a %v-d environment, you won't see your config change until you run %v first!\n\n", tui.WarningLabel, tui.Code.Render("zrok2 enable"), tui.Code.Render("zrok2 disable")) } case "defaultNamespace": diff --git a/cmd/zrok/console.go b/cmd/zrok2/console.go similarity index 100% rename from cmd/zrok/console.go rename to cmd/zrok2/console.go diff --git a/cmd/zrok/controller.go b/cmd/zrok2/controller.go similarity index 100% rename from cmd/zrok/controller.go rename to cmd/zrok2/controller.go diff --git a/cmd/zrok/controllerMetricsBridge.go b/cmd/zrok2/controllerMetricsBridge.go similarity index 100% rename from cmd/zrok/controllerMetricsBridge.go rename to cmd/zrok2/controllerMetricsBridge.go diff --git a/cmd/zrok/controllerValidate.go b/cmd/zrok2/controllerValidate.go similarity index 100% rename from cmd/zrok/controllerValidate.go rename to cmd/zrok2/controllerValidate.go diff --git a/cmd/zrok/copy.go b/cmd/zrok2/copy.go similarity index 98% rename from cmd/zrok/copy.go rename to cmd/zrok2/copy.go index f56275c9..dc269fed 100644 --- a/cmd/zrok/copy.go +++ b/cmd/zrok2/copy.go @@ -37,7 +37,7 @@ func newCopyCommand() *copyCommand { func (cmd *copyCommand) run(_ *cobra.Command, args []string) { if cmd.basicAuth == "" { - cmd.basicAuth = os.Getenv("ZROK_DRIVES_BASIC_AUTH") + cmd.basicAuth = os.Getenv("ZROK2_DRIVES_BASIC_AUTH") } sourceUrl, err := url.Parse(args[0]) diff --git a/cmd/zrok/createName.go b/cmd/zrok2/createName.go similarity index 100% rename from cmd/zrok/createName.go rename to cmd/zrok2/createName.go diff --git a/cmd/zrok/deleteEnvironment.go b/cmd/zrok2/deleteEnvironment.go similarity index 87% rename from cmd/zrok/deleteEnvironment.go rename to cmd/zrok2/deleteEnvironment.go index b1d7ccf7..0a31d6d4 100644 --- a/cmd/zrok/deleteEnvironment.go +++ b/cmd/zrok2/deleteEnvironment.go @@ -29,7 +29,7 @@ func newDeleteEnvironmentCommand() *deleteEnvironmentCommand { Args: cobra.ExactArgs(1), Long: `Delete a zrok environment other than your current environment. -If you want to delete your current environment, use 'zrok disable' instead, +If you want to delete your current environment, use 'zrok2 disable' instead, which will also clean up local configuration files. This command requires a local environment to determine the API endpoint. @@ -37,9 +37,9 @@ By default, it uses the local environment's account token for authentication. Use --account-token to authenticate as a different account. Examples: - zrok delete environment abc123def456 - zrok delete environment abc123def456 --force - zrok delete environment abc123def456 --account-token your-token-here + zrok2 delete environment abc123def456 + zrok2 delete environment abc123def456 --force + zrok2 delete environment abc123def456 --account-token your-token-here `, } command := &deleteEnvironmentCommand{cmd: cmd} @@ -64,9 +64,9 @@ func (cmd *deleteEnvironmentCommand) run(_ *cobra.Command, args []string) { // if we have an enabled environment, check if user is trying to delete it if env.IsEnabled() && env.Environment().ZitiIdentity == envZIdToDelete { if !panicInstead { - tui.Error("cannot delete current environment", fmt.Errorf("you are trying to delete your current environment; use 'zrok disable' instead to properly clean up local files")) + tui.Error("cannot delete current environment", fmt.Errorf("you are trying to delete your current environment; use 'zrok2 disable' instead to properly clean up local files")) } - panic("cannot delete current environment; use 'zrok disable' instead") + panic("cannot delete current environment; use 'zrok2 disable' instead") } // confirmation prompt (unless --force is used) diff --git a/cmd/zrok/deleteName.go b/cmd/zrok2/deleteName.go similarity index 100% rename from cmd/zrok/deleteName.go rename to cmd/zrok2/deleteName.go diff --git a/cmd/zrok/disable.go b/cmd/zrok2/disable.go similarity index 100% rename from cmd/zrok/disable.go rename to cmd/zrok2/disable.go diff --git a/cmd/zrok/enable.go b/cmd/zrok2/enable.go similarity index 96% rename from cmd/zrok/enable.go rename to cmd/zrok2/enable.go index ec99c7e2..fa2145d8 100644 --- a/cmd/zrok/enable.go +++ b/cmd/zrok2/enable.go @@ -48,7 +48,7 @@ func (cmd *enableCommand) run(_ *cobra.Command, args []string) { token := args[0] if env.IsEnabled() { - tui.Error(fmt.Sprintf("you already have an enabled environment, %v first before you %v", tui.Code.Render("zrok disable"), tui.Code.Render("zrok enable")), nil) + tui.Error(fmt.Sprintf("you already have an enabled environment, %v first before you %v", tui.Code.Render("zrok2 disable"), tui.Code.Render("zrok2 enable")), nil) } hostName, hostDetail, username, err := util.GetHostDetails() @@ -151,7 +151,7 @@ func (cmd *enableCommand) endpointError(apiEndpoint, _ string) { fmt.Printf("%v\n\n", tui.SeriousBusiness.Render("there was a problem enabling your environment!")) fmt.Printf("you are trying to use the zrok service at: %v\n\n", tui.Code.Render(apiEndpoint)) fmt.Printf("you can change your zrok service endpoint using this command:\n\n") - fmt.Printf("%v\n\n", tui.Code.Render("$ zrok config set apiEndpoint ")) + fmt.Printf("%v\n\n", tui.Code.Render("$ zrok2 config set apiEndpoint ")) fmt.Printf("(where newEndpoint is something like: %v)\n\n", tui.Code.Render("https://some.zrok.io")) } diff --git a/cmd/zrok/endpointUi/embed.go b/cmd/zrok2/endpointUi/embed.go similarity index 100% rename from cmd/zrok/endpointUi/embed.go rename to cmd/zrok2/endpointUi/embed.go diff --git a/cmd/zrok/endpointUi/index.gohtml b/cmd/zrok2/endpointUi/index.gohtml similarity index 100% rename from cmd/zrok/endpointUi/index.gohtml rename to cmd/zrok2/endpointUi/index.gohtml diff --git a/cmd/zrok/invite.go b/cmd/zrok2/invite.go similarity index 98% rename from cmd/zrok/invite.go rename to cmd/zrok2/invite.go index a9ddaab3..f206167f 100644 --- a/cmd/zrok/invite.go +++ b/cmd/zrok2/invite.go @@ -95,7 +95,7 @@ func (cmd *inviteCommand) endpointError(apiEndpoint, _ string) { fmt.Printf("%v\n\n", tui.SeriousBusiness.Render("there was a problem creating an invitation!")) fmt.Printf("you are trying to use the zrok service at: %v\n\n", tui.Code.Render(apiEndpoint)) fmt.Printf("you can change your zrok service endpoint using this command:\n\n") - fmt.Printf("%v\n\n", tui.Code.Render("$ zrok config set apiEndpoint ")) + fmt.Printf("%v\n\n", tui.Code.Render("$ zrok2 config set apiEndpoint ")) fmt.Printf("(where newEndpoint is something like: %v)\n\n", tui.Code.Render("https://some.zrok.io")) } diff --git a/cmd/zrok/listAccesses.go b/cmd/zrok2/listAccesses.go similarity index 100% rename from cmd/zrok/listAccesses.go rename to cmd/zrok2/listAccesses.go diff --git a/cmd/zrok/listEnvironments.go b/cmd/zrok2/listEnvironments.go similarity index 100% rename from cmd/zrok/listEnvironments.go rename to cmd/zrok2/listEnvironments.go diff --git a/cmd/zrok/listNames.go b/cmd/zrok2/listNames.go similarity index 100% rename from cmd/zrok/listNames.go rename to cmd/zrok2/listNames.go diff --git a/cmd/zrok/listNamespaces.go b/cmd/zrok2/listNamespaces.go similarity index 100% rename from cmd/zrok/listNamespaces.go rename to cmd/zrok2/listNamespaces.go diff --git a/cmd/zrok/listShares.go b/cmd/zrok2/listShares.go similarity index 100% rename from cmd/zrok/listShares.go rename to cmd/zrok2/listShares.go diff --git a/cmd/zrok/ls.go b/cmd/zrok2/ls.go similarity index 97% rename from cmd/zrok/ls.go rename to cmd/zrok2/ls.go index 31c01b8a..b0ea6516 100644 --- a/cmd/zrok/ls.go +++ b/cmd/zrok2/ls.go @@ -40,7 +40,7 @@ func newLsCommand() *lsCommand { func (cmd *lsCommand) run(_ *cobra.Command, args []string) { if cmd.basicAuth == "" { - cmd.basicAuth = os.Getenv("ZROK_DRIVES_BASIC_AUTH") + cmd.basicAuth = os.Getenv("ZROK2_DRIVES_BASIC_AUTH") } targetUrl, err := url.Parse(args[0]) diff --git a/cmd/zrok/main.go b/cmd/zrok2/main.go similarity index 97% rename from cmd/zrok/main.go rename to cmd/zrok2/main.go index 06a900f0..4879410b 100644 --- a/cmd/zrok/main.go +++ b/cmd/zrok2/main.go @@ -57,7 +57,7 @@ func init() { var rootCmd = &cobra.Command{ Use: strings.TrimSuffix(filepath.Base(os.Args[0]), filepath.Ext(os.Args[0])), - Short: "zrok", + Short: "zrok2", PersistentPreRun: func(_ *cobra.Command, _ []string) { if verbose { dl.Init(dl.DefaultOptions().SetTrimPrefix(trimPrefix).SetLevel(slog.LevelInfo)) @@ -100,18 +100,18 @@ var adminUpdateCmd = &cobra.Command{ var agentCmd = &cobra.Command{ Use: "agent", - Short: "zrok Agent commands", + Short: "zrok2 Agent commands", Aliases: []string{"daemon"}, } var agentReleaseCmd = &cobra.Command{ Use: "release", - Short: "zrok Agent release commands", + Short: "zrok2 Agent release commands", } var agentShareCmd = &cobra.Command{ Use: "share", - Short: "zrok Agent share commands", + Short: "zrok2 Agent share commands", } var configCmd = &cobra.Command{ diff --git a/cmd/zrok/md.go b/cmd/zrok2/md.go similarity index 96% rename from cmd/zrok/md.go rename to cmd/zrok2/md.go index db089b58..f8ac2231 100644 --- a/cmd/zrok/md.go +++ b/cmd/zrok2/md.go @@ -37,7 +37,7 @@ func newMdCommand() *mdCommand { func (cmd *mdCommand) run(_ *cobra.Command, args []string) { if cmd.basicAuth == "" { - cmd.basicAuth = os.Getenv("ZROK_DRIVES_BASIC_AUTH") + cmd.basicAuth = os.Getenv("ZROK2_DRIVES_BASIC_AUTH") } targetUrl, err := url.Parse(args[0]) diff --git a/cmd/zrok/modifyName.go b/cmd/zrok2/modifyName.go similarity index 96% rename from cmd/zrok/modifyName.go rename to cmd/zrok2/modifyName.go index d66c8e50..8ee3b57f 100644 --- a/cmd/zrok/modifyName.go +++ b/cmd/zrok2/modifyName.go @@ -51,7 +51,7 @@ func (cmd *modifyNameCommand) run(_ *cobra.Command, args []string) { } if !root.IsEnabled() { - tui.Error("unable to load environment; did you 'zrok enable'?", nil) + tui.Error("unable to load environment; did you 'zrok2 enable'?", nil) } zrok, err := root.Client() diff --git a/cmd/zrok/modifyShare.go b/cmd/zrok2/modifyShare.go similarity index 96% rename from cmd/zrok/modifyShare.go rename to cmd/zrok2/modifyShare.go index a91516bf..c2532338 100644 --- a/cmd/zrok/modifyShare.go +++ b/cmd/zrok2/modifyShare.go @@ -44,7 +44,7 @@ func (cmd *modifyShareCommand) run(_ *cobra.Command, args []string) { } if !root.IsEnabled() { - tui.Error("unable to load environment; did you 'zrok enable'?", nil) + tui.Error("unable to load environment; did you 'zrok2 enable'?", nil) } zrok, err := root.Client() diff --git a/cmd/zrok/mv.go b/cmd/zrok2/mv.go similarity index 96% rename from cmd/zrok/mv.go rename to cmd/zrok2/mv.go index 1291820e..dd17c22d 100644 --- a/cmd/zrok/mv.go +++ b/cmd/zrok2/mv.go @@ -37,7 +37,7 @@ func newMvCommand() *mvCommand { func (cmd *mvCommand) run(_ *cobra.Command, args []string) { if cmd.basicAuth == "" { - cmd.basicAuth = os.Getenv("ZROK_DRIVES_BASIC_AUTH") + cmd.basicAuth = os.Getenv("ZROK2_DRIVES_BASIC_AUTH") } targetUrl, err := url.Parse(args[0]) diff --git a/cmd/zrok/orgAdminList.go b/cmd/zrok2/orgAdminList.go similarity index 95% rename from cmd/zrok/orgAdminList.go rename to cmd/zrok2/orgAdminList.go index db1753ea..7168b290 100644 --- a/cmd/zrok/orgAdminList.go +++ b/cmd/zrok2/orgAdminList.go @@ -40,7 +40,7 @@ func (c *orgAdminListCommand) run(_ *cobra.Command, args []string) { } if !root.IsEnabled() { - tui.Error("unable to load environment; did you 'zrok enable'?", nil) + tui.Error("unable to load environment; did you 'zrok2 enable'?", nil) } zrok, err := root.Client() diff --git a/cmd/zrok/orgAdminOverview.go b/cmd/zrok2/orgAdminOverview.go similarity index 95% rename from cmd/zrok/orgAdminOverview.go rename to cmd/zrok2/orgAdminOverview.go index c6cb4bd1..4aa7635e 100644 --- a/cmd/zrok/orgAdminOverview.go +++ b/cmd/zrok2/orgAdminOverview.go @@ -39,7 +39,7 @@ func (cmd *orgAdminOverviewCommand) run(_ *cobra.Command, args []string) { } if !root.IsEnabled() { - tui.Error("unable to load environment; did you 'zrok enable'?", nil) + tui.Error("unable to load environment; did you 'zrok2 enable'?", nil) } client := &http.Client{} diff --git a/cmd/zrok/orgMemberships.go b/cmd/zrok2/orgMemberships.go similarity index 95% rename from cmd/zrok/orgMemberships.go rename to cmd/zrok2/orgMemberships.go index 872f4107..c9a204b7 100644 --- a/cmd/zrok/orgMemberships.go +++ b/cmd/zrok2/orgMemberships.go @@ -40,7 +40,7 @@ func (c *orgMembershipsCommand) run(_ *cobra.Command, _ []string) { } if !root.IsEnabled() { - tui.Error("unable to load environment; did you 'zrok enable'?", nil) + tui.Error("unable to load environment; did you 'zrok2 enable'?", nil) } zrok, err := root.Client() diff --git a/cmd/zrok/overview.go b/cmd/zrok2/overview.go similarity index 98% rename from cmd/zrok/overview.go rename to cmd/zrok2/overview.go index bb37a1a9..c03dca3f 100644 --- a/cmd/zrok/overview.go +++ b/cmd/zrok2/overview.go @@ -228,7 +228,7 @@ func (cmd *overviewCommand) run(_ *cobra.Command, _ []string) { if len(overview.Environments) == 0 && len(overview.Names) == 0 && len(overview.Namespaces) == 0 { fmt.Println("No environments, namespaces, or names found.") - fmt.Println("Run 'zrok enable' to set up your first environment.") + fmt.Println("Run 'zrok2 enable' to set up your first environment.") fmt.Println() } } diff --git a/cmd/zrok/rebaseAccountToken.go b/cmd/zrok2/rebaseAccountToken.go similarity index 95% rename from cmd/zrok/rebaseAccountToken.go rename to cmd/zrok2/rebaseAccountToken.go index 836517d7..50d413db 100644 --- a/cmd/zrok/rebaseAccountToken.go +++ b/cmd/zrok2/rebaseAccountToken.go @@ -35,7 +35,7 @@ func (cmd *rebaseAccountTokenCommand) run(_ *cobra.Command, args []string) { } if !root.IsEnabled() { - tui.Error("environment not enabled; 'zrok enable' your environment instead", nil) + tui.Error("environment not enabled; 'zrok2 enable' your environment instead", nil) } env := root.Environment() diff --git a/cmd/zrok/rebaseApiEndpoint.go b/cmd/zrok2/rebaseApiEndpoint.go similarity index 95% rename from cmd/zrok/rebaseApiEndpoint.go rename to cmd/zrok2/rebaseApiEndpoint.go index 16672d8b..1e1eedb5 100644 --- a/cmd/zrok/rebaseApiEndpoint.go +++ b/cmd/zrok2/rebaseApiEndpoint.go @@ -35,7 +35,7 @@ func (cmd *rebaseApiEndpointCommand) run(_ *cobra.Command, args []string) { } if !root.IsEnabled() { - tui.Error("environment not enabled; 'zrok enable' your environment instead", nil) + tui.Error("environment not enabled; 'zrok2 enable' your environment instead", nil) } currentEndpoint, _ := root.ApiEndpoint() diff --git a/cmd/zrok/rm.go b/cmd/zrok2/rm.go similarity index 96% rename from cmd/zrok/rm.go rename to cmd/zrok2/rm.go index 8588c33c..8b1c389e 100644 --- a/cmd/zrok/rm.go +++ b/cmd/zrok2/rm.go @@ -37,7 +37,7 @@ func newRmCommand() *rmCommand { func (cmd *rmCommand) run(_ *cobra.Command, args []string) { if cmd.basicAuth == "" { - cmd.basicAuth = os.Getenv("ZROK_DRIVES_BASIC_AUTH") + cmd.basicAuth = os.Getenv("ZROK2_DRIVES_BASIC_AUTH") } targetUrl, err := url.Parse(args[0]) diff --git a/cmd/zrok/sharePrivate.go b/cmd/zrok2/sharePrivate.go similarity index 98% rename from cmd/zrok/sharePrivate.go rename to cmd/zrok2/sharePrivate.go index 50310240..b007326d 100644 --- a/cmd/zrok/sharePrivate.go +++ b/cmd/zrok2/sharePrivate.go @@ -15,7 +15,7 @@ import ( "github.com/michaelquigley/df/dl" "github.com/openziti/zrok/v2/agent/agentClient" "github.com/openziti/zrok/v2/agent/agentGrpc" - "github.com/openziti/zrok/v2/cmd/zrok/subordinate" + "github.com/openziti/zrok/v2/cmd/zrok2/subordinate" "github.com/openziti/zrok/v2/endpoints" "github.com/openziti/zrok/v2/endpoints/drive" "github.com/openziti/zrok/v2/endpoints/proxy" @@ -88,7 +88,7 @@ func (cmd *sharePrivateCommand) run(_ *cobra.Command, args []string) { } if !root.IsEnabled() { - tui.Error("unable to load environment; did you 'zrok enable'?", nil) + tui.Error("unable to load environment; did you 'zrok2 enable'?", nil) } detectAndRouteToAgent( @@ -133,7 +133,7 @@ func (cmd *sharePrivateCommand) shareLocal(args []string, root env_core.Root) { cmd.error("unable to create share", err) } - shareDescription := fmt.Sprintf("access your share with: %v", tui.Code.Render(fmt.Sprintf("zrok access private %v", shr.Token))) + shareDescription := fmt.Sprintf("access your share with: %v", tui.Code.Render(fmt.Sprintf("zrok2 access private %v", shr.Token))) mdl := newShareModel(shr.Token, []string{shareDescription}, sdk.PrivateShareMode, sdk.BackendMode(cmd.backendMode)) if !cmd.headless && !cmd.subordinate { proxy.SetCaddyLoggingWriter(mdl) @@ -305,7 +305,7 @@ func (cmd *sharePrivateCommand) shareLocal(args []string, root env_core.Root) { } if cmd.headless && !cmd.subordinate { - dl.Infof("allow other to access your share with the following command:\nzrok access private %v", shr.Token) + dl.Infof("allow other to access your share with the following command:\nzrok2 access private %v", shr.Token) for { select { case req := <-requests: diff --git a/cmd/zrok/sharePublic.go b/cmd/zrok2/sharePublic.go similarity index 99% rename from cmd/zrok/sharePublic.go rename to cmd/zrok2/sharePublic.go index 8d6c882b..3441cf76 100644 --- a/cmd/zrok/sharePublic.go +++ b/cmd/zrok2/sharePublic.go @@ -17,7 +17,7 @@ import ( "github.com/michaelquigley/df/dl" "github.com/openziti/zrok/v2/agent/agentClient" "github.com/openziti/zrok/v2/agent/agentGrpc" - "github.com/openziti/zrok/v2/cmd/zrok/subordinate" + "github.com/openziti/zrok/v2/cmd/zrok2/subordinate" "github.com/openziti/zrok/v2/endpoints" "github.com/openziti/zrok/v2/endpoints/drive" "github.com/openziti/zrok/v2/endpoints/proxy" @@ -102,7 +102,7 @@ func (cmd *sharePublicCommand) run(_ *cobra.Command, args []string) { } if !root.IsEnabled() { - cmd.error("unable to create share", errors.New("unable to load environment; did you 'zrok enable'?")) + cmd.error("unable to create share", errors.New("unable to load environment; did you 'zrok2 enable'?")) } detectAndRouteToAgent( diff --git a/cmd/zrok/shareTui.go b/cmd/zrok2/shareTui.go similarity index 100% rename from cmd/zrok/shareTui.go rename to cmd/zrok2/shareTui.go diff --git a/cmd/zrok/status.go b/cmd/zrok2/status.go similarity index 96% rename from cmd/zrok/status.go rename to cmd/zrok2/status.go index 633cb95a..732086a7 100644 --- a/cmd/zrok/status.go +++ b/cmd/zrok2/status.go @@ -41,7 +41,7 @@ func (cmd *statusCommand) run(_ *cobra.Command, _ []string) { } if !environment.IsLatest(env) { - tui.Warning(fmt.Sprintf("Your environment is out of date ('%v'), use '%v' to update (make a backup before updating!)\n", env.Metadata().V, tui.Code.Render("zrok update"))) + tui.Warning(fmt.Sprintf("Your environment is out of date ('%v'), use '%v' to update (make a backup before updating!)\n", env.Metadata().V, tui.Code.Render("zrok2 update"))) } _, _ = fmt.Fprintln(os.Stdout, tui.Code.Render("Config")+":\n") @@ -61,7 +61,7 @@ func (cmd *statusCommand) run(_ *cobra.Command, _ []string) { _, _ = fmt.Fprintf(os.Stderr, "\n") if !env.IsEnabled() { - _, _ = fmt.Fprintf(os.Stderr, "To create a local environment use the %v command.\n", tui.Code.Render("zrok enable")) + _, _ = fmt.Fprintf(os.Stderr, "To create a local environment use the %v command.\n", tui.Code.Render("zrok2 enable")) } else { _, _ = fmt.Fprintln(os.Stdout, tui.Code.Render("Environment")+":\n") diff --git a/cmd/zrok/subordinate/message.go b/cmd/zrok2/subordinate/message.go similarity index 100% rename from cmd/zrok/subordinate/message.go rename to cmd/zrok2/subordinate/message.go diff --git a/cmd/zrok/testCanaryEnabler.go b/cmd/zrok2/testCanaryEnabler.go similarity index 100% rename from cmd/zrok/testCanaryEnabler.go rename to cmd/zrok2/testCanaryEnabler.go diff --git a/cmd/zrok/testCanaryPrivateProxy.go b/cmd/zrok2/testCanaryPrivateProxy.go similarity index 98% rename from cmd/zrok/testCanaryPrivateProxy.go rename to cmd/zrok2/testCanaryPrivateProxy.go index b539c14a..d16c9f59 100644 --- a/cmd/zrok/testCanaryPrivateProxy.go +++ b/cmd/zrok2/testCanaryPrivateProxy.go @@ -90,7 +90,7 @@ func (cmd *testCanaryPrivateProxy) run(_ *cobra.Command, _ []string) { } if !root.IsEnabled() { - dl.Fatal("unable to load environment; did you 'zrok enable'?") + dl.Fatal("unable to load environment; did you 'zrok2 enable'?") } var sns *canary.SnapshotStreamer diff --git a/cmd/zrok/testCanaryPublicProxy.go b/cmd/zrok2/testCanaryPublicProxy.go similarity index 98% rename from cmd/zrok/testCanaryPublicProxy.go rename to cmd/zrok2/testCanaryPublicProxy.go index b0d418d1..d87d8bd6 100644 --- a/cmd/zrok/testCanaryPublicProxy.go +++ b/cmd/zrok2/testCanaryPublicProxy.go @@ -90,7 +90,7 @@ func (cmd *testCanaryPublicProxy) run(_ *cobra.Command, _ []string) { } if !root.IsEnabled() { - dl.Fatal("unable to load environment; did you 'zrok enable'?") + dl.Fatal("unable to load environment; did you 'zrok2 enable'?") } var sns *canary.SnapshotStreamer diff --git a/cmd/zrok/testEndpoint.go b/cmd/zrok2/testEndpoint.go similarity index 99% rename from cmd/zrok/testEndpoint.go rename to cmd/zrok2/testEndpoint.go index 51c294cf..5b990d94 100644 --- a/cmd/zrok/testEndpoint.go +++ b/cmd/zrok2/testEndpoint.go @@ -14,7 +14,7 @@ import ( "github.com/michaelquigley/df/dl" "github.com/openziti/sdk-golang/ziti" - "github.com/openziti/zrok/v2/cmd/zrok/endpointUi" + "github.com/openziti/zrok/v2/cmd/zrok2/endpointUi" "github.com/openziti/zrok/v2/tui" "github.com/openziti/zrok/v2/util" "github.com/pkg/errors" diff --git a/cmd/zrok/unshare.go b/cmd/zrok2/unshare.go similarity index 100% rename from cmd/zrok/unshare.go rename to cmd/zrok2/unshare.go diff --git a/cmd/zrok/update.go b/cmd/zrok2/update.go similarity index 100% rename from cmd/zrok/update.go rename to cmd/zrok2/update.go diff --git a/cmd/zrok/util.go b/cmd/zrok2/util.go similarity index 97% rename from cmd/zrok/util.go rename to cmd/zrok2/util.go index c8a91c7f..887588c6 100644 --- a/cmd/zrok/util.go +++ b/cmd/zrok2/util.go @@ -12,7 +12,7 @@ import ( "github.com/go-openapi/runtime" httptransport "github.com/go-openapi/runtime/client" "github.com/openziti/zrok/v2/agent/agentClient" - "github.com/openziti/zrok/v2/cmd/zrok/subordinate" + "github.com/openziti/zrok/v2/cmd/zrok2/subordinate" "github.com/openziti/zrok/v2/environment" "github.com/openziti/zrok/v2/environment/env_core" "github.com/openziti/zrok/v2/tui" @@ -20,9 +20,9 @@ import ( ) func mustGetAdminAuth() runtime.ClientAuthInfoWriter { - adminToken := os.Getenv("ZROK_ADMIN_TOKEN") + adminToken := os.Getenv("ZROK2_ADMIN_TOKEN") if adminToken == "" { - panic("please set ZROK_ADMIN_TOKEN to a valid admin token for your zrok instance") + panic("please set ZROK2_ADMIN_TOKEN to a valid admin token for your zrok instance") } return httptransport.APIKeyAuth("X-TOKEN", "header", adminToken) } @@ -33,7 +33,7 @@ func mustGetEnvironmentAuth() (env_core.Root, runtime.ClientAuthInfoWriter) { panic(err) } if !env.IsEnabled() { - panic("environment is not enabled; run 'zrok enable' first") + panic("environment is not enabled; run 'zrok2 enable' first") } auth := httptransport.APIKeyAuth("X-TOKEN", "header", env.Environment().AccountToken) return env, auth diff --git a/cmd/zrok/version.go b/cmd/zrok2/version.go similarity index 100% rename from cmd/zrok/version.go rename to cmd/zrok2/version.go diff --git a/controller/config/config.go b/controller/config/config.go index 1964ebe3..6982cb5d 100644 --- a/controller/config/config.go +++ b/controller/config/config.go @@ -158,7 +158,7 @@ func (cfg *CompatibilityConfig) GetCompiledPatterns() []*regexp.Regexp { } func envVersionOk() bool { - vStr := os.Getenv("ZROK_CTRL_CONFIG_VERSION") + vStr := os.Getenv("ZROK2_CTRL_CONFIG_VERSION") if vStr != "" { envV, err := strconv.Atoi(vStr) if err != nil { diff --git a/docker/images/cross-build/linux-build.sh b/docker/images/cross-build/linux-build.sh index 743aea9e..473bfa24 100755 --- a/docker/images/cross-build/linux-build.sh +++ b/docker/images/cross-build/linux-build.sh @@ -60,7 +60,7 @@ fi for ARCH in "${JOBS[@]}"; do LDFLAGS="-s -w -X 'github.com/openziti/zrok/v2/build.Version=${VERSION}' -X 'github.com/openziti/zrok/v2/build.Hash=${HASH}'" GOOS=linux GOARCH=$(resolveArch "${ARCH}") \ - go build -o "./dist/$(resolveArch "${ARCH}")/linux/zrok" \ + go build -o "./dist/$(resolveArch "${ARCH}")/linux/zrok2" \ -ldflags "${LDFLAGS}" \ ./cmd/zrok done diff --git a/docker/images/zrok/Dockerfile b/docker/images/zrok/Dockerfile index 7c9039ac..5cb50612 100644 --- a/docker/images/zrok/Dockerfile +++ b/docker/images/zrok/Dockerfile @@ -8,13 +8,13 @@ ARG TARGETOS # e.g. arm64 ARG TARGETARCH -### Required OpenShift Labels -LABEL name="openziti/zrok" \ +### Required OpenShift Labels +LABEL name="openziti/zrok2" \ maintainer="support@zrok.io" \ vendor="NetFoundry" \ - summary="Run the zrok CLI" \ - description="Run the zrok CLI" \ - org.opencontainers.image.description="Run the zrok CLI" \ + summary="Run the zrok2 CLI" \ + description="Run the zrok2 CLI" \ + org.opencontainers.image.description="Run the zrok2 CLI" \ org.opencontainers.image.source="https://github.com/openziti/zrok" USER root @@ -24,10 +24,10 @@ RUN mkdir -p -m0755 /licenses COPY ./LICENSE /licenses/apache.txt RUN mkdir -p /usr/local/bin -COPY --chmod=0755 ${ARTIFACTS_DIR}/${TARGETARCH}/${TARGETOS}/zrok \ - ./nfpm/zrok-enable.bash \ - ./nfpm/zrok-share.bash \ +COPY --chmod=0755 ${ARTIFACTS_DIR}/${TARGETARCH}/${TARGETOS}/zrok2 \ + ./nfpm/zrok2-enable.bash \ + ./nfpm/zrok2-share.bash \ /usr/local/bin/ USER ziggy -ENTRYPOINT [ "zrok" ] +ENTRYPOINT [ "zrok2" ] diff --git a/endpoints/proxyUi/template.go b/endpoints/proxyUi/template.go index c43abddf..9081d6df 100644 --- a/endpoints/proxyUi/template.go +++ b/endpoints/proxyUi/template.go @@ -69,7 +69,7 @@ func NotFoundData(shareToken string) VariableData { return RequiredData( fmt.Sprintf("'%v' not found!", shareToken), fmt.Sprintf("share %v not found!", shareToken), - ).WithMessage(fmt.Sprintf("are you running zrok share for this share?")) + ).WithMessage(fmt.Sprintf("are you running zrok2 share for this share?")) } func WriteNotFound(w http.ResponseWriter, variableData VariableData) { diff --git a/environment/api.go b/environment/api.go index c6604fa6..f158e808 100644 --- a/environment/api.go +++ b/environment/api.go @@ -2,7 +2,6 @@ package environment import ( "github.com/openziti/zrok/v2/environment/env_core" - "github.com/openziti/zrok/v2/environment/env_v0_3" "github.com/openziti/zrok/v2/environment/env_v0_4" "github.com/pkg/errors" ) @@ -16,11 +15,8 @@ func SetRootDirName(name string) { func LoadRoot() (env_core.Root, error) { if assert, err := env_v0_4.Assert(); assert && err == nil { return env_v0_4.Load() - } else if assert, err := env_v0_3.Assert(); assert && err == nil { - return env_v0_3.Load() - } else { - return env_v0_4.Default() } + return env_v0_4.Default() } func IsLatest(r env_core.Root) bool { diff --git a/environment/env_v0_3/api.go b/environment/env_v0_3/api.go deleted file mode 100644 index d67f9b48..00000000 --- a/environment/env_v0_3/api.go +++ /dev/null @@ -1,238 +0,0 @@ -package env_v0_3 - -import ( - "net/url" - "os" - "path/filepath" - "strconv" - - "github.com/go-openapi/runtime" - httptransport "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" - "github.com/openziti/zrok/v2/build" - "github.com/openziti/zrok/v2/environment/env_core" - "github.com/openziti/zrok/v2/rest_client_zrok" - metadata2 "github.com/openziti/zrok/v2/rest_client_zrok/metadata" - "github.com/pkg/errors" -) - -func (r *Root) Metadata() *env_core.Metadata { - return r.meta -} - -func (r *Root) HasConfig() (bool, error) { - return r.cfg != nil, nil -} - -func (r *Root) Config() *env_core.Config { - return r.cfg -} - -func (r *Root) SetConfig(cfg *env_core.Config) error { - if err := assertMetadata(); err != nil { - return err - } - if err := saveConfig(cfg); err != nil { - return err - } - r.cfg = cfg - return nil -} - -func (r *Root) Client() (*rest_client_zrok.Zrok, error) { - apiEndpoint, _ := r.ApiEndpoint() - apiUrl, err := url.Parse(apiEndpoint) - if err != nil { - return nil, errors.Wrapf(err, "error parsing api endpoint '%v'", r) - } - transport := httptransport.New(apiUrl.Host, "/api/v2", []string{apiUrl.Scheme}) - transport.Producers["application/zrok.v1+json"] = runtime.JSONProducer() - transport.Consumers["application/zrok.v1+json"] = runtime.JSONConsumer() - - zrok := rest_client_zrok.New(transport, strfmt.Default) - _, err = zrok.Metadata.ClientVersionCheck(&metadata2.ClientVersionCheckParams{ - Body: metadata2.ClientVersionCheckBody{ - ClientVersion: build.String(), - }, - }) - if err != nil { - return nil, errors.Wrapf(err, "client version error accessing api endpoint '%v': %v", apiEndpoint, err) - } - - return zrok, nil -} - -func (r *Root) ApiEndpoint() (string, string) { - apiEndpoint := "https://api-v2.zrok.io" - from := "binary" - - if r.Config() != nil && r.Config().ApiEndpoint != "" { - apiEndpoint = r.Config().ApiEndpoint - from = "config" - } - - env := os.Getenv("ZROK_API_ENDPOINT") - if env != "" { - apiEndpoint = env - from = "ZROK_API_ENDPOINT" - } - - if r.IsEnabled() { - apiEndpoint = r.Environment().ApiEndpoint - from = "env" - } - - return apiEndpoint, from -} - -func (r *Root) DefaultNamespace() (string, string) { - defaultNamespace := "public" - from := "binary" - - if r.Config() != nil && r.Config().DefaultNamespace != "" { - defaultNamespace = r.Config().DefaultNamespace - from = "config" - } - - env := os.Getenv("ZROK_DEFAULT_NAMESPACE") - if env != "" { - defaultNamespace = env - from = "ZROK_DEFAULT_NAMESPACE" - } - - return defaultNamespace, from -} - -func (r *Root) Headless() (bool, string) { - headless := false - from := "binary" - - if r.Config() != nil { - headless = r.Config().Headless - from = "config" - } - - env := os.Getenv("ZROK_HEADLESS") - if env != "" { - if v, err := strconv.ParseBool(env); err == nil { - headless = v - from = "ZROK_HEADLESS" - } - } - - return headless, from -} - -func (r *Root) SuperNetwork() (bool, string) { - superNetwork := false - from := "binary" - - if r.Config() != nil { - superNetwork = r.Config().SuperNetwork - from = "config" - } - - env := os.Getenv("ZROK_SUPER_NETWORK") - if env != "" { - if v, err := strconv.ParseBool(env); err == nil { - superNetwork = v - from = "ZROK_SUPER_NETWORK" - } - } - - return superNetwork, from -} - -func (r *Root) Environment() *env_core.Environment { - return r.env -} - -func (r *Root) SetEnvironment(env *env_core.Environment) error { - if err := assertMetadata(); err != nil { - return err - } - if err := saveEnvironment(env); err != nil { - return err - } - r.env = env - return nil -} - -func (r *Root) DeleteEnvironment() error { - ef, err := environmentFile() - if err != nil { - return errors.Wrap(err, "error getting environment file") - } - if err := os.Remove(ef); err != nil { - return errors.Wrap(err, "error removing environment file") - } - r.env = nil - return nil -} - -func (r *Root) IsEnabled() bool { - return r.env != nil -} - -func (r *Root) PublicIdentityName() string { - return "frontend" -} - -func (r *Root) EnvironmentIdentityName() string { - return "backend" -} - -func (r *Root) ZitiIdentityNamed(name string) (string, error) { - return identityFile(name) -} - -func (r *Root) SaveZitiIdentityNamed(name, data string) error { - if err := assertMetadata(); err != nil { - return err - } - zif, err := r.ZitiIdentityNamed(name) - if err != nil { - return err - } - if err := os.MkdirAll(filepath.Dir(zif), os.FileMode(0700)); err != nil { - return errors.Wrapf(err, "error creating environment path '%v'", filepath.Dir(zif)) - } - if err := os.WriteFile(zif, []byte(data), os.FileMode(0600)); err != nil { - return errors.Wrapf(err, "error writing ziti identity file '%v'", zif) - } - return nil -} - -func (r *Root) DeleteZitiIdentityNamed(name string) error { - zif, err := r.ZitiIdentityNamed(name) - if err != nil { - return errors.Wrapf(err, "error getting ziti identity file path for '%v'", name) - } - if err := os.Remove(zif); err != nil { - return errors.Wrapf(err, "error removing ziti identity file '%v'", zif) - } - return nil -} - -func (r *Root) AgentSocket() (string, error) { - return "", errors.Errorf("this environment version does not support the zrok Agent; please 'zrok update' this environment") -} - -func (r *Root) AgentRegistry() (string, error) { - return "", errors.Errorf("this environment version does not support the zrok Agent; please 'zrok update' this environment") -} - -func (r *Root) AgentEnrollment() (string, error) { - return "", errors.Errorf("this environment version does not support the zrok Agent; please 'zrok update' this environment") -} - -func (r *Root) Obliterate() error { - zrd, err := rootDir() - if err != nil { - return err - } - if err := os.RemoveAll(zrd); err != nil { - return err - } - return nil -} diff --git a/environment/env_v0_3/dirs.go b/environment/env_v0_3/dirs.go deleted file mode 100644 index ec382f7f..00000000 --- a/environment/env_v0_3/dirs.go +++ /dev/null @@ -1,55 +0,0 @@ -package env_v0_3 - -import ( - "fmt" - "os" - "path/filepath" -) - -func rootDir() (string, error) { - home, err := os.UserHomeDir() - if err != nil { - return "", err - } - return filepath.Join(home, ".zrok"), nil -} - -func metadataFile() (string, error) { - zrd, err := rootDir() - if err != nil { - return "", err - } - return filepath.Join(zrd, "metadata.json"), nil -} - -func configFile() (string, error) { - zrd, err := rootDir() - if err != nil { - return "", err - } - return filepath.Join(zrd, "config.json"), nil -} - -func environmentFile() (string, error) { - zrd, err := rootDir() - if err != nil { - return "", err - } - return filepath.Join(zrd, "environment.json"), nil -} - -func identitiesDir() (string, error) { - zrd, err := rootDir() - if err != nil { - return "", err - } - return filepath.Join(zrd, "identities"), nil -} - -func identityFile(name string) (string, error) { - idd, err := identitiesDir() - if err != nil { - return "", err - } - return filepath.Join(idd, fmt.Sprintf("%v.json", name)), nil -} diff --git a/environment/env_v0_3/root.go b/environment/env_v0_3/root.go deleted file mode 100644 index 6a08179c..00000000 --- a/environment/env_v0_3/root.go +++ /dev/null @@ -1,262 +0,0 @@ -package env_v0_3 - -import ( - "encoding/json" - "github.com/openziti/zrok/v2/environment/env_core" - "github.com/pkg/errors" - "os" - "path/filepath" -) - -const V = "v0.3" - -type Root struct { - meta *env_core.Metadata - cfg *env_core.Config - env *env_core.Environment -} - -func Assert() (bool, error) { - exists, err := rootExists() - if err != nil { - return true, err - } - if exists { - meta, err := loadMetadata() - if err != nil { - return true, err - } - return meta.V == V, nil - } - return false, nil -} - -func Load() (*Root, error) { - r := &Root{} - exists, err := rootExists() - if err != nil { - return nil, err - } - if exists { - if meta, err := loadMetadata(); err == nil { - r.meta = meta - } else { - return nil, err - } - - if cfg, err := loadConfig(); err == nil { - r.cfg = cfg - } - - if env, err := loadEnvironment(); err == nil { - r.env = env - } - - } else { - root, err := rootDir() - if err != nil { - return nil, err - } - r.meta = &env_core.Metadata{ - V: V, - RootPath: root, - } - } - return r, nil -} - -func rootExists() (bool, error) { - mf, err := metadataFile() - if err != nil { - return false, err - } - _, err = os.Stat(mf) - if os.IsNotExist(err) { - return false, nil - } - if err != nil { - return false, err - } - return true, nil -} - -func assertMetadata() error { - exists, err := rootExists() - if err != nil { - return err - } - if !exists { - if err := writeMetadata(); err != nil { - return err - } - } - return nil -} - -func loadMetadata() (*env_core.Metadata, error) { - mf, err := metadataFile() - if err != nil { - return nil, err - } - data, err := os.ReadFile(mf) - if err != nil { - return nil, err - } - m := &metadata{} - if err := json.Unmarshal(data, m); err != nil { - return nil, errors.Wrapf(err, "error unmarshaling metadata file '%v'", mf) - } - if m.V != V { - return nil, errors.Errorf("got metadata version '%v', expected '%v'", m.V, V) - } - rf, err := rootDir() - if err != nil { - return nil, err - } - out := &env_core.Metadata{ - V: m.V, - RootPath: rf, - } - return out, nil -} - -func writeMetadata() error { - mf, err := metadataFile() - if err != nil { - return err - } - data, err := json.Marshal(&metadata{V: V}) - if err != nil { - return err - } - if err := os.MkdirAll(filepath.Dir(mf), os.FileMode(0700)); err != nil { - return err - } - if err := os.WriteFile(mf, data, os.FileMode(0600)); err != nil { - return err - } - return nil -} - -func loadConfig() (*env_core.Config, error) { - cf, err := configFile() - if err != nil { - return nil, errors.Wrap(err, "error getting config file path") - } - data, err := os.ReadFile(cf) - if err != nil { - return nil, errors.Wrapf(err, "error reading config file '%v'", cf) - } - cfg := &config{} - if err := json.Unmarshal(data, cfg); err != nil { - return nil, errors.Wrapf(err, "error unmarshaling config file '%v'", cf) - } - out := &env_core.Config{ - ApiEndpoint: cfg.ApiEndpoint, - } - return out, nil -} - -func saveConfig(cfg *env_core.Config) error { - in := &config{ApiEndpoint: cfg.ApiEndpoint} - data, err := json.MarshalIndent(in, "", " ") - if err != nil { - return errors.Wrap(err, "error marshaling config") - } - cf, err := configFile() - if err != nil { - return errors.Wrap(err, "error getting config file path") - } - if err := os.MkdirAll(filepath.Dir(cf), os.FileMode(0700)); err != nil { - return errors.Wrapf(err, "error creating environment path '%v'", filepath.Dir(cf)) - } - if err := os.WriteFile(cf, data, os.FileMode(0600)); err != nil { - return errors.Wrap(err, "error saving config file") - } - return nil -} - -func isEnabled() (bool, error) { - ef, err := environmentFile() - if err != nil { - return false, errors.Wrap(err, "error getting environment file path") - } - _, err = os.Stat(ef) - if os.IsNotExist(err) { - return false, nil - } - if err != nil { - return false, errors.Wrapf(err, "error stat-ing environment file '%v'", ef) - } - return true, nil -} - -func loadEnvironment() (*env_core.Environment, error) { - ef, err := environmentFile() - if err != nil { - return nil, errors.Wrap(err, "error getting environment file") - } - data, err := os.ReadFile(ef) - if err != nil { - return nil, errors.Wrapf(err, "error reading environment file '%v'", ef) - } - env := &environment{} - if err := json.Unmarshal(data, env); err != nil { - return nil, errors.Wrapf(err, "error unmarshaling environment file '%v'", ef) - } - out := &env_core.Environment{ - AccountToken: env.AccountToken, - ZitiIdentity: env.ZId, - ApiEndpoint: env.ApiEndpoint, - } - return out, nil -} - -func saveEnvironment(env *env_core.Environment) error { - in := &environment{ - AccountToken: env.AccountToken, - ZId: env.ZitiIdentity, - ApiEndpoint: env.ApiEndpoint, - } - data, err := json.MarshalIndent(in, "", " ") - if err != nil { - return errors.Wrap(err, "error marshaling environment") - } - ef, err := environmentFile() - if err != nil { - return errors.Wrap(err, "error getting environment file") - } - if err := os.MkdirAll(filepath.Dir(ef), os.FileMode(0700)); err != nil { - return errors.Wrapf(err, "error creating environment path '%v'", filepath.Dir(ef)) - } - if err := os.WriteFile(ef, data, os.FileMode(0600)); err != nil { - return errors.Wrap(err, "error saving environment file") - } - return nil -} - -func deleteEnvironment() error { - ef, err := environmentFile() - if err != nil { - return errors.Wrap(err, "error getting environment file") - } - if err := os.Remove(ef); err != nil { - return errors.Wrap(err, "error removing environment file") - } - - return nil -} - -type metadata struct { - V string `json:"v"` -} - -type config struct { - ApiEndpoint string `json:"api_endpoint"` -} - -type environment struct { - AccountToken string `json:"zrok_token"` - ZId string `json:"ziti_identity"` - ApiEndpoint string `json:"api_endpoint"` -} diff --git a/environment/env_v0_4/api.go b/environment/env_v0_4/api.go index 0cea207d..a426e96b 100644 --- a/environment/env_v0_4/api.go +++ b/environment/env_v0_4/api.go @@ -70,10 +70,10 @@ func (r *Root) ApiEndpoint() (string, string) { from = "config" } - env := os.Getenv("ZROK_API_ENDPOINT") + env := os.Getenv("ZROK2_API_ENDPOINT") if env != "" { apiEndpoint = env - from = "ZROK_API_ENDPOINT" + from = "ZROK2_API_ENDPOINT" } if r.IsEnabled() { @@ -93,10 +93,10 @@ func (r *Root) DefaultNamespace() (string, string) { from = "config" } - env := os.Getenv("ZROK_DEFAULT_NAMESPACE") + env := os.Getenv("ZROK2_DEFAULT_NAMESPACE") if env != "" { defaultNamespace = env - from = "ZROK_DEFAULT_NAMESPACE" + from = "ZROK2_DEFAULT_NAMESPACE" } return defaultNamespace, from @@ -111,11 +111,11 @@ func (r *Root) Headless() (bool, string) { from = "config" } - env := os.Getenv("ZROK_HEADLESS") + env := os.Getenv("ZROK2_HEADLESS") if env != "" { if v, err := strconv.ParseBool(env); err == nil { headless = v - from = "ZROK_HEADLESS" + from = "ZROK2_HEADLESS" } } @@ -131,11 +131,11 @@ func (r *Root) SuperNetwork() (bool, string) { from = "config" } - env := os.Getenv("ZROK_SUPER_NETWORK") + env := os.Getenv("ZROK2_SUPER_NETWORK") if env != "" { if v, err := strconv.ParseBool(env); err == nil { superNetwork = v - from = "ZROK_SUPER_NETWORK" + from = "ZROK2_SUPER_NETWORK" } } diff --git a/environment/env_v0_4/dirs.go b/environment/env_v0_4/dirs.go index e9605247..caf615c9 100644 --- a/environment/env_v0_4/dirs.go +++ b/environment/env_v0_4/dirs.go @@ -6,7 +6,7 @@ import ( "path/filepath" ) -var rootDirName = ".zrok" +var rootDirName = ".zrok2" func SetRootDirName(name string) { rootDirName = name diff --git a/environment/env_v0_4/root.go b/environment/env_v0_4/root.go index b9f17114..d24eb04f 100644 --- a/environment/env_v0_4/root.go +++ b/environment/env_v0_4/root.go @@ -2,14 +2,12 @@ package env_v0_4 import ( "encoding/json" - "fmt" "os" "path/filepath" "strings" "github.com/michaelquigley/df/dl" "github.com/openziti/zrok/v2/environment/env_core" - "github.com/openziti/zrok/v2/environment/env_v0_3" "github.com/pkg/errors" ) @@ -84,59 +82,7 @@ func Update(r env_core.Root) (env_core.Root, error) { if r == nil || r.Metadata() == nil { return nil, errors.Errorf("nil root") } - if r.Metadata().V != env_v0_3.V { - return nil, errors.Errorf("expecting version '%v'", env_v0_3.V) - } - - newR := &Root{meta: r.Metadata(), cfg: r.Config(), env: r.Environment()} - - oldAccessF, err := r.ZitiIdentityNamed(r.PublicIdentityName()) - if err != nil { - return nil, err - } - _, err = os.Stat(oldAccessF) - if err == nil { - newAccessF, err := newR.ZitiIdentityNamed(newR.PublicIdentityName()) - if err != nil { - return nil, err - } - if err := os.Rename(oldAccessF, newAccessF); err != nil { - return nil, err - } - fmt.Printf("renamed '%v' -> '%v'\n", oldAccessF, newAccessF) - } else if !os.IsNotExist(err) { - return nil, err - } - - oldShareF, err := r.ZitiIdentityNamed(r.EnvironmentIdentityName()) - if err != nil { - return nil, err - } - _, err = os.Stat(oldShareF) - if err == nil { - newShareF, err := newR.ZitiIdentityNamed(newR.EnvironmentIdentityName()) - if err != nil { - return nil, err - } - if err := os.Rename(oldShareF, newShareF); err != nil { - return nil, err - } - fmt.Printf("renamed '%v' -> '%v'\n", oldShareF, newShareF) - } else if !os.IsNotExist(err) { - return nil, err - } - - if err := writeMetadata(); err != nil { - return nil, err - } - - meta, err := loadMetadata() - if err != nil { - return nil, err - } - newR.meta = meta - - return newR, nil + return nil, errors.Errorf("no upgrade path available from version '%v'", r.Metadata().V) } func rootExists() (bool, error) { diff --git a/etc/caddy/README.md b/etc/caddy/README.md index 0969ea40..3b22a685 100644 --- a/etc/caddy/README.md +++ b/etc/caddy/README.md @@ -4,9 +4,6 @@ The Caddyfile samples in this directory are for use with `--backend-mode caddy ./my.Caddyfile` which runs an embedded Caddy server. -With a zrok reserved share, you have the option to permanently override the path to the Caddyfile when you run `zrok -share reserved ${ZROK_RESERVED_TOKEN} --override-endpoint new.Caddyfile`. - The Caddyfile must have this structure because it is rendered as a Go template by zrok to bind the HTTP listener. ```console @@ -18,4 +15,4 @@ http:// { ## Notes -multiple_upstream.Caddyfile is bundled in the zrok-share package for Linux as an example Caddyfile. +multiple_upstream.Caddyfile is bundled in the zrok2-share package for Linux as an example Caddyfile. diff --git a/nfpm/zrok-agent.service b/nfpm/zrok-agent.service deleted file mode 100644 index 71ac298c..00000000 --- a/nfpm/zrok-agent.service +++ /dev/null @@ -1,16 +0,0 @@ -# /usr/lib/systemd/user/zrok-agent.service - -[Unit] -Description=zrok agent user service unit -After=network-online.target - -[Service] -Type=simple -UMask=0007 -ExecStartPre=/usr/bin/env rm --force %h/.zrok/agent.socket -ExecStart=/opt/openziti/bin/zrok agent start -Restart=always -RestartSec=3 - -[Install] -WantedBy=default.target diff --git a/nfpm/zrok-share.bash b/nfpm/zrok-share.bash deleted file mode 100644 index acab0515..00000000 --- a/nfpm/zrok-share.bash +++ /dev/null @@ -1,224 +0,0 @@ -#!/usr/bin/env bash -# -# this script shares the configured backend for a reserved share token -# - -set -o errexit -set -o nounset -set -o pipefail - -exec_with_common_opts(){ - local zrok_cmd="$* --headless ${ZROK_VERBOSE:-} ${ZROK_INSECURE:-}" - echo "INFO: running: zrok ${zrok_cmd}" - exec zrok ${zrok_cmd} -} - -exec_share_reserved(){ - local token="$1" - local target="$2" - shift 2 - local opts="${*:-}" - local zrok_cmd="share reserved ${token} ${opts} --override-endpoint ${target}" - exec_with_common_opts ${zrok_cmd} -} - -if ! command -v jq &>/dev/null; then - echo "ERROR: jq is needed but not installed" >&2 - exit 1 -fi - -# set HOME to the first colon-sep dir in STATE_DIRECTORY inherited from systemd (/var/lib/zrok-share) or docker (/mnt) -if [[ -n "${STATE_DIRECTORY:-}" ]]; then - export HOME="${STATE_DIRECTORY%:*}" -else - echo "WARNING: STATE_DIRECTORY is undefined. Using HOME=${HOME}" >&2 -fi -echo "DEBUG: zrok state directory is ${HOME}/.zrok" - -: "${ZROK_SHARE_RESERVED:=true}" -echo "DEBUG: ZROK_SHARE_RESERVED=${ZROK_SHARE_RESERVED}" - -while (( $# )); do - if [[ "${1:0:1}" == @ ]]; then - ZROK_INSTANCE="${1:1}" - shift - elif [[ -s "$1" ]]; then - echo "INFO: reading share configuration from $1" - source "$1" - shift - fi -done - -ZROK_RESERVATION_FILE="${HOME}/.zrok/reserved${ZROK_INSTANCE:+@${ZROK_INSTANCE}}.json" - -[[ -n "${ZROK_TARGET:-}" ]] || { - echo "ERROR: ZROK_TARGET is not defined." >&2 - exit 1 -} - -# default mode is 'reserved-public', override modes are reserved-private, temp-public, temp-private. -: "${ZROK_FRONTEND_MODE:=reserved-public}" -if [[ "${ZROK_FRONTEND_MODE:-}" == temp-public ]]; then - ZROK_CMD="share public" -elif [[ "${ZROK_FRONTEND_MODE:-}" == temp-private ]]; then - ZROK_CMD="share private" -elif [[ -s "${ZROK_RESERVATION_FILE}" ]]; then - ZROK_RESERVATION_TOKEN="$(jq -r '.token' "${ZROK_RESERVATION_FILE}" 2>/dev/null)" - if [[ -z "${ZROK_RESERVATION_TOKEN}" || "${ZROK_RESERVATION_TOKEN}" == null ]]; then - echo "ERROR: invalid reservation file: '$(jq -c . "${ZROK_RESERVATION_FILE}")'" >&2 - exit 1 - else - echo "INFO: zrok backend is already reserved: ${ZROK_RESERVATION_TOKEN}" - ZROK_CMD="${ZROK_RESERVATION_TOKEN} ${ZROK_TARGET}" - if [[ "${ZROK_SHARE_RESERVED}" == true ]]; then - exec_share_reserved ${ZROK_CMD} - else - echo "INFO: finished reserving zrok backend, continuing without sharing" - exit 0 - fi - fi -elif [[ "${ZROK_FRONTEND_MODE:-}" == reserved-public ]]; then - ZROK_CMD="reserve public --json-output ${ZROK_VERBOSE:-}" -elif [[ "${ZROK_FRONTEND_MODE:-}" == reserved-private ]]; then - ZROK_CMD="reserve private --json-output ${ZROK_VERBOSE:-}" -else - echo "ERROR: invalid value for ZROK_FRONTEND_MODE '${ZROK_FRONTEND_MODE}'" >&2 - exit 1 -fi - -[[ -n "${ZROK_BACKEND_MODE:-}" ]] || { - echo "WARNING: ZROK_BACKEND_MODE was not defined, assuming mode 'proxy'." >&2 - ZROK_BACKEND_MODE="proxy" -} - -case "${ZROK_BACKEND_MODE}" in - proxy) - if ! [[ "${ZROK_TARGET}" =~ ^https?:// ]]; then - echo "ERROR: ZROK_TARGET='${ZROK_TARGET}' is not an HTTP URL" >&2 - exit 1 - else - echo "INFO: validated backend mode '${ZROK_BACKEND_MODE}' and target '${ZROK_TARGET}'" - fi - ;; - caddy) - if ! [[ "${ZROK_TARGET}" =~ ^/ ]]; then - echo "ERROR: ZROK_TARGET='${ZROK_TARGET}' is not an absolute filesystem path" >&2 - exit 1 - elif ! [[ -f "${ZROK_TARGET}" && -r "${ZROK_TARGET}" ]]; then - echo "ERROR: ZROK_TARGET='${ZROK_TARGET}' is not a readable regular file" >&2 - exit 1 - else - echo "INFO: validated backend mode ${ZROK_BACKEND_MODE} and target ${ZROK_TARGET}" - fi - ;; - web|drive) - if ! [[ "${ZROK_TARGET}" =~ ^/ ]]; then - echo "ERROR: ZROK_TARGET='${ZROK_TARGET}' is not an absolute filesystem path" >&2 - exit 1 - elif ! [[ -d "${ZROK_TARGET}" && -r "${ZROK_TARGET}" ]]; then - echo "ERROR: ZROK_TARGET='${ZROK_TARGET}' is not a readable directory" >&2 - exit 1 - else - echo "INFO: validated backend mode ${ZROK_BACKEND_MODE} and target ${ZROK_TARGET}" - fi - ;; - tcpTunnel|udpTunnel|socks) - if ! [[ "${ZROK_FRONTEND_MODE}" =~ -private$ ]]; then - echo "ERROR: ZROK_BACKEND_MODE='${ZROK_BACKEND_MODE}' is a private share backend mode and cannot be used with ZROK_FRONTEND_MODE='${ZROK_FRONTEND_MODE}'" >&2 - exit 1 - else - case "${ZROK_BACKEND_MODE}" in - tcpTunnel|udpTunnel) - echo "INFO: ${ZROK_BACKEND_MODE} backend mode has target '${ZROK_TARGET}'" - ;; - socks) - if [[ -n "${ZROK_TARGET}" ]]; then - echo "WARNING: ZROK_TARGET='${ZROK_TARGET}' is ignored with ZROK_BACKEND_MODE='${ZROK_BACKEND_MODE}'" >&2 - unset ZROK_TARGET - fi - ;; - esac - fi - ;; - *) - echo "WARNING: ZROK_BACKEND_MODE='${ZROK_BACKEND_MODE}' is not a recognized mode for a zrok public share."\ - " ZROK_TARGET value will not validated before running." >&2 - ;; -esac - -if [[ "${ZROK_FRONTEND_MODE:-}" =~ ^reserved- && -n "${ZROK_UNIQUE_NAME:-}" ]]; then - ZROK_CMD+=" --unique-name ${ZROK_UNIQUE_NAME}" -elif [[ -n "${ZROK_UNIQUE_NAME:-}" ]]; then - echo "WARNING: ZROK_UNIQUE_NAME='${ZROK_UNIQUE_NAME}' is ignored with ZROK_FRONTEND_MODE='${ZROK_FRONTEND_MODE}'" >&2 -fi - -if [[ "${ZROK_FRONTEND_MODE:-}" =~ -private$ && "${ZROK_PERMISSION_MODE:-}" == closed ]]; then - ZROK_CMD+=" --closed" - if [[ -n "${ZROK_ACCESS_GRANTS:-}" ]]; then - for ACCESS_GRANT in ${ZROK_ACCESS_GRANTS}; do - ZROK_CMD+=" --access-grant ${ACCESS_GRANT}" - done - else - echo "WARNING: ZROK_PERMISSION_MODE='${ZROK_PERMISSION_MODE}' and no additional ZROK_ACCESS_GRANTS; will be granted access" >&2 - fi -elif [[ "${ZROK_FRONTEND_MODE:-}" =~ -private$ && -n "${ZROK_PERMISSION_MODE:-}" && "${ZROK_PERMISSION_MODE}" != open ]]; then - echo "WARNING: ZROK_PERMISSION_MODE='${ZROK_PERMISSION_MODE}' is not a recognized value'" >&2 -elif [[ "${ZROK_FRONTEND_MODE:-}" =~ -public$ && -n "${ZROK_PERMISSION_MODE:-}" ]]; then - echo "WARNING: ZROK_PERMISSION_MODE='${ZROK_PERMISSION_MODE}' is ignored with ZROK_FRONTEND_MODE='${ZROK_FRONTEND_MODE}'" >&2 -fi - -ZROK_CMD+=" --backend-mode ${ZROK_BACKEND_MODE} ${ZROK_TARGET}" - -if [[ -n "${ZROK_SHARE_OPTS:-}" ]]; then - ZROK_CMD+=" ${ZROK_SHARE_OPTS}" -fi - -if [[ -n "${ZROK_OAUTH_PROVIDER:-}" ]]; then - ZROK_CMD+=" --oauth-provider ${ZROK_OAUTH_PROVIDER}" - if [[ -n "${ZROK_OAUTH_EMAILS:-}" ]]; then - for EMAIL in ${ZROK_OAUTH_EMAILS}; do - ZROK_CMD+=" --oauth-email-address-pattern ${EMAIL}" - done - fi -elif [[ -n "${ZROK_BASIC_AUTH:-}" ]]; then - ZROK_CMD+=" --basic-auth ${ZROK_BASIC_AUTH}" -fi - -if [[ "${ZROK_FRONTEND_MODE:-}" =~ ^temp- ]]; then - # frontend mode starts with 'temp-', so is temporary. - # share without reserving until exit. - exec_with_common_opts ${ZROK_CMD} -else - # reserve and continue - zrok ${ZROK_CMD} > "${ZROK_RESERVATION_FILE}" - # share the reserved backend target until exit - if ! [[ -s "${ZROK_RESERVATION_FILE}" ]]; then - echo "ERROR: empty or missing $(realpath "${ZROK_RESERVATION_FILE}")" >&2 - exit 1 - elif ! jq . < "${ZROK_RESERVATION_FILE}" &>/dev/null; then - echo "ERROR: invalid JSON in $(realpath "${ZROK_RESERVATION_FILE}")" >&2 - exit 1 - else - if [[ "${ZROK_FRONTEND_MODE:-}" == reserved-public ]]; then - ZROK_PUBLIC_URLS=$(jq -cr '.frontend_endpoints' "${ZROK_RESERVATION_FILE}" 2>/dev/null) - if [[ -z "${ZROK_PUBLIC_URLS}" || "${ZROK_PUBLIC_URLS}" == null ]]; then - echo "ERROR: frontend endpoints not defined in $(realpath "${ZROK_RESERVATION_FILE}")" >&2 - exit 1 - else - echo "INFO: zrok public URLs: ${ZROK_PUBLIC_URLS}" - fi - fi - ZROK_RESERVATION_TOKEN=$(jq -r '.token' "${ZROK_RESERVATION_FILE}" 2>/dev/null) - if [[ -z "${ZROK_RESERVATION_TOKEN}" || "${ZROK_RESERVATION_TOKEN}" == null ]]; then - echo "ERROR: zrok reservation token not defined in $(realpath "${ZROK_RESERVATION_FILE}")" >&2 - exit 1 - fi - ZROK_CMD="${ZROK_RESERVATION_TOKEN} ${ZROK_TARGET}" - if [[ "${ZROK_SHARE_RESERVED}" == true ]]; then - exec_share_reserved ${ZROK_CMD} - else - echo "INFO: finished reserving zrok backend, continuing without sharing" - exit 0 - fi - fi -fi diff --git a/nfpm/zrok-share.service b/nfpm/zrok-share.service deleted file mode 100644 index fdb528f3..00000000 --- a/nfpm/zrok-share.service +++ /dev/null @@ -1,17 +0,0 @@ -[Unit] -Description=zrok share service -After=network-online.target - -[Service] -Type=simple -DynamicUser=yes -StateDirectory=zrok-share -UMask=0007 -EnvironmentFile=/opt/openziti/etc/zrok/zrok-share.env -ExecStartPre=/opt/openziti/bin/zrok-enable.bash -ExecStart=/opt/openziti/bin/zrok-share.bash -Restart=always -RestartSec=3 - -[Install] -WantedBy=multi-user.target diff --git a/nfpm/zrok-share@.service b/nfpm/zrok-share@.service deleted file mode 100644 index 1ccf3356..00000000 --- a/nfpm/zrok-share@.service +++ /dev/null @@ -1,17 +0,0 @@ - -# /usr/lib/systemd/user/zrok-share@.service - -[Unit] -Description=zrok share user service unit @%i -After=network-online.target - -[Service] -Type=simple -UMask=0007 -EnvironmentFile=%h/.zrok/zrok-share@%i.env -ExecStart=/opt/openziti/bin/zrok-share.bash @%i -Restart=always -RestartSec=3 - -[Install] -WantedBy=default.target diff --git a/nfpm/zrok2-agent.service b/nfpm/zrok2-agent.service new file mode 100644 index 00000000..eaf4b149 --- /dev/null +++ b/nfpm/zrok2-agent.service @@ -0,0 +1,16 @@ +# /usr/lib/systemd/user/zrok2-agent.service + +[Unit] +Description=zrok2 agent user service unit +After=network-online.target + +[Service] +Type=simple +UMask=0007 +ExecStartPre=/usr/bin/env rm --force %h/.zrok2/agent.socket +ExecStart=/opt/openziti/bin/zrok2 agent start +Restart=always +RestartSec=3 + +[Install] +WantedBy=default.target diff --git a/nfpm/zrok-enable.bash b/nfpm/zrok2-enable.bash similarity index 59% rename from nfpm/zrok-enable.bash rename to nfpm/zrok2-enable.bash index 1f32277e..dfc5053f 100644 --- a/nfpm/zrok-enable.bash +++ b/nfpm/zrok2-enable.bash @@ -1,6 +1,6 @@ #!/usr/bin/env bash # -# this script uses a zrok enable token to enable a zrok environment in $HOME/.zrok +# this script uses a zrok enable token to enable a zrok environment in $HOME/.zrok2 # set -o errexit @@ -8,7 +8,7 @@ set -o nounset set -o pipefail BASENAME=$(basename "$0") -DEFAULT_ZROK_ENVIRONMENT_NAME="zrok-share service on $(hostname -s 2>/dev/null || echo localhost)" +DEFAULT_ZROK2_ENVIRONMENT_NAME="zrok2-share service on $(hostname -s 2>/dev/null || echo localhost)" if (( $# )); then case $1 in @@ -21,16 +21,16 @@ if (( $# )); then esac fi -# set HOME to the first colon-sep dir in STATE_DIRECTORY inherited from systemd, e.g. /var/lib/zrok-share +# set HOME to the first colon-sep dir in STATE_DIRECTORY inherited from systemd, e.g. /var/lib/zrok2-share if [[ -n "${STATE_DIRECTORY:-}" ]]; then export HOME="${STATE_DIRECTORY%:*}" else echo "WARNING: STATE_DIRECTORY is undefined. Using HOME=${HOME}" >&2 fi -echo "DEBUG: zrok state directory is ${HOME}/.zrok" +echo "DEBUG: zrok state directory is ${HOME}/.zrok2" -if [[ -s ~/.zrok/environment.json ]]; then - echo "INFO: zrok environment is already enabled. Delete '$(realpath ~/.zrok/environment.json)' if you want to create a"\ +if [[ -s ~/.zrok2/environment.json ]]; then + echo "INFO: zrok environment is already enabled. Delete '$(realpath ~/.zrok2/environment.json)' if you want to create a"\ "new environment." exit 0 fi @@ -47,11 +47,11 @@ else echo "INFO: reading enable parameters from environment variables" fi -if [[ -z "${ZROK_ENABLE_TOKEN}" ]]; then - echo "ERROR: ZROK_ENABLE_TOKEN is not defined" >&2 +if [[ -z "${ZROK2_ENABLE_TOKEN}" ]]; then + echo "ERROR: ZROK2_ENABLE_TOKEN is not defined" >&2 exit 1 else - zrok config set apiEndpoint "${ZROK_API_ENDPOINT:-https://api-v2.zrok.io}" - echo "INFO: running: zrok enable ..." - exec zrok enable --headless --description "${ZROK_ENVIRONMENT_NAME:-${DEFAULT_ZROK_ENVIRONMENT_NAME}}" "${ZROK_ENABLE_TOKEN}" + zrok2 config set apiEndpoint "${ZROK2_API_ENDPOINT:-https://api-v2.zrok.io}" + echo "INFO: running: zrok2 enable ..." + exec zrok2 enable --headless --description "${ZROK2_ENVIRONMENT_NAME:-${DEFAULT_ZROK2_ENVIRONMENT_NAME}}" "${ZROK2_ENABLE_TOKEN}" fi diff --git a/nfpm/zrok2-share.bash b/nfpm/zrok2-share.bash new file mode 100644 index 00000000..b3a4cbcc --- /dev/null +++ b/nfpm/zrok2-share.bash @@ -0,0 +1,224 @@ +#!/usr/bin/env bash +# +# this script shares the configured backend for a reserved share token +# + +set -o errexit +set -o nounset +set -o pipefail + +exec_with_common_opts(){ + local zrok_cmd="$* --headless ${ZROK2_VERBOSE:-} ${ZROK2_INSECURE:-}" + echo "INFO: running: zrok2 ${zrok_cmd}" + exec zrok2 ${zrok_cmd} +} + +exec_share_reserved(){ + local token="$1" + local target="$2" + shift 2 + local opts="${*:-}" + local zrok_cmd="share reserved ${token} ${opts} --override-endpoint ${target}" + exec_with_common_opts ${zrok_cmd} +} + +if ! command -v jq &>/dev/null; then + echo "ERROR: jq is needed but not installed" >&2 + exit 1 +fi + +# set HOME to the first colon-sep dir in STATE_DIRECTORY inherited from systemd (/var/lib/zrok2-share) or docker (/mnt) +if [[ -n "${STATE_DIRECTORY:-}" ]]; then + export HOME="${STATE_DIRECTORY%:*}" +else + echo "WARNING: STATE_DIRECTORY is undefined. Using HOME=${HOME}" >&2 +fi +echo "DEBUG: zrok state directory is ${HOME}/.zrok2" + +: "${ZROK2_SHARE_RESERVED:=true}" +echo "DEBUG: ZROK2_SHARE_RESERVED=${ZROK2_SHARE_RESERVED}" + +while (( $# )); do + if [[ "${1:0:1}" == @ ]]; then + ZROK2_INSTANCE="${1:1}" + shift + elif [[ -s "$1" ]]; then + echo "INFO: reading share configuration from $1" + source "$1" + shift + fi +done + +ZROK2_RESERVATION_FILE="${HOME}/.zrok2/reserved${ZROK2_INSTANCE:+@${ZROK2_INSTANCE}}.json" + +[[ -n "${ZROK2_TARGET:-}" ]] || { + echo "ERROR: ZROK2_TARGET is not defined." >&2 + exit 1 +} + +# default mode is 'reserved-public', override modes are reserved-private, temp-public, temp-private. +: "${ZROK2_FRONTEND_MODE:=reserved-public}" +if [[ "${ZROK2_FRONTEND_MODE:-}" == temp-public ]]; then + ZROK2_CMD="share public" +elif [[ "${ZROK2_FRONTEND_MODE:-}" == temp-private ]]; then + ZROK2_CMD="share private" +elif [[ -s "${ZROK2_RESERVATION_FILE}" ]]; then + ZROK2_RESERVATION_TOKEN="$(jq -r '.token' "${ZROK2_RESERVATION_FILE}" 2>/dev/null)" + if [[ -z "${ZROK2_RESERVATION_TOKEN}" || "${ZROK2_RESERVATION_TOKEN}" == null ]]; then + echo "ERROR: invalid reservation file: '$(jq -c . "${ZROK2_RESERVATION_FILE}")'" >&2 + exit 1 + else + echo "INFO: zrok backend is already reserved: ${ZROK2_RESERVATION_TOKEN}" + ZROK2_CMD="${ZROK2_RESERVATION_TOKEN} ${ZROK2_TARGET}" + if [[ "${ZROK2_SHARE_RESERVED}" == true ]]; then + exec_share_reserved ${ZROK2_CMD} + else + echo "INFO: finished reserving zrok backend, continuing without sharing" + exit 0 + fi + fi +elif [[ "${ZROK2_FRONTEND_MODE:-}" == reserved-public ]]; then + ZROK2_CMD="reserve public --json-output ${ZROK2_VERBOSE:-}" +elif [[ "${ZROK2_FRONTEND_MODE:-}" == reserved-private ]]; then + ZROK2_CMD="reserve private --json-output ${ZROK2_VERBOSE:-}" +else + echo "ERROR: invalid value for ZROK2_FRONTEND_MODE '${ZROK2_FRONTEND_MODE}'" >&2 + exit 1 +fi + +[[ -n "${ZROK2_BACKEND_MODE:-}" ]] || { + echo "WARNING: ZROK2_BACKEND_MODE was not defined, assuming mode 'proxy'." >&2 + ZROK2_BACKEND_MODE="proxy" +} + +case "${ZROK2_BACKEND_MODE}" in + proxy) + if ! [[ "${ZROK2_TARGET}" =~ ^https?:// ]]; then + echo "ERROR: ZROK2_TARGET='${ZROK2_TARGET}' is not an HTTP URL" >&2 + exit 1 + else + echo "INFO: validated backend mode '${ZROK2_BACKEND_MODE}' and target '${ZROK2_TARGET}'" + fi + ;; + caddy) + if ! [[ "${ZROK2_TARGET}" =~ ^/ ]]; then + echo "ERROR: ZROK2_TARGET='${ZROK2_TARGET}' is not an absolute filesystem path" >&2 + exit 1 + elif ! [[ -f "${ZROK2_TARGET}" && -r "${ZROK2_TARGET}" ]]; then + echo "ERROR: ZROK2_TARGET='${ZROK2_TARGET}' is not a readable regular file" >&2 + exit 1 + else + echo "INFO: validated backend mode ${ZROK2_BACKEND_MODE} and target ${ZROK2_TARGET}" + fi + ;; + web|drive) + if ! [[ "${ZROK2_TARGET}" =~ ^/ ]]; then + echo "ERROR: ZROK2_TARGET='${ZROK2_TARGET}' is not an absolute filesystem path" >&2 + exit 1 + elif ! [[ -d "${ZROK2_TARGET}" && -r "${ZROK2_TARGET}" ]]; then + echo "ERROR: ZROK2_TARGET='${ZROK2_TARGET}' is not a readable directory" >&2 + exit 1 + else + echo "INFO: validated backend mode ${ZROK2_BACKEND_MODE} and target ${ZROK2_TARGET}" + fi + ;; + tcpTunnel|udpTunnel|socks) + if ! [[ "${ZROK2_FRONTEND_MODE}" =~ -private$ ]]; then + echo "ERROR: ZROK2_BACKEND_MODE='${ZROK2_BACKEND_MODE}' is a private share backend mode and cannot be used with ZROK2_FRONTEND_MODE='${ZROK2_FRONTEND_MODE}'" >&2 + exit 1 + else + case "${ZROK2_BACKEND_MODE}" in + tcpTunnel|udpTunnel) + echo "INFO: ${ZROK2_BACKEND_MODE} backend mode has target '${ZROK2_TARGET}'" + ;; + socks) + if [[ -n "${ZROK2_TARGET}" ]]; then + echo "WARNING: ZROK2_TARGET='${ZROK2_TARGET}' is ignored with ZROK2_BACKEND_MODE='${ZROK2_BACKEND_MODE}'" >&2 + unset ZROK2_TARGET + fi + ;; + esac + fi + ;; + *) + echo "WARNING: ZROK2_BACKEND_MODE='${ZROK2_BACKEND_MODE}' is not a recognized mode for a zrok public share."\ + " ZROK2_TARGET value will not validated before running." >&2 + ;; +esac + +if [[ "${ZROK2_FRONTEND_MODE:-}" =~ ^reserved- && -n "${ZROK2_UNIQUE_NAME:-}" ]]; then + ZROK2_CMD+=" --unique-name ${ZROK2_UNIQUE_NAME}" +elif [[ -n "${ZROK2_UNIQUE_NAME:-}" ]]; then + echo "WARNING: ZROK2_UNIQUE_NAME='${ZROK2_UNIQUE_NAME}' is ignored with ZROK2_FRONTEND_MODE='${ZROK2_FRONTEND_MODE}'" >&2 +fi + +if [[ "${ZROK2_FRONTEND_MODE:-}" =~ -private$ && "${ZROK2_PERMISSION_MODE:-}" == closed ]]; then + ZROK2_CMD+=" --closed" + if [[ -n "${ZROK2_ACCESS_GRANTS:-}" ]]; then + for ACCESS_GRANT in ${ZROK2_ACCESS_GRANTS}; do + ZROK2_CMD+=" --access-grant ${ACCESS_GRANT}" + done + else + echo "WARNING: ZROK2_PERMISSION_MODE='${ZROK2_PERMISSION_MODE}' and no additional ZROK2_ACCESS_GRANTS; will be granted access" >&2 + fi +elif [[ "${ZROK2_FRONTEND_MODE:-}" =~ -private$ && -n "${ZROK2_PERMISSION_MODE:-}" && "${ZROK2_PERMISSION_MODE}" != open ]]; then + echo "WARNING: ZROK2_PERMISSION_MODE='${ZROK2_PERMISSION_MODE}' is not a recognized value'" >&2 +elif [[ "${ZROK2_FRONTEND_MODE:-}" =~ -public$ && -n "${ZROK2_PERMISSION_MODE:-}" ]]; then + echo "WARNING: ZROK2_PERMISSION_MODE='${ZROK2_PERMISSION_MODE}' is ignored with ZROK2_FRONTEND_MODE='${ZROK2_FRONTEND_MODE}'" >&2 +fi + +ZROK2_CMD+=" --backend-mode ${ZROK2_BACKEND_MODE} ${ZROK2_TARGET}" + +if [[ -n "${ZROK2_SHARE_OPTS:-}" ]]; then + ZROK2_CMD+=" ${ZROK2_SHARE_OPTS}" +fi + +if [[ -n "${ZROK2_OAUTH_PROVIDER:-}" ]]; then + ZROK2_CMD+=" --oauth-provider ${ZROK2_OAUTH_PROVIDER}" + if [[ -n "${ZROK2_OAUTH_EMAILS:-}" ]]; then + for EMAIL in ${ZROK2_OAUTH_EMAILS}; do + ZROK2_CMD+=" --oauth-email-address-pattern ${EMAIL}" + done + fi +elif [[ -n "${ZROK2_BASIC_AUTH:-}" ]]; then + ZROK2_CMD+=" --basic-auth ${ZROK2_BASIC_AUTH}" +fi + +if [[ "${ZROK2_FRONTEND_MODE:-}" =~ ^temp- ]]; then + # frontend mode starts with 'temp-', so is temporary. + # share without reserving until exit. + exec_with_common_opts ${ZROK2_CMD} +else + # reserve and continue + zrok2 ${ZROK2_CMD} > "${ZROK2_RESERVATION_FILE}" + # share the reserved backend target until exit + if ! [[ -s "${ZROK2_RESERVATION_FILE}" ]]; then + echo "ERROR: empty or missing $(realpath "${ZROK2_RESERVATION_FILE}")" >&2 + exit 1 + elif ! jq . < "${ZROK2_RESERVATION_FILE}" &>/dev/null; then + echo "ERROR: invalid JSON in $(realpath "${ZROK2_RESERVATION_FILE}")" >&2 + exit 1 + else + if [[ "${ZROK2_FRONTEND_MODE:-}" == reserved-public ]]; then + ZROK2_PUBLIC_URLS=$(jq -cr '.frontend_endpoints' "${ZROK2_RESERVATION_FILE}" 2>/dev/null) + if [[ -z "${ZROK2_PUBLIC_URLS}" || "${ZROK2_PUBLIC_URLS}" == null ]]; then + echo "ERROR: frontend endpoints not defined in $(realpath "${ZROK2_RESERVATION_FILE}")" >&2 + exit 1 + else + echo "INFO: zrok public URLs: ${ZROK2_PUBLIC_URLS}" + fi + fi + ZROK2_RESERVATION_TOKEN=$(jq -r '.token' "${ZROK2_RESERVATION_FILE}" 2>/dev/null) + if [[ -z "${ZROK2_RESERVATION_TOKEN}" || "${ZROK2_RESERVATION_TOKEN}" == null ]]; then + echo "ERROR: zrok reservation token not defined in $(realpath "${ZROK2_RESERVATION_FILE}")" >&2 + exit 1 + fi + ZROK2_CMD="${ZROK2_RESERVATION_TOKEN} ${ZROK2_TARGET}" + if [[ "${ZROK2_SHARE_RESERVED}" == true ]]; then + exec_share_reserved ${ZROK2_CMD} + else + echo "INFO: finished reserving zrok backend, continuing without sharing" + exit 0 + fi + fi +fi diff --git a/nfpm/zrok-share.env b/nfpm/zrok2-share.env similarity index 64% rename from nfpm/zrok-share.env rename to nfpm/zrok2-share.env index 3667227f..0d668867 100644 --- a/nfpm/zrok-share.env +++ b/nfpm/zrok2-share.env @@ -1,34 +1,34 @@ -# These values are sourced by the zrok-share.service. Search for "MUST" to identify the values that need to be changed. +# These values are sourced by the zrok2-share.service. Search for "MUST" to identify the values that need to be changed. # ## ZROK ENVIRONMENT # # The variables in this section are not used by user units, i.e., systemctl --user, because it is assumed the user's -# environment in ~/.zrok is already enabled. The variables in this section are required by system-wide service units. +# environment in ~/.zrok2 is already enabled. The variables in this section are required by system-wide service units. # For system services, you MUST enable a zrok environment by setting the account token here. This file must # be readable by 'other'. Obtain the account token from the zrok console. # -# WARNING: changing these values has no effect if /var/lib/zrok-share/.zrok/environment.json exists. Remove that file to -# enable a new environment and /var/lib/zrok-share/.zrok/reserved.json to provision a new frontend URL for the specified +# WARNING: changing these values has no effect if /var/lib/zrok2-share/.zrok2/environment.json exists. Remove that file to +# enable a new environment and /var/lib/zrok2-share/.zrok2/reserved.json to provision a new frontend URL for the specified # target. # -ZROK_ENABLE_TOKEN="" +ZROK2_ENABLE_TOKEN="" # # You MAY customize the environment name that appears in the zrok console. # -ZROK_ENVIRONMENT_NAME="" +ZROK2_ENVIRONMENT_NAME="" # You MUST set this if not using the default API endpoint -#ZROK_API_ENDPOINT="https://api-v2.zrok.io" +#ZROK2_API_ENDPOINT="https://api-v2.zrok.io" # ## ZROK BACKEND MODE AND TARGET # # You MUST define the backend target and mode. The frontend URL will be provisioned when the service starts. You MAY -# change ZROK_TARGET and frontend URL will remain the same after a restart as long as the backend mode and frontend +# change ZROK2_TARGET and frontend URL will remain the same after a restart as long as the backend mode and frontend # authentication options are the same. Options that require provisioning a new frontend URL when changed are marked with -# WARNING. You may delete /var/lib/zrok-share/.zrok/reserved.json and restart the service to provision a new frontend URL. +# WARNING. You may delete /var/lib/zrok2-share/.zrok2/reserved.json and restart the service to provision a new frontend URL. # ## BACKEND MODES THAT WORK WITH PUBLIC AND PRIVATE HTTP SHARES @@ -36,77 +36,77 @@ ZROK_ENVIRONMENT_NAME="" # backend-mode "proxy" (default): share a backend web server URL that's reachable by this host; must begin with 'http://' or # 'https://'; must accept the HOST header of the proxy frontend. Check out backend mode "caddy" if you need more control. -ZROK_BACKEND_MODE="proxy" -ZROK_TARGET="" # e.g., http://127.0.0.1:3000 +ZROK2_BACKEND_MODE="proxy" +ZROK2_TARGET="" # e.g., http://127.0.0.1:3000 # if defined, an https share's backend server certificate will not be verified with backend-mode 'proxy' # NOTE: changing this value does not require provisioning a new frontend URL -#ZROK_INSECURE="--insecure" +#ZROK2_INSECURE="--insecure" # backend-mode "web": run a web server and share a static HTML directory that's present on this host. Must be an # absolute path to a directory that is readable by 'other' -#ZROK_BACKEND_MODE="web" -#ZROK_TARGET="/var/www/html" +#ZROK2_BACKEND_MODE="web" +#ZROK2_TARGET="/var/www/html" # backend-mode "drive": run a WebDAV file server sharing a directory that's present on this host. Must be an absolute # path to a directory that is readable by 'other' -#ZROK_BACKEND_MODE="drive" -#ZROK_TARGET="/usr/share/doc" +#ZROK2_BACKEND_MODE="drive" +#ZROK2_TARGET="/usr/share/doc" # backend-mode "caddy": run an embedded Caddy server configured by the supplied Caddyfile. Must be an absolute path that # is readable by 'other'. -#ZROK_BACKEND_MODE="caddy" -#ZROK_TARGET="/opt/openziti/etc/zrok/multiple_upstream.Caddyfile" +#ZROK2_BACKEND_MODE="caddy" +#ZROK2_TARGET="/opt/openziti/etc/zrok2/multiple_upstream.Caddyfile" # ## BACKEND MODES THAT ONLY WORK WITH PRIVATE SHARES # -# you MUST set ZROK_FRONTEND_MODE to 'reserved-private' or 'temp-private' to use private share backend modes +# you MUST set ZROK2_FRONTEND_MODE to 'reserved-private' or 'temp-private' to use private share backend modes -#ZROK_BACKEND_MODE="tcpTunnel" -#ZROK_TARGET="127.0.0.1:25565" +#ZROK2_BACKEND_MODE="tcpTunnel" +#ZROK2_TARGET="127.0.0.1:25565" -#ZROK_BACKEND_MODE="udpTunnel" -#ZROK_TARGET="127.0.0.1:53" +#ZROK2_BACKEND_MODE="udpTunnel" +#ZROK2_TARGET="127.0.0.1:53" # there is no target for socks mode because the share is only a dynamic exit for the proxy client -#ZROK_BACKEND_MODE="socks" -#ZROK_TARGET="" +#ZROK2_BACKEND_MODE="socks" +#ZROK2_TARGET="" # -## ZROK FRONTEND +## ZROK FRONTEND # # you MAY customize the share token that is used to construct the reserved subdomain; if not set a random # subdomain is reserved; lowercase alphanumeric, between 4 and 32 characters in length # WARNING: changes take effect the next time the frontend URL is reserved -#ZROK_UNIQUE_NAME="" +#ZROK2_UNIQUE_NAME="" # you MAY set one OAuth2/OIDC provider; "google" and "github" are valid for the default instance api-v2.zrok.io # WARNING: changes take effect the next time the frontend URL is reserved # NOTE: basic auth and oauth are mutually exclusive -#ZROK_OAUTH_PROVIDER="google" +#ZROK2_OAUTH_PROVIDER="google" # you MAY restrict access to one or more email addresses or domains; must be a space-separate list # WARNING: changes take effect the next time the frontend URL is reserved -#ZROK_OAUTH_EMAILS="alice@example.com *@acme.example.com" +#ZROK2_OAUTH_EMAILS="alice@example.com *@acme.example.com" # you MAY require a password with HTTP basic authentication # WARNING: changes take effect the next time the frontend URL is reserved # NOTE: basic auth and oauth are mutually exclusive -#ZROK_BASIC_AUTH="" +#ZROK2_BASIC_AUTH="" # set if self-hosting zrok and not using only the default frontend name 'public'; must be a space-separated list # WARNING: changes take effect the next time the frontend URL is reserved -#ZROK_FRONTENDS="public" +#ZROK2_FRONTENDS="public" -# you MAY set to change the frontend mode: reserved-public (default), reserved-private, temp-public, temp-private -#ZROK_FRONTEND_MODE="reserved-public" +# you MAY set to change the frontend mode: reserved-public (default), reserved-private, temp-public, temp-private +#ZROK2_FRONTEND_MODE="reserved-public" # you MAY restrict access to a private share allowing only your own zrok account -#ZROK_PERMISSION_MODE="closed" +#ZROK2_PERMISSION_MODE="closed" # if permission mode "closed" - space-separated list of additional zrok account emails to grant access with the share token -#ZROK_ACCESS_GRANTS="" +#ZROK2_ACCESS_GRANTS="" # @@ -115,7 +115,7 @@ ZROK_TARGET="" # e.g., http://127.0.0.1:3000 # DEBUG log level # NOTE: changing this value does not require provisioning a new frontend URL -#ZROK_VERBOSE="--verbose" +#ZROK2_VERBOSE="--verbose" -# you MAY set additional command-line options for the share; see "zrok reserve public --help" for hints -ZROK_SHARE_OPTS="" +# you MAY set additional command-line options for the share; see "zrok2 reserve public --help" for hints +ZROK2_SHARE_OPTS="" diff --git a/nfpm/zrok2-share.service b/nfpm/zrok2-share.service new file mode 100644 index 00000000..abb88366 --- /dev/null +++ b/nfpm/zrok2-share.service @@ -0,0 +1,17 @@ +[Unit] +Description=zrok2 share service +After=network-online.target + +[Service] +Type=simple +DynamicUser=yes +StateDirectory=zrok2-share +UMask=0007 +EnvironmentFile=/opt/openziti/etc/zrok2/zrok2-share.env +ExecStartPre=/opt/openziti/bin/zrok2-enable.bash +ExecStart=/opt/openziti/bin/zrok2-share.bash +Restart=always +RestartSec=3 + +[Install] +WantedBy=multi-user.target diff --git a/nfpm/zrok2-share@.service b/nfpm/zrok2-share@.service new file mode 100644 index 00000000..7f589e23 --- /dev/null +++ b/nfpm/zrok2-share@.service @@ -0,0 +1,17 @@ + +# /usr/lib/systemd/user/zrok2-share@.service + +[Unit] +Description=zrok2 share user service unit @%i +After=network-online.target + +[Service] +Type=simple +UMask=0007 +EnvironmentFile=%h/.zrok2/zrok2-share@%i.env +ExecStart=/opt/openziti/bin/zrok2-share.bash @%i +Restart=always +RestartSec=3 + +[Install] +WantedBy=default.target diff --git a/sdk/golang/sdk/access.go b/sdk/golang/sdk/access.go index 753a73ff..e059f0bc 100644 --- a/sdk/golang/sdk/access.go +++ b/sdk/golang/sdk/access.go @@ -10,7 +10,7 @@ import ( func CreateAccess(root env_core.Root, request *AccessRequest) (*Access, error) { if !root.IsEnabled() { - return nil, errors.New("environment is not enabled; enable with 'zrok enable' first!") + return nil, errors.New("environment is not enabled; enable with 'zrok2 enable' first!") } out := share.NewAccessParams() diff --git a/sdk/golang/sdk/overview.go b/sdk/golang/sdk/overview.go index f48f50cc..6daba635 100644 --- a/sdk/golang/sdk/overview.go +++ b/sdk/golang/sdk/overview.go @@ -10,7 +10,7 @@ import ( func Overview(root env_core.Root) (string, error) { if !root.IsEnabled() { - return "", errors.New("environment is not enabled; enable with 'zrok enable' first!") + return "", errors.New("environment is not enabled; enable with 'zrok2 enable' first!") } client := &http.Client{} diff --git a/sdk/golang/sdk/share.go b/sdk/golang/sdk/share.go index 6be3d39a..d14854d5 100644 --- a/sdk/golang/sdk/share.go +++ b/sdk/golang/sdk/share.go @@ -12,7 +12,7 @@ import ( func CreateShare(root env_core.Root, request *ShareRequest) (*Share, error) { if !root.IsEnabled() { - return nil, errors.New("environment is not enabled; enable with 'zrok enable' first!") + return nil, errors.New("environment is not enabled; enable with 'zrok2 enable' first!") } var err error diff --git a/website/docs/concepts/files.md b/website/docs/concepts/files.md index 9b436618..9b544d7b 100644 --- a/website/docs/concepts/files.md +++ b/website/docs/concepts/files.md @@ -4,7 +4,7 @@ sidebar_position: 30 --- With `zrok` it is possible to share files quickly and easily as well. To share files using `zrok` use -the `--backend-mode web`, for example: `zrok share private . --backend-mode web`. +the `--backend-mode web`, for example: `zrok2 share private . --backend-mode web`. Running with this mode will make it trivially easy to share files from the directory which the command was run from. @@ -21,7 +21,7 @@ For example if you have a directory with a structure like this: The files can be shared using a command such as: ```shell -zrok share public --backend-mode web . +zrok2 share public --backend-mode web . ``` Then the files can be access with a `private` or `public` share, for example as shown: diff --git a/website/docs/concepts/http.md b/website/docs/concepts/http.md index 19c9945e..a1a48ac1 100644 --- a/website/docs/concepts/http.md +++ b/website/docs/concepts/http.md @@ -4,14 +4,14 @@ sidebar_position: 22 # Sharing HTTP Servers -`zrok` can share HTTP and HTTPS resources natively. If you have an existing web server that you want to share with other users, you can use the `zrok share` command using the `--backend-mode proxy` flag. +zrok can share HTTP and HTTPS resources natively. If you have an existing web server that you want to share with other users, you can use the `zrok2 share` command using the `--backend-mode proxy` flag. The `--backend-mode proxy` is the default backend mode, so if you do not specify a `--backend-mode` you will get the `proxy` mode by default. If you have a web server running on `localhost` that you want to expose to other users using `zrok`, you can execute a command like the following: ``` -$ zrok share public localhost:8080 +$ zrok2 share public localhost:8080 ``` When you execute this command, you'll get a `zrok` bridge like the following: diff --git a/website/docs/concepts/sharing-private.mdx b/website/docs/concepts/sharing-private.mdx index 1fa3087b..9793bb37 100644 --- a/website/docs/concepts/sharing-private.mdx +++ b/website/docs/concepts/sharing-private.mdx @@ -19,23 +19,23 @@ Here's how private sharing works: ![zrok_public_share](../images/zrok_private_share.png) -`private` shares are accessed using the `zrok access` command, and require the accessing user to have a `zrok enable`-d account on the same service instance where the share was created. +`private` shares are accessed using the `zrok2 access` command, and require the accessing user to have a `zrok2 enable`-d account on the same service instance where the share was created. -The `private` share is identified by a _share token_. The accessing user will use the share token, along with the `zrok access` command to create a local endpoint on their system, which lets them use the shared resource as if it were local to their system. +The `private` share is identified by a _share token_. The accessing user will use the share token, along with the `zrok2 access` command to create a local endpoint on their system, which lets them use the shared resource as if it were local to their system. -`zrok` does not require you to open any firewall ports or otherwise compromise the security of your local system; there is never an attack surface open to the public internet. As soon as you terminate the `zrok share` process, you immediately terminate any possible access to your shared resource. +`zrok` does not require you to open any firewall ports or otherwise compromise the security of your local system; there is never an attack surface open to the public internet. As soon as you terminate the `zrok2 share` process, you immediately terminate any possible access to your shared resource. The shared resource can be a development web server to share with friends and colleagues, a webhook from a server running in the cloud which has `zrok` running and has been instructed to `access` the private resource. `zrok` can also share files, websites, and low-level TCP and UDP network connections using the `tunnel` backend. What matters is that the access to the shared resource is not done in a public way, and can only be accessed by other `zrok` users that have access to your share token. The peer-to-peer capabilities of `zrok` are an important property of the underlying [OpenZiti](https://docs.openziti.io/docs/learn/introduction/) network that `zrok` uses to provide connectivity between users and resources. -Creating `private` shares is easy and is accomplished using the `zrok share private` command. Run `zrok share private` to see the usage output and to further learn how to use the command. +Creating `private` shares is easy and is accomplished using the `zrok2 share private` command. Run `zrok2 share private` to see the usage output and to further learn how to use the command. :::tip v2.0 persistent private shares In zrok v2.0, you can create persistent private shares using the `--share-token` flag: ```bash -zrok share private localhost:8080 --share-token my-api +zrok2 share private localhost:8080 --share-token my-api ``` This creates a private share with a custom vanity token that persists across share restarts. When using the zrok agent, shares with `--share-token` automatically restart after abnormal exit or agent restart. See [reserved names and namespaces](./sharing-reserved.md) for more details. @@ -46,7 +46,7 @@ This creates a private share with a custom vanity token that persists across sha The default backend mode is `proxy` which targets an HTTP URL that must be reachable by the backend. ```bash title="proxy example" -zrok share private 80 +zrok2 share private 80 ``` diff --git a/website/docs/concepts/sharing-public.mdx b/website/docs/concepts/sharing-public.mdx index 4f5fe0ba..ec08a25d 100644 --- a/website/docs/concepts/sharing-public.mdx +++ b/website/docs/concepts/sharing-public.mdx @@ -16,17 +16,17 @@ import BackendHttp from './_backend_http.mdx' As with `private` sharing, `public` sharing does not require you to open any firewall ports or otherwise compromise the security of your local environments. A `public` share goes away as soon as you terminate the `zrok share` command. -Using `public` shares is easy and is accomplished using the `zrok share public` command. Run `zrok share public` to see the command-line help and to learn how to use `public` shares. +Using `public` shares is easy and is accomplished using the `zrok2 share public` command. Run `zrok2 share public` to see the command-line help and to learn how to use `public` shares. :::tip v2.0 persistent public shares In zrok v2.0, you can create persistent public shares using reserved names in namespaces: ```bash # create a reserved name -zrok create name -n public myapp +zrok2 create name -n public myapp # share using the name -zrok share public localhost:8080 -n public:myapp +zrok2 share public localhost:8080 -n public:myapp ``` This allows you to maintain the same public URL across multiple share sessions. See [reserved names and namespaces](./sharing-reserved.md) for comprehensive details about the v2.0 namespace/name system. @@ -37,7 +37,7 @@ This allows you to maintain the same public URL across multiple share sessions. The default backend mode is `proxy` which targets an HTTP URL that must be reachable by the backend. ```bash title="proxy example" -zrok share public 80 +zrok2 share public 80 ``` diff --git a/website/docs/concepts/sharing-reserved.md b/website/docs/concepts/sharing-reserved.md index 495d8da9..75f4d98c 100644 --- a/website/docs/concepts/sharing-reserved.md +++ b/website/docs/concepts/sharing-reserved.md @@ -8,7 +8,7 @@ sidebar_position: 10 This guide describes the v2.0 namespace and name system. If you're migrating from v1.x, see the [v2 migration guide](/guides/v2-migration-guide.md) for details on how this replaces the old `zrok reserve` workflow. ::: -By default, when you create a `public` or `private` share using the `zrok share` command, zrok assigns it a randomly generated _share token_. When you terminate the `zrok share` command, the share is deleted and the token is no longer valid. If you run `zrok share` again, you will receive a brand new share token. +By default, when you create a `public` or `private` share using the `zrok2 share` command, zrok assigns it a randomly generated _share token_. When you terminate the `zrok2 share` command, the share is deleted and the token is no longer valid. If you run `zrok2 share` again, you will receive a brand new share token. In v2.0, zrok introduces a more powerful system for creating persistent shares through **namespaces** and **names**. @@ -28,7 +28,7 @@ Namespaces can be: You can see available namespaces with: ```bash -zrok list namespaces +zrok2 list namespaces ``` ### Names @@ -42,17 +42,17 @@ Think of names as similar to DNS A records within a zone. For example, if you cr ## Creating Reserved Names -To create a reserved name, use the `zrok create name` command: +To create a reserved name, use the `zrok2 create name` command: ```bash # create a reserved name in the default namespace -zrok create name myapp +zrok2 create name myapp # create a reserved name in a specific namespace -zrok create name -n public myapp +zrok2 create name -n public myapp # create a reserved name in a custom namespace -zrok create name -n api +zrok2 create name -n api ``` Once created, you can use this name repeatedly across share sessions. The name persists even when your share is not running. @@ -65,13 +65,13 @@ Use the `-n` flag to specify a name selection when creating a public share: ```bash # share using a name in the default namespace -zrok share public localhost:8080 -n public:myapp +zrok2 share public localhost:8080 -n public:myapp # share using a name in a specific namespace -zrok share public localhost:8080 -n :api +zrok2 share public localhost:8080 -n :api ``` -The name can be either reserved (created with `zrok create name`) or ephemeral (created on-the-fly). +The name can be either reserved (created with `zrok2 create name`) or ephemeral (created on-the-fly). ### Private Shares with Custom Tokens @@ -79,10 +79,10 @@ For private shares, you can use the `--share-token` flag to specify a persistent ```bash # create a private share with a custom token -zrok share private localhost:8080 --share-token myapi-prod +zrok2 share private localhost:8080 --share-token myapi-prod # access it from another environment -zrok access private myapi-prod +zrok2 access private myapi-prod ``` When using the zrok agent, shares with `--share-token` are automatically persistent and will restart after abnormal exit or agent restart. @@ -93,11 +93,11 @@ A powerful v2.0 feature: you can specify multiple names for a single share: ```bash # create multiple names -zrok create name -n public myapp -zrok create name -n public myapp-staging +zrok2 create name -n public myapp +zrok2 create name -n public myapp-staging # share using both names -zrok share public localhost:3000 \ +zrok2 share public localhost:3000 \ -n public:myapp \ -n public:myapp-staging ``` @@ -111,7 +111,7 @@ Both URLs will point to the same backend target, allowing you to use different n See all your names across all namespaces: ```bash -zrok list names +zrok2 list names ``` This shows a table with: @@ -128,10 +128,10 @@ Toggle the reserved status of a name: ```bash # make a name reserved (persistent) -zrok modify name -n public myapp -r +zrok2 modify name -n public myapp -r # make a name ephemeral (will be deleted when share ends) -zrok modify name -n public myapp -r=false +zrok2 modify name -n public myapp -r=false ``` ### Deleting Names @@ -140,10 +140,10 @@ Remove a reserved name when you no longer need it: ```bash # delete a name from the default namespace -zrok delete name myapp +zrok2 delete name myapp # delete a name from a specific namespace -zrok delete name -n api +zrok2 delete name -n api ``` ## Configuring Default Namespace @@ -152,18 +152,18 @@ You can set a default namespace to avoid specifying `-n` on every command: ```bash # set via config command -zrok config set defaultNamespace public +zrok2 config set defaultNamespace public # or via environment variable -export ZROK_DEFAULT_NAMESPACE=public +export ZROK2_DEFAULT_NAMESPACE=public ``` Once configured, commands will use this namespace by default: ```bash # these are equivalent if defaultNamespace is set to 'public' -zrok create name myapp -zrok create name -n public myapp +zrok2 create name myapp +zrok2 create name -n public myapp ``` ## Migration from v1.x @@ -172,10 +172,10 @@ If you're coming from zrok v1.x, here's the mapping: | v1.x Command | v2.0 Equivalent | |--------------|-----------------| -| `zrok reserve public ` | `zrok create name ` + `zrok share public -n :` | -| `zrok share reserved ` | `zrok share public -n :` | -| `zrok release ` | `zrok delete name ` | -| `zrok reserve private ` | `zrok share private --share-token ` | +| `zrok2 reserve public ` | `zrok2 create name ` + `zrok2 share public -n :` | +| `zrok2 share reserved ` | `zrok2 share public -n :` | +| `zrok2 release ` | `zrok2 delete name ` | +| `zrok2 reserve private ` | `zrok2 share private --share-token ` | See the [v2 migration guide](/guides/v2-migration-guide.md) for comprehensive migration instructions. diff --git a/website/docs/concepts/tunnels.md b/website/docs/concepts/tunnels.md index ac2bbc36..4c2581f1 100644 --- a/website/docs/concepts/tunnels.md +++ b/website/docs/concepts/tunnels.md @@ -8,18 +8,18 @@ sidebar_position: 25 As of version `v0.4`, `zrok` supports sharing TCP and UDP network resources using `private` sharing. -To share a raw network resource using `zrok`, you'll want to use the `zrok share private` command from your `enable`-d environment, like this: +To share a raw network resource using `zrok`, you'll want to use the `zrok2 share private` command from your `enable`-d environment, like this: ``` -$ zrok share private --backend-mode tcpTunnel 192.168.9.1:22 +$ zrok2 share private --backend-mode tcpTunnel 192.168.9.1:22 ``` This will result in a share client starting, which looks like this: ``` -╭───────────────────────────────────────────────────────────╮╭────────────────────╮ -│ access your share with: zrok access private 5adagwfl888k ││[PRIVATE][TCPTUNNEL]│ -╰───────────────────────────────────────────────────────────╯╰────────────────────╯ +╭────────────────────────────────────────────────────────────╮╭────────────────────╮ +│ access your share with: zrok2 access private 5adagwfl888k ││[PRIVATE][TCPTUNNEL]│ +╰────────────────────────────────────────────────────────────╯╰────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────╮ │ │ │ │ @@ -28,10 +28,10 @@ This will result in a share client starting, which looks like this: ╰─────────────────────────────────────────────────────────────────────────────────╯ ``` -Then on the system where you want to access your shared resource (an SSH endpoint in this case), you'll need an `enable`-d `zrok` environment. Run the following command (shown in the banner at the top of the `zrok share` client above): +Then on the system where you want to access your shared resource (an SSH endpoint in this case), you'll need an `enable`-d `zrok` environment. Run the following command (shown in the banner at the top of the `zrok2 share` client above): ``` -$ zrok access private 5adagwfl888k +$ zrok2 access private 5adagwfl888k ``` This will start an `access` client on this system: @@ -56,9 +56,9 @@ SSH-2.0-OpenSSH_9.2 FreeBSD-openssh-portable-9.2.p1,1 And both the `share` client and the `access` client show the traffic: ``` -╭──────────────────────────────────────────────────────────╮╭─────────────────────╮ -│ access your share with: zrok access private 5adagwfl888k ││[PRIVATE] [TCPTUNNEL]│ -╰──────────────────────────────────────────────────────────╯╰─────────────────────╯ +╭───────────────────────────────────────────────────────────╮╭─────────────────────╮ +│ access your share with: zrok2 access private 5adagwfl888k ││[PRIVATE] [TCPTUNNEL]│ +╰───────────────────────────────────────────────────────────╯╰─────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────╮ │Friday, 23-Jun-23 15:33:10 EDT ziti-edge-router │ │connId=2147483648, logical=ziti- │ @@ -82,4 +82,4 @@ And both the `share` client and the `access` client show the traffic: Exit the `access` client to remove the local access to the shared TCP port. Exit the `share` client to disable further accesses to the shared resource. -For UDP network resources just use the `zrok share private --backend-mode udpTunnel` instead of `tcpTunnel`. +For UDP network resources just use the `zrok2 share private --backend-mode udpTunnel` instead of `tcpTunnel`. diff --git a/website/docs/getting-started.mdx b/website/docs/getting-started.mdx index 55a6d1e4..12866987 100644 --- a/website/docs/getting-started.mdx +++ b/website/docs/getting-started.mdx @@ -66,13 +66,13 @@ Here's a quick overview of what's involved in getting started with `zrok`: 3. Enable zrok for your [environment](#enabling-your-zrok-environment) ```bash - zrok enable + zrok2 enable ``` 4. Share `http://localhost:8080` ```bash - zrok share public 8080 + zrok2 share public 8080 ``` 5. Visit the public URL displayed in your terminal @@ -91,7 +91,7 @@ Here's a deeper, more thorough look at getting started with `zrok`: After you have [an account](#your-first-share), you can enable your `zrok` environment. -A zrok environment usually refers to an enabled device where shares and accesses can be created, .e.g., `~/.zrok` on a Unix machine. It can be a specific user's environment or a system-wide agent's environment owned by the administrator. +A zrok environment usually refers to an enabled device where shares and accesses can be created, .e.g., `~/.zrok2` on a Unix machine. It can be a specific user's environment or a system-wide agent's environment owned by the administrator. When your `zrok` account was created, the service generated an _account token_ that identifies and authenticates in a single step. Protect your account token as if it were a password, or an important account number; it's a _secret_, protect it. @@ -111,24 +111,24 @@ In the toolbar, there is a big green button that says "CLICK HERE TO GET STARTED This wizard is broken into multiple steps. The first step we've already covered, which gets the zrok software installed onto your system. -Below "step 2" is a command: `zrok enable 7g3K6gVKikWb` (your account will have a different account token, other than `7g3K6gVKikWb`). You'll want to copy this command into your shell and execute it: +Below "step 2" is a command: `zrok2 enable 7g3K6gVKikWb` (your account will have a different account token, other than `7g3K6gVKikWb`). You'll want to copy this command into your shell and execute it: ```txt -$ zrok enable 7g3K6gVKikWb +$ zrok2 enable 7g3K6gVKikWb ⣻ contacting the zrok service... ``` After a few seconds, the message will change and indicate that the enable operation succeeded: ```txt -$ zrok enable 7g3K6gVKikWb +$ zrok2 enable 7g3K6gVKikWb ⣻ the zrok environment was successfully enabled... ``` -Now, if we run a `zrok status` command, you will see the details of your environment: +Now, if we run a `zrok2 status` command, you will see the details of your environment: ```txt -$ zrok status +$ zrok2 status Config: @@ -153,7 +153,7 @@ If we return to the _API console_, we'll now see the new environment reflected i In my case, the environment is named `michael@testing`, which is the username of my shell and the hostname of the system the shell is running on. :::note -Should you want to use a non-default name for your environment, you can pass the `-d` option to the `zrok enable` command. See `zrok enable --help` for details. +Should you want to use a non-default name for your environment, you can pass the `-d` option to the `zrok2 enable` command. See `zrok2 enable --help` for details. ::: If you click on the environment node in the explorer in the _web console_, the details panel shown at the bottom of the page will change: @@ -163,7 +163,7 @@ If you click on the environment node in the explorer in the _web console_, the d The visualizer supports clicking, dragging, mouse wheel zooming, and selecting the nodes in the graph for more information (and available actions) for the selected node. If you ever get lost in the visualizer, click the ![Zoom to Fit](images/zrok-zoom-to-fit.png) _zoom to fit_ icon in the lower right corner of the explorer. :::note -With your `zrok` account you can `zrok enable` multiple environments. This will allow you to share (and access your shares) from multiple environments simultaneously. +With your `zrok` account you can `zrok2 enable` multiple environments. This will allow you to share (and access your shares) from multiple environments simultaneously. ::: Your environment is fully ready to go. Now we can move on to the fun stuff... @@ -174,7 +174,7 @@ Your environment is fully ready to go. Now we can move on to the fun stuff... ### Ephemeral by Default -Shared resources are _ephemeral_ by default; as soon as you terminate the `zrok share` command, the entire share is removed and is no longer available to any users. Identifiers for shared resources are randomly allocated when the share is created. +Shared resources are _ephemeral_ by default; as soon as you terminate the `zrok2 share` command, the entire share is removed and is no longer available to any users. Identifiers for shared resources are randomly allocated when the share is created. ### Public Shares and Frontends @@ -182,10 +182,10 @@ Resources that are shared _publicly_ are exposed to any users on the internet wh A frontend is an HTTPS listener exposed to the internet, that lets any user with your ephemeral share token access your publicly shared resources. -For example, I might create a public share using the `zrok share public` command, which results in my `zrok` instance exposing a URL like `https://xxr2b7tzfx64.share.zrok.io` to access my resources. +For example, I might create a public share using the `zrok2 share public` command, which results in my `zrok` instance exposing a URL like `https://xxr2b7tzfx64.share.zrok.io` to access my resources. ``` -$ zrok share public --backend-mode web . +$ zrok2 share public --backend-mode web . ``` In this case, my share was given the "share token" of `xxr2b7tzfx64`. That URL can be given to any user, allowing them to immediately access the shared resources directly from my local environment, all without exposing any access to my private, secure environment. The physical network location of my environment is not exposed to anonymous consumers of my resources. @@ -201,7 +201,7 @@ When we start accessing our share, notice the _sparkline_ graphs showing the act ![Environment Spark Line](images/zrok-visualizer-sparklines.png) -And as soon as I terminate the `zrok share` client, the resources are removed from the `zrok` environment. +And as soon as I terminate the `zrok2 share` client, the resources are removed from the `zrok` environment. If we try to reload the frontend endpoint in our web browser, we'll see: @@ -214,41 +214,41 @@ If we try to reload the frontend endpoint in our web browser, we'll see: `zrok` also provides a powerful _private_ sharing model. If I execute the following command: ```buttonless -$ zrok share private http://localhost:8080 +$ zrok2 share private http://localhost:8080 ``` The `zrok` service will respond with the following: ```buttonless title="Output" -access your share with: zrok access private wvszln4dyz9q +access your share with: zrok2 access private wvszln4dyz9q ``` -Rather than allowing access to your service through a public frontend, a _private_ share is only exposed to the underlying OpenZiti network, and can only be accessed using the `zrok access` command. +Rather than allowing access to your service through a public frontend, a _private_ share is only exposed to the underlying OpenZiti network, and can only be accessed using the `zrok2 access` command. -The `zrok access private wvszln4dyz9q` command can be run by any `zrok` user, allowing them to create and bind a local HTTP listener, that allows for private access to your shared resources. +The `zrok2 access private wvszln4dyz9q` command can be run by any `zrok` user, allowing them to create and bind a local HTTP listener, that allows for private access to your shared resources. [More about private shares](/concepts/sharing-private.mdx) ### Proxy Backend Mode -Without specifying a _backend mode_, the `zrok share` command will assume that you're trying to share a `proxy` resource. A `proxy` resource is usually some private HTTP/HTTPS endpoint (like a development server, or a private application) running in your local environment. Usually such an endpoint would have no inbound connectivity except for however it is reachable from your local environment. It might be running on `localhost`, or only listening on a private LAN segment behind a firewall. +Without specifying a _backend mode_, the `zrok2 share` command will assume that you're trying to share a `proxy` resource. A `proxy` resource is usually some private HTTP/HTTPS endpoint (like a development server, or a private application) running in your local environment. Usually such an endpoint would have no inbound connectivity except for however it is reachable from your local environment. It might be running on `localhost`, or only listening on a private LAN segment behind a firewall. For these services a `proxy` share will allow those endpoints to be reached, either _publicly_ or _privately_ through the `zrok` service. ### Web Backend Mode -The `zrok share` command accepts a `--backend-mode` option. Besides `proxy`, the current `v0.3` release (as of this writing) also supports a `web` mode. The `web` mode allows you to specify a local folder on your filesystem, and instantly turns your `zrok` client into a web server, exposing your web content either _publicly_ or _privately_ without having to a configure a web server. +The `zrok2 share` command accepts a `--backend-mode` option. Besides `proxy`, the current `v0.3` release (as of this writing) also supports a `web` mode. The `web` mode allows you to specify a local folder on your filesystem, and instantly turns your `zrok` client into a web server, exposing your web content either _publicly_ or _privately_ without having to a configure a web server. ### Reserved Shares `zrok` shares are _ephemeral_ unless you specifically create a "reserved" share. -A reserved share can be re-used multiple times; it will survive termination of the `zrok share` command, allowing for longer-lasting semi-permanent access to shared resources. +A reserved share can be re-used multiple times; it will survive termination of the `zrok2 share` command, allowing for longer-lasting semi-permanent access to shared resources. The first step is to create the reserved share: ```txt -$ zrok reserve public --backend-mode web v0.3_getting_started +$ zrok2 reserve public --backend-mode web v0.3_getting_started [ 0.275] INFO main.(*reserveCommand).run: your reserved share token is 'mltwsinym1s2' [ 0.275] INFO main.(*reserveCommand).run: reserved frontend endpoint: https://mltwsinym1s2.share.zrok.io ``` @@ -261,12 +261,12 @@ If we do nothing else, and then point a web browser at the frontend endpoint, we ![Not Found](images/zrok-reserved-not-found.png) -This is the `404` error message returned by the `zrok` frontend. We're getting this because we haven't yet started up a `zrok share` for the service. Let's do that: +This is the `404` error message returned by the `zrok` frontend. We're getting this because we haven't yet started up a `zrok2 share` for the service. Let's do that: This command: ```txt -$ zrok share reserved mltwsinym1s2 +$ zrok2 share reserved mltwsinym1s2 ``` ...results in a new share backend starting up and connecting to the existing reserved share: @@ -277,12 +277,12 @@ And now if we refresh the frontend endpoint URL in the web browser, we'll see an ![zrok docs share](images/zrok_web_console_share_frontend.png) -With the reserved share, we're free to stop and restart the `zrok share reserved` command as many times as we want, without losing the token for our share. +With the reserved share, we're free to stop and restart the `zrok2 share reserved` command as many times as we want, without losing the token for our share. When we're done with the reserved share, we can _release_ it using this command: ```txt -$ zrok release mltwsinym1s2 +$ zrok2 release mltwsinym1s2 [ 0.230] INFO main.(*releaseCommand).run: reserved share 'mltwsinym1s2' released ``` @@ -298,27 +298,27 @@ Here's a quick review of the `zrok` mental model and the vocabulary. You create an _account_ with a `zrok` _instance_. Your account is identified by a username and a password, which you use to log into the _web console_. Your account also has a _secret token_, which you will use to authenticate from the `zrok` command-line to interact with the _instance_. -You create a new _account_ with NetFoundry's `zrok` _instance_ by subscribing in [myzrok.io](https://myzrok.io) or in a self-hosted `zrok` _instance_ by running [the `zrok invite` command](./guides/self-hosting/self-service-invite.mdx) or the `zrok admin create account` command. +You create a new _account_ with NetFoundry's `zrok` _instance_ by subscribing in [myzrok.io](https://myzrok.io) or in a self-hosted `zrok` _instance_ by running [the `zrok2 invite` command](./guides/self-hosting/self-service-invite.mdx) or the `zrok2 admin create account` command. ### Environment -Using your _secret token_ you use the `zrok` command-line interface to create an _environment_. An _environment_ corresponds to a single command-line user on a specific _host system_. +Using your _secret token_ you use the `zrok` command-line interface to create an _environment_. An _environment_ corresponds to a single command-line user on a specific _host system_. -You create a new _environment_ by using the `zrok enable` command. +You create a new _environment_ by using the `zrok2 enable` command. ### Shares Once you've enabled an _environment_, you then create one or more _shares_. Shares have either a _public_ or _private_ _sharing mode_. _Shares_ share a specific type of resource using a _backend mode_. As of this writing `zrok` supports a `proxy` _backend mode_ to share local HTTP resources as a _reverse proxy_. `zrok` also supports a `web` _backend mode_ to share local file and HTML resources by enabling a basic HTTP server. -Every _share_ is identified by a _share token_. _Public shares_ can be accessed through either a _frontend_ instance offered through the `zrok` _instance_, or through the `zrok access` command. _Private shares_ can only be accessed through the `zrok access` command. +Every _share_ is identified by a _share token_. _Public shares_ can be accessed through either a _frontend_ instance offered through the `zrok` _instance_, or through the `zrok2 access` command. _Private shares_ can only be accessed through the `zrok2 access` command. -You use the `zrok share` command to create and enable _ephemeral shares_. +You use the `zrok2 share` command to create and enable _ephemeral shares_. ### Reserved Shares -`zrok` supports creating _shares_ that have a consistent _share token_ that survives restarts of the `zrok share` command. These are considered _non-ephemeral_, and is callled a _reserved share_. +`zrok` supports creating _shares_ that have a consistent _share token_ that survives restarts of the `zrok2 share` command. These are considered _non-ephemeral_, and is callled a _reserved share_. -You use the `zrok reserve` command to create _reserved shares_. Reserved shares last until you use the `zrok release` command to delete them. +You use the `zrok2 reserve` command to create _reserved shares_. Reserved shares last until you use the `zrok2 release` command to delete them. ## Self-Hosting an Instance diff --git a/website/docs/guides/_frontdoor-linux.mdx b/website/docs/guides/_frontdoor-linux.mdx index c0f557d2..66b0b8b9 100644 --- a/website/docs/guides/_frontdoor-linux.mdx +++ b/website/docs/guides/_frontdoor-linux.mdx @@ -10,35 +10,35 @@ import ConcatenateYamlSnippets from '@zrokroot/src/components/cat-yaml.jsx' Ansible Playbook {AnsibleRepoSetup} {` -- name: Install zrok-share package +- name: Install zrok2-share package gather_facts: false hosts: all become: true tasks: - - name: Install zrok-share + - name: Install zrok2-share ansible.builtin.package: - name: zrok-share + name: zrok2-share state: present - name: Copy env config from Ansible controller to target copy: - dest: /opt/openziti/etc/zrok/zrok-share.env - src: /opt/openziti/etc/zrok/zrok-share.env + dest: /opt/openziti/etc/zrok2/zrok2-share.env + src: /opt/openziti/etc/zrok2/zrok2-share.env - name: Enable and restart service systemd: - name: zrok-share + name: zrok2-share enabled: yes state: restarted daemon_reload: yes - name: Wait for service systemd: - name: zrok-share + name: zrok2-share state: started register: service_status until: service_status.status.ActiveState == 'active' @@ -53,64 +53,64 @@ import ConcatenateYamlSnippets from '@zrokroot/src/components/cat-yaml.jsx' Save the enable token from the zrok console in the configuration file. -```bash title="/opt/openziti/etc/zrok/zrok-share.env" -ZROK_ENABLE_TOKEN="14cbfca9772f" +```bash title="/opt/openziti/etc/zrok2/zrok2-share.env" +ZROK2_ENABLE_TOKEN="14cbfca9772f" ``` ## Name your Share This unique name becomes part of the domain name of the share, e.g. `https://toaster.share.zrok.io`. A random name is generated if you don't specify one. The name must be lowercase alphanumeric, between 4 and 32 characters in length. -```bash title="/opt/openziti/etc/zrok/zrok-share.env" -ZROK_UNIQUE_NAME="toaster" +```bash title="/opt/openziti/etc/zrok2/zrok2-share.env" +ZROK2_UNIQUE_NAME="toaster" ``` ## Use Cases You may change the target for the current backend mode, e.g. `proxy`, by editing the configuration file and restarting the service. The reserved subdomain will remain the same. -You may switch between backend modes or change authentication options by deleting `/var/lib/zrok-share/.zrok/reserved.json` and restarting the service. A new subdomain will be reserved. +You may switch between backend modes or change authentication options by deleting `/var/lib/zrok2-share/.zrok2/reserved.json` and restarting the service. A new subdomain will be reserved. ### Proxy a Web Server Proxy a reserved subdomain to an existing web server. The web server could be on a private network or on the same host as zrok. -```bash title="/opt/openziti/etc/zrok/zrok-share.env" -ZROK_TARGET="http://127.0.0.1:3000" -ZROK_BACKEND_MODE="proxy" +```bash title="/opt/openziti/etc/zrok2/zrok2-share.env" +ZROK2_TARGET="http://127.0.0.1:3000" +ZROK2_BACKEND_MODE="proxy" ``` If your HTTPS server has an unverifiable TLS server certificate then you must set `--insecure`. -```bash title="/opt/openziti/etc/zrok/zrok-share.env" -ZROK_INSECURE="--insecure" +```bash title="/opt/openziti/etc/zrok2/zrok2-share.env" +ZROK2_INSECURE="--insecure" ``` ### Serve Static Files Run zrok's embedded web server to serve the files in a directory. If there's an `index.html` file in the directory then visitors will see that web page in their browser, otherwise they'll see a generated index of the files. The directory must be readable by 'other', e.g. `chmod -R o+rX /var/www/html`. -```bash title="/opt/openziti/etc/zrok/zrok-share.env" -ZROK_TARGET="/var/www/html" -ZROK_BACKEND_MODE="web" +```bash title="/opt/openziti/etc/zrok2/zrok2-share.env" +ZROK2_TARGET="/var/www/html" +ZROK2_BACKEND_MODE="web" ``` ### Caddy Server Use zrok's built-in Caddy server to serve static files or as a reverse proxy to multiple web servers with various HTTP routes or as a load-balanced set. A sample Caddyfile is available in the path shown. -```bash title="/opt/openziti/etc/zrok/zrok-share.env" -ZROK_TARGET="/opt/openziti/etc/zrok/multiple_upstream.Caddyfile" -ZROK_BACKEND_MODE="caddy" +```bash title="/opt/openziti/etc/zrok2/zrok2-share.env" +ZROK2_TARGET="/opt/openziti/etc/zrok2/multiple_upstream.Caddyfile" +ZROK2_BACKEND_MODE="caddy" ``` ### Network Drive This uses zrok's `drive` backend mode to serve a directory of static files as a virtual network drive. The directory must be readable by 'other', e.g. `chmod -R o+rX /usr/share/doc`. -```bash title="/opt/openziti/etc/zrok/zrok-share.env" -ZROK_TARGET="/usr/share/doc" -ZROK_BACKEND_MODE="drive" +```bash title="/opt/openziti/etc/zrok2/zrok2-share.env" +ZROK2_TARGET="/usr/share/doc" +ZROK2_BACKEND_MODE="drive" ``` [Learn more about this feature in this blog post](https://blog.openziti.io/zrok-drives-an-early-preview). @@ -123,17 +123,17 @@ You can limit access to certain email addresses with OAuth or require a password You can require that visitors authenticate with an email address that matches at least one of the suffixes you specify. Add the following to the configuration file. -```bash title="/opt/openziti/etc/zrok/zrok-share.env" -ZROK_OAUTH_PROVIDER="github" # or google -ZROK_OAUTH_EMAILS="alice@example.com *@acme.example.com" +```bash title="/opt/openziti/etc/zrok2/zrok2-share.env" +ZROK2_OAUTH_PROVIDER="github" # or google +ZROK2_OAUTH_EMAILS="alice@example.com *@acme.example.com" ``` ### Password Enable HTTP basic authentication by adding the following to the configuration file. -```bash title="/opt/openziti/etc/zrok/zrok-share.env" -ZROK_BASIC_AUTH="user:passwd" +```bash title="/opt/openziti/etc/zrok2/zrok2-share.env" +ZROK2_BASIC_AUTH="user:passwd" ``` ## Start the Service @@ -141,15 +141,15 @@ ZROK_BASIC_AUTH="user:passwd" Start the service, and check the zrok console or the service log for the reserved subdomain. ```bash title="run now and at startup" -sudo systemctl enable --now zrok-share.service +sudo systemctl enable --now zrok2-share.service ``` ```bash title="run now" -sudo systemctl restart zrok-share.service +sudo systemctl restart zrok2-share.service ``` ```bash -journalctl -u zrok-share.service +journalctl -u zrok2-share.service ``` ## Compatibility @@ -163,4 +163,4 @@ The Linux distribution must have a package manager that understands the `.deb` o ## Package Contents -The files included in the `zrok-share` package are sourced [here in GitHub](https://github.com/openziti/zrok/tree/main/nfpm). +The files included in the `zrok2-share` package are sourced [here in GitHub](https://github.com/openziti/zrok/tree/main/nfpm). diff --git a/website/docs/guides/_linux-agent-install.mdx b/website/docs/guides/_linux-agent-install.mdx index 11b60d55..69188c69 100644 --- a/website/docs/guides/_linux-agent-install.mdx +++ b/website/docs/guides/_linux-agent-install.mdx @@ -3,15 +3,15 @@ ```bash curl -sSLf https://get.openziti.io/install.bash \ - | sudo bash -s zrok-agent + | sudo bash -s zrok2-agent ``` -1. If you set up the repository by following the guide, then also install the `zrok-agent` package. This package provides the systemd service. +1. If you set up the repository by following the guide, then also install the `zrok2-agent` package. This package provides the systemd service. ```bash title="Ubuntu, Debian" - sudo apt install zrok-agent + sudo apt install zrok2-agent ``` ```bash title="Fedora, Rocky" - sudo dnf install zrok-agent + sudo dnf install zrok2-agent ``` diff --git a/website/docs/guides/_linux-share-install.mdx b/website/docs/guides/_linux-share-install.mdx index 3ac001f4..5bcdf561 100644 --- a/website/docs/guides/_linux-share-install.mdx +++ b/website/docs/guides/_linux-share-install.mdx @@ -3,15 +3,15 @@ ```bash curl -sSLf https://get.openziti.io/install.bash \ - | sudo bash -s zrok-share + | sudo bash -s zrok2-share ``` -1. If you set up the repository by following the guide, then also install the `zrok-share` package. This package provides the systemd service. +1. If you set up the repository by following the guide, then also install the `zrok2-share` package. This package provides the systemd service. ```bash title="Ubuntu, Debian" - sudo apt install zrok-share + sudo apt install zrok2-share ``` ```bash title="Fedora, Rocky" - sudo dnf install zrok-share + sudo dnf install zrok2-share ``` diff --git a/website/docs/guides/agent/http-healthcheck.mdx b/website/docs/guides/agent/http-healthcheck.mdx index f16d3e94..01f9ac55 100644 --- a/website/docs/guides/agent/http-healthcheck.mdx +++ b/website/docs/guides/agent/http-healthcheck.mdx @@ -11,20 +11,20 @@ As of `v1.0.7` the zrok Agent supports health checks for `proxy` backend shares. With an Agent running in your environment, create a share: ``` -$ zrok share public http://127.0.0.1:18080 +$ zrok2 share public http://127.0.0.1:18080 token:"8rvjpmeeyvwc" frontendEndpoints:"http://8rvjpmeeyvwc.zrok.example.com:8080" ``` -Then the new `zrok agent share http-healthcheck` command can be used to validate that the Agent is able to communicate with the backend target: +Then the new `zrok2 agent share http-healthcheck` command can be used to validate that the Agent is able to communicate with the backend target: ``` -$ zrok agent share http-healthcheck 8rvjpmeeyvwc GET / 200 +$ zrok2 agent share http-healthcheck 8rvjpmeeyvwc GET / 200 healthy ``` A non-existent endpoint will return a non-`200` response: ``` -$ zrok agent share http-healthcheck 8rvjpmeeyvwc GET /non-existent 200 +$ zrok2 agent share http-healthcheck 8rvjpmeeyvwc GET /non-existent 200 unhealthy; unexpected status code; got '202', want '200' ``` @@ -33,10 +33,10 @@ unhealthy; unexpected status code; got '202', want '200' This health check infrastructure will report any issue communicating with the underlying backend target, including low-level communication errors: ``` -$ zrok share public http://127.1.1.1:9090 +$ zrok2 share public http://127.1.1.1:9090 token:"2bfvnne6kb3c" frontendEndpoints:"http://2bfvnne6kb3c.zrok.quigley.com:8080" -$ zrok agent share http-healthcheck 2bfvnne6kb3c GET / 200 +$ zrok2 agent share http-healthcheck 2bfvnne6kb3c GET / 200 unhealthy; failed to execute request: Get "http://127.1.1.1:9090/": dial tcp 127.1.1.1:9090: connect: connection refused ``` diff --git a/website/docs/guides/agent/index.mdx b/website/docs/guides/agent/index.mdx index e99ad3a1..879b1650 100644 --- a/website/docs/guides/agent/index.mdx +++ b/website/docs/guides/agent/index.mdx @@ -3,20 +3,20 @@ title: Agent sidebar_position: 20 --- -The zrok Agent centralizes management of your zrok shares and accesses. It provides both web-based and command-line interfaces, and changes how the `zrok share` and `zrok access` commands behave. +The zrok Agent centralizes management of your zrok shares and accesses. It provides both web-based and command-line interfaces, and changes how the `zrok2 share` and `zrok2 access` commands behave. ## Tutorial Run the Agent in the foreground. ```bash -zrok agent +zrok2 agent ``` In another terminal, open the console. ```bash -zrok agent console +zrok2 agent console ``` You should see the Agent UI in your default web browser. @@ -24,7 +24,7 @@ You should see the Agent UI in your default web browser. Start sharing a public share with the Agent. ```bash -zrok share public 8080 +zrok2 share public 8080 ``` ```buttonless title="Output" @@ -36,7 +36,7 @@ You will see the new public share in the Agent UI and you can access it at the p Reserve a private share for the Agent to share. ```bash -zrok reserve private 8080 --closed --unique-name "myshare" +zrok2 reserve private 8080 --closed --unique-name "myshare" ``` ```buttonless title="Output" @@ -46,7 +46,7 @@ zrok reserve private 8080 --closed --unique-name "myshare" Start sharing the reserved share with the Agent. ```bash -zrok share reserved "myshare" +zrok2 share reserved "myshare" ``` ```buttonless title="Output" @@ -54,12 +54,12 @@ zrok share reserved "myshare" token:"myshare" backendMode:"proxy" shareMode:"private" target:"http://127.0.0.1:8080" ``` -You will see the new reserved share in the Agent UI and you can access it by running `zrok access "myshare"` on another device where you have enabled the same zrok account, since the share was reserved with closed permission mode. +You will see the new reserved share in the Agent UI and you can access it by running `zrok2 access "myshare"` on another device where you have enabled the same zrok account, since the share was reserved with closed permission mode. Check the status of the Agent's shares and accesses. ```bash -zrok agent status +zrok2 agent status ``` ```buttonless title="Output" @@ -76,19 +76,19 @@ zrok agent status You can keep the Agent running reliably in the background by installing the Agent service in Windows or Linux. - Windows - [set up the Windows system service](../../guides/agent/windows-service/index.mdx) -- Linux - [install the Linux package `zrok-agent`](../../guides/agent/linux-service.mdx) +- Linux - [install the Linux package `zrok2-agent`](../../guides/agent/linux-service.mdx) ## How the Agent Works ### Centralized Management -Without the Agent running, each time you execute a `zrok share` or `zrok access` command, a separate process is created to handle that specific share or access. +Without the Agent running, each time you execute a `zrok2 share` or `zrok2 access` command, a separate process is created to handle that specific share or access. When the Agent is running: - All shares and accesses are managed by a single Agent process. - The Agent provides a web UI for monitoring and managing your shares and accesses. -- The `zrok share` and `zrok access` commands delegate their operations to the running Agent. +- The `zrok2 share` and `zrok2 access` commands delegate their operations to the running Agent. - You can stop and restart individual shares/accesses without terminating the Agent. - The Agent will remember and automatically restart your shares started with `share reserved`, and any accesses started with `access private`. - The Agent will not restart regular, ephemeral shares started with `share private` or `share public`. @@ -98,7 +98,7 @@ When the Agent is running: The Agent provides a web-based console interface that can be accessed with: ```bash -zrok agent console +zrok2 agent console ``` This command opens your default web browser to the Agent UI, where you can: diff --git a/website/docs/guides/agent/linux-service.mdx b/website/docs/guides/agent/linux-service.mdx index 718a7296..c9c0987c 100644 --- a/website/docs/guides/agent/linux-service.mdx +++ b/website/docs/guides/agent/linux-service.mdx @@ -11,22 +11,22 @@ Run the zrok agent as a `systemd --user` service under your Linux user account. ## Install the Package -The package provides the `zrok` executable and the `zrok-agent.service` unit. +The package provides the `zrok` executable and the `zrok2-agent.service` unit. ## Enable your Account -This creates a `~/.zrok` directory enabled for your zrok account. +This creates a `~/.zrok2` directory enabled for your zrok account. ```bash -zrok enable +zrok2 enable ``` ## Start the Service ```bash -systemctl --user enable --now zrok-agent.service +systemctl --user enable --now zrok2-agent.service ``` ## Use the agent @@ -38,5 +38,5 @@ Learn more about using the zrok agent in the [agent guide](../../guides/agent/in ### Check the User Service Log ```bash -journalctl --user -lfu zrok-agent.service +journalctl --user -lfu zrok2-agent.service ``` diff --git a/website/docs/guides/agent/remoting.mdx b/website/docs/guides/agent/remoting.mdx index 59b8989f..43ae68de 100644 --- a/website/docs/guides/agent/remoting.mdx +++ b/website/docs/guides/agent/remoting.mdx @@ -11,7 +11,7 @@ As of `v1.0.5` the zrok Agent and controller support secure, opt-in remote contr Create an identity for your zrok controller to use for interacting with remote agents: ``` -$ zrok admin create identity agentremoting +$ zrok2 admin create identity agentremoting zrok identity 'agentremoting' created with ziti id 'WEfGMIx-e4' ``` :::note @@ -23,17 +23,17 @@ Next, you'll need to configure remoting in your controller config like this: ```yaml agent_controller: z_id: WEfGMIx-e4 - identity_path: /home/michael/.zrok/identities/agentremoting.json + identity_path: /home/michael/.zrok2/identities/agentremoting.json ``` Restart your controller with this configuration and the agent remoting endpoints will become available. ## Enrolling an Agent -Enrolling an Agent in remoting requires an enabled environment. You can use the `zrok agent enroll` command from an enabled environment to enroll your agent: +Enrolling an Agent in remoting requires an enabled environment. You can use the `zrok2 agent enroll` command from an enabled environment to enroll your agent: ``` -$ zrok agent enroll +$ zrok2 agent enroll warning! proceeding will allow remote control of your zrok agent! @@ -119,10 +119,10 @@ The `/agent/access` and `/agent/unaccess` endpoints also exist and allow for cre ## Unenrolling an Agent -The `zrok agent unenroll` command will remove all remote control access from an Agent in an environment: +The `zrok2 agent unenroll` command will remove all remote control access from an Agent in an environment: ``` -$ zrok agent unenroll +$ zrok2 agent unenroll SUCCESS: unenrolled agent from 'https://api-v2.zrok.io' SUCCESS: removed agent-enrollment.json ``` diff --git a/website/docs/guides/agent/windows-service/index.mdx b/website/docs/guides/agent/windows-service/index.mdx index 6a02fcd2..ec80e289 100644 --- a/website/docs/guides/agent/windows-service/index.mdx +++ b/website/docs/guides/agent/windows-service/index.mdx @@ -31,10 +31,10 @@ We're going to want to enable a zrok environment for our new Agent service in th C:\Program Files\zrok>set USERPROFILE=c:\Windows\System32\config\systemprofile ``` -And with that environment variable set, we'll use the `zrok enable` command to enable an environment for our new Agent service: +And with that environment variable set, we'll use the `zrok2 enable` command to enable an environment for our new Agent service: ```cmd -C:\Program Files\zrok>zrok enable +C:\Program Files\zrok>zrok2 enable ``` ![Enabling the Service Environment](images/enable.png) @@ -53,7 +53,7 @@ Windows might ask you for elevated Administrator privileges and will then show t ![nssm install](images/nssm-install.png) -We'll set "Path" to `C:\Program Files\zrok\zrok.exe` (the zrok executable). We'll set the "Startup directory" to `C:\Windows\System32\config\systemprofile` (the "home" directory for the `Local System` user). The "Arguments" are the command-line parameters that will get added to the command-line when starting the service, in this case, we want the service to start with the command `zrok agent start`. +We'll set "Path" to `C:\Program Files\zrok\zrok.exe` (the zrok executable). We'll set the "Startup directory" to `C:\Windows\System32\config\systemprofile` (the "home" directory for the `Local System` user). The "Arguments" are the command-line parameters that will get added to the command-line when starting the service, in this case, we want the service to start with the command `zrok2 agent start`. We'll set the "Service name" to `zrokAgent`. @@ -61,11 +61,11 @@ Next, scroll over to the "I/O" tab in the `nssm` installer: ![I/O Tab](images/nssm-io.png) -Set the "Output (stdout)" to log the standard output from the `zrok agent start` process to the file `C:\Windows\System32\config\systemprofile\.zrok\agent-stdout.log`. +Set the "Output (stdout)" to log the standard output from the `zrok2 agent start` process to the file `C:\Windows\System32\config\systemprofile\.zrok2\agent-stdout.log`. -Set the "Error (stderr)" to log the standard error to the file `C:\Windows\System32\config\systemprofile\.zrok\agent-stderr.log`. +Set the "Error (stderr)" to log the standard error to the file `C:\Windows\System32\config\systemprofile\.zrok2\agent-stderr.log`. -Setting the I/O redirection in this way will produce logs from the `zrok agent start` process that could be useful for future troubleshooting. +Setting the I/O redirection in this way will produce logs from the `zrok2 agent start` process that could be useful for future troubleshooting. `nssm` also provides options for automatically rotating these log files: @@ -83,7 +83,7 @@ If we click the start button in the toolbar, or right-click on the service and s ![Service Running](images/services-running.png) -If we open a Windows Explorer in the folder `C:\Windows\System32\config\systemprofile\.zrok` we can see our logs, and the `agent.socket` which is used by the zrok command-line to interact with our Agent service: +If we open a Windows Explorer in the folder `C:\Windows\System32\config\systemprofile\.zrok2` we can see our logs, and the `agent.socket` which is used by the zrok command-line to interact with our Agent service: ![zrokdir](images/zrokdir.png) @@ -92,7 +92,7 @@ This zrok Agent service is now available for use. Whenever a Windows Command Pro We can access the Agent console using this command: ```cmd -C:\Program Files\zrok>zrok agent console +C:\Program Files\zrok>zrok2 agent console ``` And this will open a web interface which allows the Agent to be managed: @@ -112,10 +112,10 @@ C:\Program Files\zrok>nssm install zrokAgent "C:\Program Files\zrok\zrok.exe" ag C:\Program Files\zrok>nssm set zrokAgent AppDirectory C:\Windows\System32\config\systemprofile ``` ```cmd -C:\Program Files\zrok>nssm set zrokAgent AppStdout C:\Windows\System32\config\systemprofile\.zrok\agent-stdout.log +C:\Program Files\zrok>nssm set zrokAgent AppStdout C:\Windows\System32\config\systemprofile\.zrok2\agent-stdout.log ``` ```cmd -C:\Program Files\zrok>nssm set zrokAgent AppStderr C:\Windows\System32\config\systemprofile\.zrok\agent-stderr.log +C:\Program Files\zrok>nssm set zrokAgent AppStderr C:\Windows\System32\config\systemprofile\.zrok2\agent-stderr.log ``` And we can start our new service using the standard Windows service control utility, `sc`: @@ -139,6 +139,6 @@ C:\>sc delete zrokAgent And if you have your `USERPROFILE` environment variable properly set to `C:\Windows\System32\config\systemprofile`, you can use this command to remove the environment from your system and from the zrok service: ```cmd -C:\Program Files\zrok>zrok disable +C:\Program Files\zrok>zrok2 disable ``` diff --git a/website/docs/guides/docker-share/docker_private_share_guide.md b/website/docs/guides/docker-share/docker_private_share_guide.md index 21c3fc5b..278d6a98 100644 --- a/website/docs/guides/docker-share/docker_private_share_guide.md +++ b/website/docs/guides/docker-share/docker_private_share_guide.md @@ -24,9 +24,9 @@ The Docker Compose project uses your zrok account token to reserve a private sha When the project runs it will: -1. enable a zrok environment unless `/mnt/.zrok/environment.json` exists in the `zrok_env` volume -1. reserve a private share token for the service unless `/mnt/.zrok/reserved.json` exists -1. start sharing the target specified in the `ZROK_TARGET` environment variable +1. enable a zrok environment unless `/mnt/.zrok2/environment.json` exists in the `zrok_env` volume +1. reserve a private share token for the service unless `/mnt/.zrok2/reserved.json` exists +1. start sharing the target specified in the `ZROK2_TARGET` environment variable ## Before You Begin @@ -45,14 +45,14 @@ First, let's create the private share. ```bash # file name ".env" - ZROK_ENABLE_TOKEN="8UL9-48rN0ua" + ZROK2_ENABLE_TOKEN="8UL9-48rN0ua" ``` 1. If you are self-hosting zrok then it's important to set your API endpoint URL too. If you're using the hosted zrok service then you can skip this step. ```bash # file name ".env" - ZROK_API_ENDPOINT="https://zrok.example.com" + ZROK2_API_ENDPOINT="https://zrok.example.com" ``` 1. Run your Compose project to start sharing the built-in demo web server: @@ -80,15 +80,15 @@ Now that we have a private share we can access it with the zrok command or by ru ```bash # file name ".env" - ZROK_ENABLE_TOKEN="8UL9-48rN0ua" + ZROK2_ENABLE_TOKEN="8UL9-48rN0ua" ``` 1. Now copy the zrok private access token from the zrok private share project's output to your clipboard and paste it in the same file named `.env` here in your private share project folder like this: ```bash # file name ".env" - ZROK_ENABLE_TOKEN="8UL9-48rN0ua" - ZROK_ACCESS_TOKEN="wr3hpf2z5fiy" + ZROK2_ENABLE_TOKEN="8UL9-48rN0ua" + ZROK2_ACCESS_TOKEN="wr3hpf2z5fiy" ``` 1. Run your Compose project to start accessing the private share: @@ -108,19 +108,19 @@ You must set the permission mode before you reserve the share. Only your own account can access the private share. ```bash -ZROK_PERMISSION_MODE="closed" +ZROK2_PERMISSION_MODE="closed" ``` Grant access to additional zrok accounts. ```bash -ZROK_ACCESS_GRANTS="bob@example.com alice@example.org" +ZROK2_ACCESS_GRANTS="bob@example.com alice@example.org" ``` You can adjust the access grants by running the CLI inside the `zrok-share` container. ```bash -docker compose exec zrok-share zrok modify ${ZROK_UNIQUE_NAME} --remove-access-grant bob@example.com +docker compose exec zrok-share zrok2 modify ${ZROK2_UNIQUE_NAME} --remove-access-grant bob@example.com ``` ## Going Further with Private Access diff --git a/website/docs/guides/docker-share/docker_public_share_guide.md b/website/docs/guides/docker-share/docker_public_share_guide.md index 131231a6..6a1b7587 100644 --- a/website/docs/guides/docker-share/docker_public_share_guide.md +++ b/website/docs/guides/docker-share/docker_public_share_guide.md @@ -25,9 +25,9 @@ target. When the project runs it will: -1. enable a zrok environment unless `/mnt/.zrok/environment.json` exists in the `zrok_env` volume -1. reserve a public subdomain for the service unless `/mnt/.zrok/reserved.json` exists -1. start sharing the target specified in the `ZROK_TARGET` environment variable +1. enable a zrok environment unless `/mnt/.zrok2/environment.json` exists in the `zrok_env` volume +1. reserve a public subdomain for the service unless `/mnt/.zrok2/reserved.json` exists +1. start sharing the target specified in the `ZROK2_TARGET` environment variable ## Create the Docker Project @@ -36,7 +36,7 @@ When the project runs it will: 1. Copy your zrok account's enable token from the zrok web console to your clipboard and paste it in a file named `.env` in the same folder like this: ```bash title=".env" - ZROK_ENABLE_TOKEN="8UL9-48rN0ua" + ZROK2_ENABLE_TOKEN="8UL9-48rN0ua" ``` 1. Name the Share @@ -44,7 +44,7 @@ When the project runs it will: This unique name becomes part of the domain name of the share, e.g. `https://toaster.share.zrok.io`. A random name is generated if you don't specify one. ```bash title=".env" - ZROK_UNIQUE_NAME="toaster" + ZROK2_UNIQUE_NAME="toaster" ``` 1. Run the Compose project to start sharing the built-in demo web server. Be sure to `--detach` so the project runs in the background if you want it to auto-restart when your computer reboots. @@ -67,10 +67,10 @@ This concludes the minimum steps to begin sharing the demo web server. Read on t ## Proxy Any Web Server -The simplest way to share your existing HTTP server is to set `ZROK_TARGET` (e.g. `https://example.com`) in the environment of the `docker compose up` command. When you restart the share will auto-configure for that URL. +The simplest way to share your existing HTTP server is to set `ZROK2_TARGET` (e.g. `https://example.com`) in the environment of the `docker compose up` command. When you restart the share will auto-configure for that URL. ```bash title=".env" -ZROK_TARGET="http://example.com:8080" +ZROK2_TARGET="http://example.com:8080" ``` ```bash @@ -83,18 +83,18 @@ You can require a password or an OAuth login with certain email addresses. ### OAuth Email -You can allow specific email addresse patterns by setting `ZROK_OAUTH_PROVIDER` to `github` or `google` and -`ZROK_OAUTH_EMAILS`. Read more about the OAuth features in [this blog +You can allow specific email addresse patterns by setting `ZROK2_OAUTH_PROVIDER` to `github` or `google` and +`ZROK2_OAUTH_EMAILS`. Read more about the OAuth features in [this blog post](https://blog.openziti.io/the-zrok-oauth-public-frontend). ```bash title=".env" -ZROK_OAUTH_PROVIDER="github" -ZROK_OAUTH_EMAILS="alice@example.com *@acme.example.com" +ZROK2_OAUTH_PROVIDER="github" +ZROK2_OAUTH_EMAILS="alice@example.com *@acme.example.com" ``` ## Caddy is Powerful -The reserved public share project uses zrok's default backend mode, `proxy`. Another backend mode, `caddy`, accepts a path to [a Caddyfile](https://caddyserver.com/docs/caddyfile) as the value of `ZROK_TARGET` ([zrok Caddyfile examples](https://github.com/openziti/zrok/tree/main/etc/caddy)). +The reserved public share project uses zrok's default backend mode, `proxy`. Another backend mode, `caddy`, accepts a path to [a Caddyfile](https://caddyserver.com/docs/caddyfile) as the value of `ZROK2_TARGET` ([zrok Caddyfile examples](https://github.com/openziti/zrok/tree/main/etc/caddy)). Caddy is the most powerful and flexible backend mode in zrok. You must reserve a new public subdomain whenever you switch the backend mode, so using `caddy` reduces the risk that you'll have to share a new frontend URL with your users. @@ -125,7 +125,7 @@ With Caddy, you can balance the workload for websites or web services or share s expose: 8080 zrok-share: volumes: - - ./Caddyfile:/mnt/.zrok/Caddyfile + - ./Caddyfile:/mnt/.zrok2/Caddyfile ``` 1. Start a new Docker Compose project or delete the existing state volume. @@ -134,7 +134,7 @@ With Caddy, you can balance the workload for websites or web services or share s docker compose down --volumes ``` - If you prefer to keep using the same zrok environment with the new share then delete `/mnt/.zrok/reserved.json` instead of the entire volume. + If you prefer to keep using the same zrok environment with the new share then delete `/mnt/.zrok2/reserved.json` instead of the entire volume. 1. Run the project to load the new configuration. diff --git a/website/docs/guides/docker-share/index.mdx b/website/docs/guides/docker-share/index.mdx index 707c3130..90c0ede2 100644 --- a/website/docs/guides/docker-share/index.mdx +++ b/website/docs/guides/docker-share/index.mdx @@ -16,7 +16,7 @@ This page provides `docker` and `docker compose` examples of mounting the host's Let's say you have a `compose.yml` file that defines a web app known within the project's bridge network as `https://toaster:8080` and you want to publish it as a reliable, public site. -1. Reserve a subdomain by running `zrok reserve public --unique-name "toaster" https:toasterpp:8080` on the Docker host. +1. Reserve a subdomain by running `zrok2 reserve public --unique-name "toaster" https:toasterpp:8080` on the Docker host. 1. Merge this YAML with `compose.yml` or save it in the same directory as `compose.override.yml` to let `docker compose up` merge it for you. ```yaml @@ -26,7 +26,7 @@ Let's say you have a `compose.yml` file that defines a web app known within the restart: unless-stopped user: "${UID}" volumes: - - ${HOME}/.zrok:/home/ziggy/.zrok + - ${HOME}/.zrok2:/home/ziggy/.zrok2 environment: PFXLOG_NO_JSON: "true" command: share reserved "toaster" --headless @@ -42,7 +42,7 @@ Let's say you have a web server running on the host's private network at `https: docker run \ --rm \ --network=host \ - --volume ~/.zrok:/home/ziggy/.zrok \ + --volume ~/.zrok2:/home/ziggy/.zrok2 \ --user "${UID:-1000}:${GID:-1000}" \ openziti/zrok share public \ --headless \ @@ -56,7 +56,7 @@ docker run \ docker.exe run ` --rm ` --network "host" ` - --volume "${env:USERPROFILE}\.zrok:/.zrok" ` + --volume "${env:USERPROFILE}\.zrok2:/.zrok2" ` --user "1000" ` openziti/zrok share public ` --headless ` @@ -73,7 +73,7 @@ docker.exe run ` docker.exe run ^ --rm ^ --network "host" ^ - --volume "%USERPROFILE%\.zrok:/.zrok" ^ + --volume "%USERPROFILE%\.zrok2:/.zrok2" ^ --user "1000" ^ openziti/zrok share public ^ --headless ^ @@ -89,7 +89,7 @@ docker.exe run ^ docker run \ --rm \ --network "host" \ - --volume "/mnt/c/Users/$(powershell.exe -Command 'Write-Output $env:USERNAME' | tr -d '\r')/.zrok:/home/ziggy/.zrok" \ + --volume "/mnt/c/Users/$(powershell.exe -Command 'Write-Output $env:USERNAME' | tr -d '\r')/.zrok2:/home/ziggy/.zrok2" \ --user "${UID:-1000}:${GID:-1000}" \ openziti/zrok share public \ --headless \ @@ -104,7 +104,7 @@ Let's break down those options and arguments. 1. `--rm` don't save this container because it's providing a temporary public share that's destroyed when the container stops 1. `--network=host` shares the host's network with the container so that the container can reach the web server directly. This is always necessary when the web server is listening only on the host's loopback interface, e.g., `https://::1:8080`, and may not be strictly necessary if the target is routeable from the default Docker bridge. -1. `--volume ~/.zrok:/home/ziggy/.zrok` mounts the `zrok` configuration from the Docker host into the container. +1. `--volume ~/.zrok2:/home/ziggy/.zrok2` mounts the `zrok` configuration from the Docker host into the container. 1. `--user "${UID:-1000}:${GID:-1000}"` sets the container's user to the current user on the Docker host to avoid permission issues with reading the mounted `zrok` configuration (defaults to `1000:1000`). 1. `openziti/zrok` is the `zrok` Docker image. 1. `share public` is the `zrok` command to share the target publicly until zrok exits. diff --git a/website/docs/guides/drives.mdx b/website/docs/guides/drives.mdx index 1b4fe345..e8c7f021 100644 --- a/website/docs/guides/drives.mdx +++ b/website/docs/guides/drives.mdx @@ -5,14 +5,14 @@ The zrok drives CLI tools allow for simple, ergonomic management and synchroniza ## Sharing a Drive -Virtual drives are shared through the `zrok` CLI using the `--backend-mode drive` flag through the `zrok share` command, using either the `public` or `private` sharing modes. We'll use the `private` sharing mode for this example: +Virtual drives are shared through the `zrok` CLI using the `--backend-mode drive` flag through the `zrok2 share` command, using either the `public` or `private` sharing modes. We'll use the `private` sharing mode for this example: ``` $ mkdir /tmp/junk -$ zrok share private --headless --backend-mode drive /tmp/junk +$ zrok2 share private --headless --backend-mode drive /tmp/junk [ 0.124] INFO sdk-golang/ziti.(*listenerManager).createSessionWithBackoff: {session token=[cf640aac-2706-49ae-9cc9-9a497d67d9c5]} new service session [ 0.145] INFO main.(*sharePrivateCommand).run: allow other to access your share with the following command: -zrok access private wkcfb58vj51l +zrok2 access private wkcfb58vj51l ``` The command shown above creates an ephemeral, `private` drive share pointed at the local `/tmp/junk` folder. @@ -21,20 +21,20 @@ Notice that the share token allocated by `zrok` is `wkcfb58vj51l`. We'll use tha ## Working with a Private Drive Share -First, let's copy a file into our virtual drive using the `zrok copy` command: +First, let's copy a file into our virtual drive using the `zrok2 copy` command: ``` -$ zrok copy LICENSE zrok://wkcfb58vj51l +$ zrok2 copy LICENSE zrok://wkcfb58vj51l [ 0.119] INFO zrok/drives/sync.OneWay: => /LICENSE copy complete! ``` -We used the URL scheme `zrok://` to refer to the private virtual drive we allocated above using the `zrok share private` command. Use `zrok://` URLs with the drives CLI tools to refer to contents of private virtual drives. +We used the URL scheme `zrok://` to refer to the private virtual drive we allocated above using the `zrok2 share private` command. Use `zrok://` URLs with the drives CLI tools to refer to contents of private virtual drives. Next, let's get a directory listing of the virtual drive: ``` -$ zrok ls zrok://wkcfb58vj51l +$ zrok2 ls zrok://wkcfb58vj51l ┌──────┬─────────┬─────────┬───────────────────────────────┐ │ TYPE │ NAME │ SIZE │ MODIFIED │ ├──────┼─────────┼─────────┼───────────────────────────────┤ @@ -45,8 +45,8 @@ $ zrok ls zrok://wkcfb58vj51l We can make directories on the virtual drive: ``` -$ zrok mkdir zrok://wkcfb58vj51l/stuff -$ zrok ls zrok://wkcfb58vj51l +$ zrok2 mkdir zrok://wkcfb58vj51l/stuff +$ zrok2 ls zrok://wkcfb58vj51l ┌──────┬─────────┬─────────┬───────────────────────────────┐ │ TYPE │ NAME │ SIZE │ MODIFIED │ ├──────┼─────────┼─────────┼───────────────────────────────┤ @@ -65,14 +65,14 @@ total 20 -rw-rw-r-- 1 michael michael 609 Jul 21 13:17 proxy.go -rw-rw-r-- 1 michael michael 361 Jul 21 13:17 size.go -rw-rw-r-- 1 michael michael 423 Jan 2 11:57 uniqueName.go -$ zrok copy util/ zrok://wkcfb58vj51l/stuff +$ zrok2 copy util/ zrok://wkcfb58vj51l/stuff [ 0.123] INFO zrok/drives/sync.OneWay: => /email.go [ 0.194] INFO zrok/drives/sync.OneWay: => /headers.go [ 0.267] INFO zrok/drives/sync.OneWay: => /proxy.go [ 0.337] INFO zrok/drives/sync.OneWay: => /size.go [ 0.408] INFO zrok/drives/sync.OneWay: => /uniqueName.go copy complete! -$ zrok ls zrok://wkcfb58vj51l/stuff +$ zrok2 ls zrok://wkcfb58vj51l/stuff ┌──────┬───────────────┬───────┬───────────────────────────────┐ │ TYPE │ NAME │ SIZE │ MODIFIED │ ├──────┼───────────────┼───────┼───────────────────────────────┤ @@ -87,15 +87,15 @@ $ zrok ls zrok://wkcfb58vj51l/stuff And we can remove files and directories from the virtual drive: ``` -$ zrok rm zrok://wkcfb58vj51l/LICENSE -$ zrok ls zrok://wkcfb58vj51l +$ zrok2 rm zrok://wkcfb58vj51l/LICENSE +$ zrok2 ls zrok://wkcfb58vj51l ┌──────┬───────┬──────┬──────────┐ │ TYPE │ NAME │ SIZE │ MODIFIED │ ├──────┼───────┼──────┼──────────┤ │ DIR │ stuff │ │ │ └──────┴───────┴──────┴──────────┘ -$ zrok rm zrok://wkcfb58vj51l/stuff -$ zrok ls zrok://wkcfb58vj51l +$ zrok2 rm zrok://wkcfb58vj51l/stuff +$ zrok2 ls zrok://wkcfb58vj51l ┌──────┬──────┬──────┬──────────┐ │ TYPE │ NAME │ SIZE │ MODIFIED │ ├──────┼──────┼──────┼──────────┤ @@ -107,7 +107,7 @@ $ zrok ls zrok://wkcfb58vj51l Public shares work very similarly to private shares, they just use a different URL scheme: ``` -$ zrok share public --headless --backend-mode drive /tmp/junk +$ zrok2 share public --headless --backend-mode drive /tmp/junk [ 0.708] INFO sdk-golang/ziti.(*listenerManager).createSessionWithBackoff: {session token=[05e0f48b-242b-4fd9-8edb-259488535c47]} new service session [ 0.878] INFO main.(*sharePublicCommand).run: access your zrok share at the following endpoints: https://6kiww4bn7iok.share.zrok.io @@ -116,15 +116,15 @@ $ zrok share public --headless --backend-mode drive /tmp/junk The same commands, with a different URL scheme work with the `zrok` drives CLI: ``` -$ zrok copy util/ https://6kiww4bn7iok.share.zrok.io +$ zrok2 copy util/ https://6kiww4bn7iok.share.zrok.io [ 0.268] INFO zrok/drives/sync.OneWay: => /email.go [ 0.406] INFO zrok/drives/sync.OneWay: => /headers.go [ 0.530] INFO zrok/drives/sync.OneWay: => /proxy.go [ 0.655] INFO zrok/drives/sync.OneWay: => /size.go [ 0.714] INFO zrok/drives/sync.OneWay: => /uniqueName.go copy complete! -michael@fourtyfour Fri Jan 19 12:42:52 ~/Repos/nf/zrok -$ zrok ls https://6kiww4bn7iok.share.zrok.io +michael@fourtyfour Fri Jan 19 12:42:52 ~/Repos/nf/zrok +$ zrok2 ls https://6kiww4bn7iok.share.zrok.io ┌──────┬───────────────┬───────┬───────────────────────────────┐ │ TYPE │ NAME │ SIZE │ MODIFIED │ ├──────┼───────────────┼───────┼───────────────────────────────┤ @@ -138,22 +138,22 @@ $ zrok ls https://6kiww4bn7iok.share.zrok.io For basic authentication provided by public shares, the `zrok` drives CLI offers the `--basic-auth` flag, which accepts a `:` parameter to specify the authentication for the public virtual drive (if it's required). -Alternatively, the authentication can be set using the `ZROK_DRIVES_BASIC_AUTH` environment variable: +Alternatively, the authentication can be set using the `ZROK2_DRIVES_BASIC_AUTH` environment variable: ``` -$ export ZROK_DRIVES_BASIC_AUTH=username:password +$ export ZROK2_DRIVES_BASIC_AUTH=username:password ``` ## One-way Synchronization -The `zrok copy` command includes a `--sync` flag, which only copies files detected as _modified_. `zrok` considers a file with the same modification timestamp and size to be the same. Of course, this is not a strong guarantee that the files are equivalent. Future `zrok` drives versions will provide a cryptographically strong mechanism (a-la `rsync` and friends) to guarantee that files and trees of files are synchronized. +The `zrok2 copy` command includes a `--sync` flag, which only copies files detected as _modified_. `zrok` considers a file with the same modification timestamp and size to be the same. Of course, this is not a strong guarantee that the files are equivalent. Future `zrok` drives versions will provide a cryptographically strong mechanism (a-la `rsync` and friends) to guarantee that files and trees of files are synchronized. For now, the `--sync` flag provides a convenience mechanism to allow resuming copies of large file trees and provide a reasonable guarantee that the trees are in sync. -Let's take a look at `zrok copy --sync` in action: +Let's take a look at `zrok2 copy --sync` in action: ``` -$ zrok copy --sync docs/ https://glmv049c62p7.share.zrok.io +$ zrok2 copy --sync docs/ https://glmv049c62p7.share.zrok.io [ 0.636] INFO zrok/drives/sync.OneWay: => /_attic/ [ 0.760] INFO zrok/drives/sync.OneWay: => /_attic/network/ [ 0.816] INFO zrok/drives/sync.OneWay: => /_attic/network/_category_.json @@ -180,10 +180,10 @@ $ zrok copy --sync docs/ https://glmv049c62p7.share.zrok.io copy complete! ``` -Because the target drive was empty, `zrok copy --sync` copied the entire contents of the local `docs/` tree into the virtual drive. However, if we run that command again, we get: +Because the target drive was empty, `zrok2 copy --sync` copied the entire contents of the local `docs/` tree into the virtual drive. However, if we run that command again, we get: ``` -$ zrok copy --sync docs/ https://glmv049c62p7.share.zrok.io +$ zrok2 copy --sync docs/ https://glmv049c62p7.share.zrok.io copy complete! ``` @@ -192,8 +192,8 @@ The virtual drive contents are already in sync with the local filesystem tree, s Let's alter the contents of the drive and run the `--sync` again: ``` -$ zrok rm https://glmv049c62p7.share.zrok.io/images -$ zrok copy --sync docs/ https://glmv049c62p7.share.zrok.io +$ zrok2 rm https://glmv049c62p7.share.zrok.io/images +$ zrok2 copy --sync docs/ https://glmv049c62p7.share.zrok.io [ 0.364] INFO zrok/drives/sync.OneWay: => /images/ [ 0.456] INFO zrok/drives/sync.OneWay: => /images/zrok.png [ 0.795] INFO zrok/drives/sync.OneWay: => /images/zrok_cover.png @@ -205,16 +205,16 @@ $ zrok copy --sync docs/ https://glmv049c62p7.share.zrok.io copy complete! ``` -Because we removed the `images/` tree from the virtual drive, `zrok copy --sync` detected this and copied the local `images/` tree back onto the virtual drive. +Because we removed the `images/` tree from the virtual drive, `zrok2 copy --sync` detected this and copied the local `images/` tree back onto the virtual drive. ## Drive-to-Drive Copies and Synchronization -The `zrok copy` CLI can operate on pairs of virtual drives remotely, without ever having to store files locally. This allow for drive-to-drive copies and synchronization. +The `zrok2 copy` CLI can operate on pairs of virtual drives remotely, without ever having to store files locally. This allow for drive-to-drive copies and synchronization. Here are a couple of examples: ``` -$ zrok copy --sync https://glmv049c62p7.share.zrok.io https://glmv049c62p7.share.zrok.io +$ zrok2 copy --sync https://glmv049c62p7.share.zrok.io https://glmv049c62p7.share.zrok.io copy complete! ``` @@ -223,7 +223,7 @@ Specifying the same URL for both the source and the target of a `--sync` operati We can copy files between two virtual drives with a single command: ``` -$ zrok copy --sync https://glmv049c62p7.share.zrok.io zrok://hsml272j3xzf +$ zrok2 copy --sync https://glmv049c62p7.share.zrok.io zrok://hsml272j3xzf [ 1.396] INFO zrok/drives/sync.OneWay: => /_attic/ [ 2.083] INFO zrok/drives/sync.OneWay: => /_attic/overview.md [ 2.704] INFO zrok/drives/sync.OneWay: => /_attic/sharing/ @@ -233,16 +233,16 @@ $ zrok copy --sync https://glmv049c62p7.share.zrok.io zrok://hsml272j3xzf [ 119.589] INFO zrok/drives/sync.OneWay: => /images/zrok_cover.png [ 120.214] INFO zrok/drives/sync.OneWay: => /getting-started.mdx copy complete! -$ zrok copy --sync https://glmv049c62p7.share.zrok.io zrok://hsml272j3xzf +$ zrok2 copy --sync https://glmv049c62p7.share.zrok.io zrok://hsml272j3xzf copy complete! ``` ## Copying from Drives to the Local Filesystem -In the current version of the drives CLI, `zrok copy` always assumes the destination is a directory. There is currently no way to do: +In the current version of the drives CLI, `zrok2 copy` always assumes the destination is a directory. There is currently no way to do: ``` -$ zrok copy somefile someotherfile +$ zrok2 copy somefile someotherfile ``` What you'll end up with on the local filesystem is: @@ -252,18 +252,18 @@ somefile someotherfile/somefile ``` -It's in the backlog to support file destinations in a future release of `zrok`. So, when using `zrok copy`, always take note of the destination. +It's in the backlog to support file destinations in a future release of `zrok`. So, when using `zrok2 copy`, always take note of the destination. -`zrok copy` supports a default destination of `file://.`, so you can do single parameter `zrok copy` commands like this: +`zrok2 copy` supports a default destination of `file://.`, so you can do single parameter `zrok2 copy` commands like this: ``` -$ zrok ls https://azc47r3cwjds.share.zrok.io +$ zrok2 ls https://azc47r3cwjds.share.zrok.io ┌──────┬─────────┬─────────┬───────────────────────────────┐ │ TYPE │ NAME │ SIZE │ MODIFIED │ ├──────┼─────────┼─────────┼───────────────────────────────┤ │ │ LICENSE │ 11.3 kB │ 2023-07-21 13:17:56 -0400 EDT │ └──────┴─────────┴─────────┴───────────────────────────────┘ -$ zrok copy https://azc47r3cwjds.share.zrok.io/LICENSE +$ zrok2 copy https://azc47r3cwjds.share.zrok.io/LICENSE [ 0.260] INFO zrok/drives/sync.OneWay: => /LICENSE copy complete! $ ls -l @@ -274,7 +274,7 @@ total 12 You can also specify a local folder as the destination for your copy: ``` -$ zrok copy https://azc47r3cwjds.share.zrok.io/LICENSE /tmp/inbox +$ zrok2 copy https://azc47r3cwjds.share.zrok.io/LICENSE /tmp/inbox [ 0.221] INFO zrok/drives/sync.OneWay: => /LICENSE copy complete! $ l /tmp/inbox @@ -287,9 +287,9 @@ total 12 Private reserved shares with unque names can be particularly useful with the drives CLI: ``` -$ zrok reserve private -b drive --unique-name mydrive /tmp/junk +$ zrok2 reserve private -b drive --unique-name mydrive /tmp/junk [ 0.315] INFO main.(*reserveCommand).run: your reserved share token is 'mydrive' -$ zrok share reserved --headless mydrive +$ zrok2 share reserved --headless mydrive [ 0.289] INFO main.(*shareReservedCommand).run: sharing target: '/tmp/junk' [ 0.289] INFO main.(*shareReservedCommand).run: using existing backend target: /tmp/junk [ 0.767] INFO sdk-golang/ziti.(*listenerManager).createSessionWithBackoff: {session token=[d519a436-9fb5-4207-afd5-7cbc28fb779a]} new service session @@ -299,7 +299,7 @@ $ zrok share reserved --headless mydrive This makes working with `zrok://` URLs particularly convenient: ``` -$ zrok ls zrok://mydrive +$ zrok2 ls zrok://mydrive ┌──────┬─────────┬─────────┬───────────────────────────────┐ │ TYPE │ NAME │ SIZE │ MODIFIED │ ├──────┼─────────┼─────────┼───────────────────────────────┤ diff --git a/website/docs/guides/frontdoor.mdx b/website/docs/guides/frontdoor.mdx index 5f64bca6..cb7edc20 100644 --- a/website/docs/guides/frontdoor.mdx +++ b/website/docs/guides/frontdoor.mdx @@ -44,7 +44,7 @@ the detected OS of the visitor's browser */} -On Linux, zrok frontdoor is implemented natively as a system service provided by the `zrok-share` DEB or RPM package. +On Linux, zrok frontdoor is implemented natively as a system service provided by the `zrok2-share` DEB or RPM package. ## Goal @@ -52,7 +52,7 @@ Proxy a reserved public subdomain to a backend target with an always-on Linux sy ## How it Works -The `zrok-share` package creates a `zrok-share.service` unit in systemd. The administrator edits the service's configuration file to specify the: +The `zrok2-share` package creates a `zrok2-share.service` unit in systemd. The administrator edits the service's configuration file to specify the: 1. zrok account token 1. target URL or files to be shared and backend mode, e.g. `proxy` @@ -60,9 +60,9 @@ The `zrok-share` package creates a `zrok-share.service` unit in systemd. The adm When the service starts it will: -1. enable the zrok environment unless `/var/lib/zrok-share/.zrok/environment.json` exists -1. reserve a public subdomain for the service unless `/var/lib/zrok-share/.zrok/reserved.json` exists -1. start sharing the target specified as `ZROK_TARGET` in the environment file +1. enable the zrok environment unless `/var/lib/zrok2-share/.zrok2/environment.json` exists +1. reserve a public subdomain for the service unless `/var/lib/zrok2-share/.zrok2/reserved.json` exists +1. start sharing the target specified as `ZROK2_TARGET` in the environment file diff --git a/website/docs/guides/install/linux.mdx b/website/docs/guides/install/linux.mdx index a5f66cd8..06a29865 100644 --- a/website/docs/guides/install/linux.mdx +++ b/website/docs/guides/install/linux.mdx @@ -58,18 +58,18 @@ Check out [zrok frontdoor](../../guides/frontdoor.mdx?os=Linux) for running `zro Download the binary distribution for your Linux distribution's architecture or run the install script below to pick the correct CPU architecture automatically. For Intel and AMD 64-bit machines use the `amd64` distribution. For Raspberry Pi use the `arm64` distribution.
-Manually install in `~/bin/zrok` +Manually install in `~/bin/zrok2` 1. Unarchive the distribution in a temporary directory. ```text - mkdir /tmp/zrok && tar -xf ./zrok*linux*.tar.gz -C /tmp/zrok + mkdir /tmp/zrok2 && tar -xf ./zrok*linux*.tar.gz -C /tmp/zrok2 ``` -1. Install the `zrok` executable. +1. Install the `zrok2` executable. ```text - mkdir -p ~/bin && install /tmp/zrok/zrok ~/bin/ + mkdir -p ~/bin && install /tmp/zrok2/zrok2 ~/bin/ ``` 1. Add `~/bin` to your shell's executable search path. Optionally add this to your ~/.zshenv to persist the change. @@ -78,10 +78,10 @@ Download the binary distribution for your Linux distribution's architecture or r PATH=~/bin:$PATH ``` -1. With the `zrok` executable in your path, you can then execute the `zrok` command from your shell: +1. With the `zrok2` executable in your path, you can then execute the `zrok2` command from your shell: ```text - zrok version + zrok2 version ``` ```buttonless title="Output" @@ -97,7 +97,7 @@ Download the binary distribution for your Linux distribution's architecture or r
-Script to install binary in `/usr/local/bin/zrok` +Script to install binary in `/usr/local/bin/zrok2` This script auto-selects the correct architecture and may be helpful for Raspberry Pi users. @@ -125,16 +125,16 @@ curl -sSfL \ "https://github.com/openziti/zrok/releases/download/${ZROK_VERSION}/zrok_${ZROK_VERSION#v}_linux_${GOXARCH}.tar.gz" \ | tar -xz -f -; -sudo install -o root -g root ./zrok /usr/local/bin/; +sudo install -o root -g root ./zrok2 /usr/local/bin/; -zrok version; +zrok2 version; ```
## Arch User Repository -[An Arch User Repository (AUR) package](https://aur.archlinux.org/packages/zrok-bin) is maintained by the Arch community. As of April 2025, the AUR package includes the `zrok` CLI and [the `zrok-agent.service` systemd `--user` service](/guides/agent/linux-service.mdx). +[An Arch User Repository (AUR) package](https://aur.archlinux.org/packages/zrok-bin) is maintained by the Arch community. As of April 2025, the AUR package includes the `zrok2` CLI and [the `zrok2-agent.service` systemd `--user` service](/guides/agent/linux-service.mdx). ## Homebrew Formula diff --git a/website/docs/guides/install/macos.mdx b/website/docs/guides/install/macos.mdx index 2f9c0c50..b41489ba 100644 --- a/website/docs/guides/install/macos.mdx +++ b/website/docs/guides/install/macos.mdx @@ -44,10 +44,10 @@ Download the binary distribution for your macOS architecture. For Intel Macs use PATH=~/bin:$PATH ``` -1. With the `zrok` executable in your path, you can then execute the `zrok` command from your shell: +1. With the `zrok` executable in your path, you can then execute the `zrok2` command from your shell: ```text - zrok version + zrok2 version ``` ```buttonless title="Output" diff --git a/website/docs/guides/install/windows.mdx b/website/docs/guides/install/windows.mdx index 6515a6ee..a7f6f3ab 100644 --- a/website/docs/guides/install/windows.mdx +++ b/website/docs/guides/install/windows.mdx @@ -40,10 +40,10 @@ import useBaseUrl from '@docusaurus/useBaseUrl'; } ``` -1. With the `zrok` executable in your path, you can then execute the `zrok` directly. +1. With the `zrok` executable in your path, you can then execute the `zrok2` directly. ```text - zrok version + zrok2 version ``` ```buttonless title="Output" diff --git a/website/docs/guides/permission-modes.md b/website/docs/guides/permission-modes.md index 721aeaa9..3b25d4a4 100644 --- a/website/docs/guides/permission-modes.md +++ b/website/docs/guides/permission-modes.md @@ -13,66 +13,66 @@ Shares created in zrok `v0.4.26` and newer now include a choice of _permission m Shares created with zrok `v0.4.25` and older were created using what is now called the _open permission mode_. Whether _public_ or _private_, these shares can be accessed by any user of the zrok service instance, as long as they know the _share token_ of the share. Effectively shares with the _open permission mode_ are accessible by any user of the zrok service instance. -zrok now supports a _closed permission mode_, which allows for more fine-grained control over which zrok users are allowed to privately access your shares using `zrok access private`. +zrok now supports a _closed permission mode_, which allows for more fine-grained control over which zrok users are allowed to privately access your shares using `zrok2 access private`. zrok defaults to continuing to create shares with the _open permission mode_. This will likely change in a future release. We're leaving the default behavior in place to allow users a period of time to get comfortable with the new permission modes. ## Creating a Share with Closed Permission Mode -Adding the `--closed` flag to the `zrok share` command will create shares using the _closed permission mode_: +Adding the `--closed` flag to the `zrok2 share` command will create shares using the _closed permission mode_: ``` -$ zrok share private --headless --closed -b web . +$ zrok2 share private --headless --closed -b web . [ 0.066] INFO main.(*sharePrivateCommand).run: allow other to access your share with the following command: -zrok access private 0vzwzodf0c7g +zrok2 access private 0vzwzodf0c7g ``` By default any environment owned by the account that created the share is _allowed_ to access the new share. But a user trying to access the share from an environment owned by a different account will enounter the following error message: ``` -$ zrok access private 0vzwzodf0c7g +$ zrok2 access private 0vzwzodf0c7g [ERROR]: unable to access ([POST /access][401] accessUnauthorized) ``` -The `zrok share` command includes an `--access-grant` flag, which allows you to specify additional zrok accounts that are allowed to access your shares: +The `zrok2 share` command includes an `--access-grant` flag, which allows you to specify additional zrok accounts that are allowed to access your shares: ``` -$ zrok share private --headless --closed --access-grant anotheruser@test.com -b web . +$ zrok2 share private --headless --closed --access-grant anotheruser@test.com -b web . [ 0.062] INFO main.(*sharePrivateCommand).run: allow other to access your share with the following command: -zrok access private y6h4at5xvn6o +zrok2 access private y6h4at5xvn6o ``` And now `anotheruser@test.com` will be allowed to access the share: ``` -$ zrok access private --headless y6h4at5xvn6o +$ zrok2 access private --headless y6h4at5xvn6o [ 0.049] INFO main.(*accessPrivateCommand).run: allocated frontend 'VyvrJihAOEHD' [ 0.051] INFO main.(*accessPrivateCommand).run: access the zrok share at the following endpoint: http://127.0.0.1:9191 ``` ## Adding and Removing Access Grants for Existing Shares -If you've created a share (either reserved or ephemeral) and you forgot to include an access grant, or want to remove an access grant that was mistakenly added, you can use the `zrok modify share` command to make the adjustments: +If you've created a share (either reserved or ephemeral) and you forgot to include an access grant, or want to remove an access grant that was mistakenly added, you can use the `zrok2 modify share` command to make the adjustments: Create a share: ``` -$ zrok share private --headless --closed -b web . +$ zrok2 share private --headless --closed -b web . [ 0.064] INFO main.(*sharePrivateCommand).run: allow other to access your share with the following command: -zrok access private s4czjylwk7wa +zrok2 access private s4czjylwk7wa ``` In another shell in the same environment you can execute: ``` -$ zrok modify share s4czjylwk7wa --add-access-grant anotheruser@test.com +$ zrok2 modify share s4czjylwk7wa --add-access-grant anotheruser@test.com updated ``` And to remove the grant: ``` -$ zrok modify share s4czjylwk7wa --remove-access-grant anotheruser@test.com +$ zrok2 modify share s4czjylwk7wa --remove-access-grant anotheruser@test.com updated ``` @@ -82,27 +82,27 @@ In zrok v2.0, you can use permission modes with reserved names for persistent pu ```bash # create a reserved name -$ zrok create name -n public myapp +$ zrok2 create name -n public myapp # share with closed permission mode using the name -$ zrok share public localhost:8080 -n public:myapp --closed --access-grant friend@example.com +$ zrok2 share public localhost:8080 -n public:myapp --closed --access-grant friend@example.com ``` For persistent private shares in v2.0, use the `--share-token` flag: ```bash # create a persistent private share with custom token and closed permissions -$ zrok share private localhost:8080 --share-token myapi --closed --access-grant colleague@example.com +$ zrok2 share private localhost:8080 --share-token myapi --closed --access-grant colleague@example.com ``` You can modify access grants for shares using reserved names or custom share tokens: ```bash # modify a share using a reserved name's current share token -$ zrok modify share --add-access-grant user@example.com +$ zrok2 modify share --add-access-grant user@example.com # or modify using the custom share token -$ zrok modify share myapi --add-access-grant user@example.com +$ zrok2 modify share myapi --add-access-grant user@example.com ``` ## Limitations diff --git a/website/docs/guides/self-hosting/dynamicProxy.md b/website/docs/guides/self-hosting/dynamicProxy.md index b82a34e3..2ecf9fb9 100644 --- a/website/docs/guides/self-hosting/dynamicProxy.md +++ b/website/docs/guides/self-hosting/dynamicProxy.md @@ -132,12 +132,12 @@ This section covers setting up dynamicProxy from scratch on a new zrok instance. First, create a Ziti identity for the dynamicProxyController service: ```bash -zrok admin create identity dynamicProxyController +zrok2 admin create identity dynamicProxyController ``` This command outputs the identity details. Save the identity's Ziti ID (starts with a letter, like `aBc123`), as you'll need it for the next steps. -The identity configuration file is saved to `~/.zrok/identities/dynamicProxyController.json` by default. +The identity configuration file is saved to `~/.zrok2/identities/dynamicProxyController.json` by default. ### Step 2: Create Ziti Service and Policies @@ -179,7 +179,7 @@ Add the dynamicProxyController configuration to your zrok controller configurati ```yaml # Add to your existing controller configuration dynamic_proxy_controller: - identity_path: /home/zrok/.zrok/identities/dynamicProxyController.json + identity_path: /home/zrok/.zrok2/identities/dynamicProxyController.json service_name: dynamicProxyController amqp_publisher: @@ -202,7 +202,7 @@ sudo systemctl restart zrok-controller # If running manually # Stop the controller (Ctrl+C) and restart it -zrok controller etc/ctrl.yml +zrok2 controller etc/ctrl.yml ``` ### Step 4: Create a Namespace @@ -211,10 +211,10 @@ Namespaces provide logical grouping for names. Create your first namespace: ```bash # Create an open namespace (anyone can create names in it) -zrok admin create namespace --token public --open zrok.example.com +zrok2 admin create namespace --token public --open zrok.example.com # Or create a closed namespace (requires grants) -zrok admin create namespace --token private private.example.com +zrok2 admin create namespace --token private private.example.com ``` The command outputs a namespace token (e.g., `abc123xyz`). Save this token as you'll need it for frontend mapping and when creating names. @@ -229,7 +229,7 @@ Parameters: Create a frontend with the dynamic flag enabled: ```bash -zrok admin create frontend --dynamic public "http://{token}.zrok.example.com:8080" +zrok2 admin create frontend --dynamic public "http://{token}.zrok.example.com:8080" ``` This creates a dynamic frontend and outputs a frontend token (e.g., `KMmfE0VXO7Pp`). @@ -248,7 +248,7 @@ Command breakdown: Link the namespace to the frontend so shares in the namespace are served by this frontend: ```bash -zrok admin create namespace-frontend +zrok2 admin create namespace-frontend ``` You can map multiple frontends to a single namespace for load balancing and high availability. All mapped frontends will receive the same mapping updates via AMQP. @@ -259,10 +259,10 @@ To view existing mappings: ```bash # List frontends for a namespace -zrok admin list namespaceFrontendMappings +zrok2 admin list namespaceFrontendMappings # List namespaces for a frontend -zrok admin list frontendNamespaceMappings +zrok2 admin list frontendNamespaceMappings ``` ### Step 7: Configure dynamicProxy Frontend @@ -282,7 +282,7 @@ amqp_subscriber: exchange_name: dynamicProxy controller: - identity_path: /home/zrok/.zrok/identities/public.json + identity_path: /home/zrok/.zrok2/identities/public.json service_name: dynamicProxyController ``` @@ -340,7 +340,7 @@ tls: Run the dynamicProxy frontend using your configuration: ```bash -zrok access dynamicProxy etc/dynamicProxy.yml +zrok2 access dynamicProxy etc/dynamicProxy.yml ``` The frontend will: @@ -362,7 +362,7 @@ Type=simple User=zrok Group=zrok WorkingDirectory=/home/zrok -ExecStart=/usr/local/bin/zrok access dynamicProxy /home/zrok/etc/dynamicProxy.yml +ExecStart=/usr/local/bin/zrok2 access dynamicProxy /home/zrok/etc/dynamicProxy.yml Restart=always RestartSec=10 @@ -384,16 +384,16 @@ Create a test share to verify the setup: ```bash # First, enable a zrok environment if you haven't already -zrok enable +zrok2 enable # Set the default namespace for convenience -zrok config set defaultNamespace +zrok2 config set defaultNamespace # Create a reserved name in the namespace -zrok create name -n my-test-share +zrok2 create name -n my-test-share # Share a resource using the reserved name -zrok share public --backend-mode web -n :my-test-share ~/public +zrok2 share public --backend-mode web -n :my-test-share ~/public ``` Access your share at `http://my-test-share.zrok.example.com:8080` (adjust domain/port based on your configuration). @@ -422,13 +422,13 @@ This approach allows both publicProxy and dynamicProxy to run simultaneously, en Users need to: 1. Upgrade to zrok v2.0+ -2. Set the default namespace: `zrok config set defaultNamespace ` +2. Set the default namespace: `zrok2 config set defaultNamespace ` 3. Recreate their shares using names: ```bash - # Instead of: zrok reserve public 8080 + # Instead of: zrok2 reserve public 8080 # They use: - zrok create name my-app - zrok share public localhost:8080 -n :my-app + zrok2 create name my-app + zrok2 share public localhost:8080 -n :my-app ``` #### Deprecation Timeline @@ -464,7 +464,7 @@ This approach requires downtime but provides a clean migration in a single maint All users must: 1. Upgrade to zrok v2.0+ -2. Set default namespace: `zrok config set defaultNamespace ` +2. Set default namespace: `zrok2 config set defaultNamespace ` 3. Recreate shares as shown in Option 1 :::warning @@ -509,7 +509,7 @@ amqp_subscriber: # Controller client for gRPC queries controller: - identity_path: /home/zrok/.zrok/identities/public.json + identity_path: /home/zrok/.zrok2/identities/public.json service_name: dynamicProxyController timeout: 30s # Optional: gRPC request timeout (default: 30s) @@ -573,10 +573,10 @@ Namespaces can be **open** (anyone can create names) or **closed** (requires gra ```bash # Open namespace - users can freely create names -zrok admin create namespace public "Public Shares" -o +zrok2 admin create namespace public "Public Shares" -o # Closed namespace - requires explicit grants -zrok admin create namespace private "Private Shares" +zrok2 admin create namespace private "Private Shares" ``` ### Granting Namespace Access @@ -584,13 +584,13 @@ zrok admin create namespace private "Private Shares" For closed namespaces, grant users access by email: ```bash -zrok admin add namespaceGrant user@example.com +zrok2 admin add namespaceGrant user@example.com ``` Remove grants with: ```bash -zrok admin remove namespaceGrant user@example.com +zrok2 admin remove namespaceGrant user@example.com ``` ### Setting Default Namespace @@ -598,13 +598,13 @@ zrok admin remove namespaceGrant user@example.com Users can set their default namespace to avoid specifying it on every command: ```bash -zrok config set defaultNamespace +zrok2 config set defaultNamespace ``` Or via environment variable: ```bash -export ZROK_DEFAULT_NAMESPACE= +export ZROK2_DEFAULT_NAMESPACE= ``` ### Listing Namespaces @@ -612,13 +612,13 @@ export ZROK_DEFAULT_NAMESPACE= Users can see available namespaces (based on grants and open namespaces): ```bash -zrok list namespaces +zrok2 list namespaces ``` Administrators can list all namespaces: ```bash -zrok admin list namespaces +zrok2 admin list namespaces ``` ## Troubleshooting @@ -695,17 +695,17 @@ zrok admin list namespaces 1. Verify namespace-to-frontend mapping exists: ```bash - zrok admin list namespace-frontend + zrok2 admin list namespace-frontend ``` 2. Check if the name exists: ```bash - zrok list names + zrok2 list names ``` 3. Verify the share is active: ```bash - zrok list shares + zrok2 list shares ``` 4. Check frontend logs for mapping presence: @@ -780,8 +780,8 @@ For high availability and load balancing, run multiple dynamicProxy instances: 1. Create separate configuration files for each instance (with unique bind addresses if on the same host) 2. Map the same namespace to multiple frontends: ```bash - zrok admin create namespace-frontend - zrok admin create namesapce-frontend + zrok2 admin create namespace-frontend + zrok2 admin create namesapce-frontend ``` 3. Use a load balancer (nginx, HAProxy, etc.) in front of the instances 4. Each instance will receive mapping updates via AMQP independently diff --git a/website/docs/guides/self-hosting/error-pages.md b/website/docs/guides/self-hosting/error-pages.md index 482c0252..22dbc7fb 100644 --- a/website/docs/guides/self-hosting/error-pages.md +++ b/website/docs/guides/self-hosting/error-pages.md @@ -19,15 +19,15 @@ The error page system uses Go's `text/template` package to render HTML pages wit ## Configuration Options -### Private Access (`zrok access private`) +### Private Access (`zrok2 access private`) For private access frontends, use the `--template-path` flag: ```bash -zrok access private --template-path /path/to/custom-template.html +zrok2 access private --template-path /path/to/custom-template.html ``` -### Public Frontend (`zrok access public`) +### Public Frontend (`zrok2 access public`) For public frontends, add the `template_path` configuration option to your frontend configuration YAML: @@ -45,7 +45,7 @@ template_path: /path/to/custom-template.html Then start the public frontend: ```bash -zrok access public /path/to/frontend-config.yml +zrok2 access public /path/to/frontend-config.yml ``` ## Template Structure @@ -199,7 +199,7 @@ Your template will be used for various error conditions: ### Share Not Found (404) - **Title**: `'' not found!` - **Banner**: `share not found!` -- **Message**: `are you running zrok share for this share?` +- **Message**: `are you running zrok2 share for this share?` ### Unauthorized Access (401) - **Title**: `unauthorized!` diff --git a/website/docs/guides/self-hosting/instance-configuration.mdx b/website/docs/guides/self-hosting/instance-configuration.mdx index 0e0db5cd..438c7891 100644 --- a/website/docs/guides/self-hosting/instance-configuration.mdx +++ b/website/docs/guides/self-hosting/instance-configuration.mdx @@ -12,7 +12,7 @@ The `zrok` *command* on your computer uses a `zrok` *instance* over the network. The default instance API endpoint for the `zrok` command is `api-v2.zrok.io`. Set the API endpoint to another instance's API endpoint: ```text -zrok config set apiEndpoint https://zrok.example.com +zrok2 config set apiEndpoint https://zrok.example.com ``` ```buttonless title="Output" @@ -22,13 +22,13 @@ zrok configuration updated ``` :::note -The `WARNING` about `environment metadata` is expected when you run `zrok config set` before `zrok enable`. +The `WARNING` about `environment metadata` is expected when you run `zrok2 config set` before `zrok2 enable`. ::: -You can use the `zrok status` command to inspect the state of your local _environment_. `zrok` refers to each shell where you install and `enable` a copy of `zrok` as an _environment_. +You can use the `zrok2 status` command to inspect the state of your local _environment_. `zrok` refers to each shell where you install and `enable` a copy of `zrok` as an _environment_. ```text -zrok status +zrok2 status ``` ```buttonless title="Output" @@ -39,8 +39,8 @@ Config: [WARNING]: Unable to load your local environment! -To create a local environment use the zrok enable command. +To create a local environment use the zrok2 enable command. ``` -The `zrok status` command shows the configured API service that your environment is using, as well as the `SOURCE` where the setting was retrieved. In this case, `config` means that the setting was set into the environment using the `zrok config` command. +The `zrok2 status` command shows the configured API service that your environment is using, as well as the `SOURCE` where the setting was retrieved. In this case, `config` means that the setting was set into the environment using the `zrok2 config` command. diff --git a/website/docs/guides/self-hosting/linux/index.mdx b/website/docs/guides/self-hosting/linux/index.mdx index ac6e6281..d71efdb9 100644 --- a/website/docs/guides/self-hosting/linux/index.mdx +++ b/website/docs/guides/self-hosting/linux/index.mdx @@ -99,7 +99,7 @@ ziti: ``` -The `admin` section defines privileged administrative credentials and must be set in the `ZROK_ADMIN_TOKEN` environment variable in shells where you want to run `zrok admin`. +The `admin` section defines privileged administrative credentials and must be set in the `ZROK2_ADMIN_TOKEN` environment variable in shells where you want to run `zrok2 admin`. The `endpoint` section defines where your `zrok` controller will listen. @@ -119,12 +119,12 @@ See the separate guides on [configuring metrics](../../../guides/self-hosting/me The `zrok` binaries are configured to work with the global `zrok.io` service, and default to using `api-v1.zrok.io` as the endpoint for communicating with the service. -To work with a self-hosted `zrok` deployment, you'll need to set the `ZROK_API_ENDPOINT` environment variable to point to the address where your `zrok` controller will be listening, according to `endpoint` in the configuration file above. +To work with a self-hosted `zrok` deployment, you'll need to set the `ZROK2_API_ENDPOINT` environment variable to point to the address where your `zrok` controller will be listening, according to `endpoint` in the configuration file above. In my case, I've set: ```bash -export ZROK_API_ENDPOINT=http://127.0.0.1:18080 +export ZROK2_API_ENDPOINT=http://127.0.0.1:18080 ``` [Read more about configuring your self-hosted `zrok` instance](../../../guides/self-hosting/instance-configuration.mdx). @@ -133,10 +133,10 @@ export ZROK_API_ENDPOINT=http://127.0.0.1:18080 With your OpenZiti network running and your configuration saved to a local file (I refer to mine as `etc/ctrl.yml` in these examples), you're ready to bootstrap the Ziti network. -Use the `zrok admin bootstrap` command to bootstrap like this: +Use the `zrok2 admin bootstrap` command to bootstrap like this: ```bash -$ zrok admin bootstrap etc/ctrl.yml +$ zrok2 admin bootstrap etc/ctrl.yml [ 0.002] INFO main.(*adminBootstrap).run: { ... } @@ -164,24 +164,24 @@ $ zrok admin bootstrap etc/ctrl.yml [ 0.140] INFO main.(*adminBootstrap).run: bootstrap complete! ``` -The `zrok admin bootstrap` command configures the `zrok` database, the necessary OpenZiti identities, and all of the OpenZiti policies required to run a `zrok` service. +The `zrok2 admin bootstrap` command configures the `zrok` database, the necessary OpenZiti identities, and all of the OpenZiti policies required to run a `zrok` service. Notice this warning: ``` -[ 0.120] WARNING zrok/controller.Bootstrap: missing public frontend for ziti id 'sqJRAINSiB'; please use 'zrok admin create frontend sqJRAINSiB public https://{token}.your.dns.name' to create a frontend instance +[ 0.120] WARNING zrok/controller.Bootstrap: missing public frontend for ziti id 'sqJRAINSiB'; please use 'zrok2 admin create frontend sqJRAINSiB public https://{token}.your.dns.name' to create a frontend instance ``` -If you find it necessary to re-run the `zrok admin bootstrap` command, you may need to add the `--skip-frontend` flag to avoid re-creating the default `public` frontend's Ziti identity and router policy. +If you find it necessary to re-run the `zrok2 admin bootstrap` command, you may need to add the `--skip-frontend` flag to avoid re-creating the default `public` frontend's Ziti identity and router policy. ## Run zrok Controller The `zrok` bootstrap process wants us to create a "public frontend" for our service. `zrok` uses public frontends to allow users to specify where they would like public traffic to ingress from. -The `zrok admin create frontend` command requires a running `zrok` controller, so let's start that up first: +The `zrok2 admin create frontend` command requires a running `zrok` controller, so let's start that up first: ```bash -$ zrok controller etc/ctrl.yml +$ zrok2 controller etc/ctrl.yml [ 0.003] INFO main.(*controllerCommand).run: { ... } @@ -198,10 +198,10 @@ $ zrok controller etc/ctrl.yml ## Create zrok Frontend -With our `ZROK_ADMIN_TOKEN` and `ZROK_API_ENDPOINT` environment variables set, we can create our public frontend like this: +With our `ZROK2_ADMIN_TOKEN` and `ZROK2_API_ENDPOINT` environment variables set, we can create our public frontend like this: ```bash -$ zrok admin create frontend sqJRAINSiB public http://{token}.zrok.quigley.com:8080 +$ zrok2 admin create frontend sqJRAINSiB public http://{token}.zrok.quigley.com:8080 [ 0.037] INFO main.(*adminCreateFrontendCommand).run: created global public frontend 'WEirJNHVlcW9' ``` @@ -240,7 +240,7 @@ You can also specify an `oauth` configuration in this file, full details of are In another terminal window, run: ```bash -$ zrok access public etc/http-frontend.yml +$ zrok2 access public etc/http-frontend.yml [ 0.002] INFO main.(*accessPublicCommand).run: { ... } @@ -251,10 +251,10 @@ The `zrok` frontend uses the `public` identity created during the bootstrap proc ## Create a User Account -With our `ZROK_ADMIN_TOKEN` and `ZROK_API_ENDPOINT` environment variables set, we can create our first user account. +With our `ZROK2_ADMIN_TOKEN` and `ZROK2_API_ENDPOINT` environment variables set, we can create our first user account. ```bash -zrok admin create account +zrok2 admin create account ``` The output is the account token you will use to enable each device's zrok environment. @@ -268,7 +268,7 @@ SuGzRPjVDIcF Offer this onboarding method to your users if you have configured an email-sending service in your `zrok` controller configuration. ```bash -$ zrok invite +$ zrok2 invite New Email: user@domain.com Confirm Email: user@domain.com invitation sent to 'user@domain.com'! @@ -301,13 +301,13 @@ Keep track of the token listed above (`SuGzRPjVDIcF`). We'll use this to enable On another device that can reach your Linux server by FQDN, configure the API endpoint and enable the environment with the account token you received when you created the first user account. ```bash -export ZROK_API_ENDPOINT=https://zrok.quigley.com +export ZROK2_API_ENDPOINT=https://zrok.quigley.com # or -zrok config set apiEndpoint https://zrok.quigley.com +zrok2 config set apiEndpoint https://zrok.quigley.com ``` ```bash -zrok enable SuGzRPjVDIcF +zrok2 enable SuGzRPjVDIcF ``` ```buttonless title="Example output" @@ -315,7 +315,7 @@ zrok environment '2AS1WZ3Sz' enabled for 'SuGzRPjVDIcF' ``` ```bash -zrok status --secrets +zrok2 status --secrets ``` ```buttonless title="Example output" diff --git a/website/docs/guides/self-hosting/linux/nginx.mdx b/website/docs/guides/self-hosting/linux/nginx.mdx index b12a128a..e637674b 100644 --- a/website/docs/guides/self-hosting/linux/nginx.mdx +++ b/website/docs/guides/self-hosting/linux/nginx.mdx @@ -90,10 +90,10 @@ If you followed the non-TLS quickstart then you may have opened 8080,18080/tcp i ## Update the zrok Frontend -List available frontends to obtain the token identifier of the frontend named "public". You may need to set `ZROK_ADMIN_TOKEN` or `ZROK_API_ENDPOINT` before running `zrok admin`. +List available frontends to obtain the token identifier of the frontend named "public". You may need to set `ZROK2_ADMIN_TOKEN` or `ZROK2_API_ENDPOINT` before running `zrok2 admin`. ```bash -$ zrok admin list frontends +$ zrok2 admin list frontends TOKEN ZID PUBLIC NAME URL TEMPLATE CREATED AT UPDATED AT 2NiDTRYUww18 7DsLh9DXG public http://{token}.zrok.quigley.com:8080 2023-01-19 05:29:20.793 +0000 UTC 2023-01-19 06:17:25 +0000 UTC @@ -102,6 +102,6 @@ $ zrok admin list frontends Update the URL template to use NGINX. ```bash -$ zrok admin update frontend 2NiDTRYUww18 --url-template https://{token}.zrok.quigley.com:443 +$ zrok2 admin update frontend 2NiDTRYUww18 --url-template https://{token}.zrok.quigley.com:443 [ 0.028] INFO main.(*adminUpdateFrontendCommand).run: updated global frontend '2NiDTRYUww18' ``` diff --git a/website/docs/guides/self-hosting/organizations.md b/website/docs/guides/self-hosting/organizations.md index f67b215a..7cee3995 100644 --- a/website/docs/guides/self-hosting/organizations.md +++ b/website/docs/guides/self-hosting/organizations.md @@ -11,14 +11,14 @@ Future zrok releases will include additional organization features, including `- ## Configuring an Organization -The API endpoints used to manage organizations and their members require a site-level `ZROK_ADMIN_TOKEN` to access. See the [self-hosting guide](linux/index.mdx#configure-the-controller) for details on configuring admin tokens. +The API endpoints used to manage organizations and their members require a site-level `ZROK2_ADMIN_TOKEN` to access. See the [self-hosting guide](linux/index.mdx#configure-the-controller) for details on configuring admin tokens. ### Create an Organization -The `zrok admin create organization` command is used to create organizations: +The `zrok2 admin create organization` command is used to create organizations: ``` -$ zrok admin create organization --help +$ zrok2 admin create organization --help Create a new organization Usage: @@ -41,16 +41,16 @@ Use the `-d` flag to add a description that shows up in end-user membership list We'll create an example organization: ``` -$ zrok admin create organization -d "documentation" +$ zrok2 admin create organization -d "documentation" [ 0.006] INFO main.(*adminCreateOrganizationCommand).run: created new organization with token 'gK1XRvthq7ci' ``` ### List Organizations -We use the `zrok admin list organizations` command to list our organizations: +We use the `zrok2 admin list organizations` command to list our organizations: ``` -$ zrok admin list organizations +$ zrok2 admin list organizations ORGANIZATION TOKEN DESCRIPTION gK1XRvthq7ci documentation @@ -58,10 +58,10 @@ $ zrok admin list organizations ### Add a Member to an Organization -We use the `zrok admin create org-member` command to add members to organizations: +We use the `zrok2 admin create org-member` command to add members to organizations: ``` -$ zrok admin create org-member +$ zrok2 admin create org-member Error: accepts 2 arg(s), received 0 Usage: zrok admin create org-member [flags] @@ -81,16 +81,16 @@ Global Flags: Like this: ``` -$ zrok admin create org-member gK1XRvthq7ci michael.quigley@netfoundry.io +$ zrok2 admin create org-member gK1XRvthq7ci michael.quigley@netfoundry.io [ 0.006] INFO main.(*adminCreateOrgMemberCommand).run: added 'michael.quigley@netfoundry.io' to organization 'gK1XRvthq7ci ``` -The `--admin` flag can be added to the `zrok admin create org-member` command to mark the member as an administrator of the organization. +The `--admin` flag can be added to the `zrok2 admin create org-member` command to mark the member as an administrator of the organization. ### List Members of an Organization ``` -$ zrok admin list org-members gK1XRvthq7ci +$ zrok2 admin list org-members gK1XRvthq7ci ACCOUNT EMAIL ADMIN? michael.quigley@netfoundry.io false @@ -98,14 +98,14 @@ $ zrok admin list org-members gK1XRvthq7ci ### Removing Organizations and Members -The `zrok admin delete org-member` and `zrok admin delete organization` commands are available to clean up organizations and their membership lists. +The `zrok2 admin delete org-member` and `zrok2 admin delete organization` commands are available to clean up organizations and their membership lists. ## End-user Organization Administrator Commands -When a zrok account is added to an organization as an administrator it allows them to use the `zrok organization admin` commands, which include: +When a zrok account is added to an organization as an administrator it allows them to use the `zrok2 organization admin` commands, which include: ``` -$ zrok organization admin +$ zrok2 organization admin Organization admin commands Usage: @@ -125,16 +125,16 @@ Global Flags: Use "zrok organization admin [command] --help" for more information about a command. ``` -The `zrok organization admin list` command is used to list the members of an organization. +The `zrok2 organization admin list` command is used to list the members of an organization. -The `zrok organization admin overview` command is used to retrieve an overview of an organization member account. This is functionally equivalent to what the `zrok overview` command does, but it allows an organization admin to retrieve the overview for another zrok account. +The `zrok2 organization admin overview` command is used to retrieve an overview of an organization member account. This is functionally equivalent to what the `zrok2 overview` command does, but it allows an organization admin to retrieve the overview for another zrok account. ## End-user Organization Commands -All zrok accounts can use the `zrok organization memberships` command to list the organizations they're a member of: +All zrok accounts can use the `zrok2 organization memberships` command to list the organizations they're a member of: ``` -$ zrok organization memberships +$ zrok2 organization memberships ORGANIZATION TOKEN DESCRIPTION ADMIN? gK1XRvthq7ci documentation false diff --git a/website/docs/guides/self-hosting/personalized-frontend.md b/website/docs/guides/self-hosting/personalized-frontend.md index 21a7aed8..aec5235b 100644 --- a/website/docs/guides/self-hosting/personalized-frontend.md +++ b/website/docs/guides/self-hosting/personalized-frontend.md @@ -24,10 +24,10 @@ Our deployment will end up looking like this: We're creating reserved names in a namespace for the `A`, `B`, and `C` shares, giving them specific names. These shares could be located together in a single environment on a single host, or can be located at completely different spots on the planet on completely different hosts. You could want to use significantly more shares than 3, or less. The secure sharing fabric allows seamless secure connectivity for these shared resources. This implementation will scale up or down as needed (use multiple hosts behind a load balancer for really big workloads). -Because we're using `private` zrok shares, they'll need to be accessed using a corresponding `zrok access` private command. The `zrok access private` command binds a "network listener" where the share can be accessed on an address and port on the host where the command is executed. You can use `zrok access private` to bind a network listener for a share in as many places as you want (up to the limit configuration of the service). +Because we're using `private` zrok shares, they'll need to be accessed using a corresponding `zrok2 access` private command. The `zrok2 access private` command binds a "network listener" where the share can be accessed on an address and port on the host where the command is executed. You can use `zrok2 access private` to bind a network listener for a share in as many places as you want (up to the limit configuration of the service). :::note -When you use `zrok share public`, you are allowing your shared resources to be accessed using the shared, public frontend provided by the service instance (zrok.io). `zrok share private` creates a private share that does not use the shared public frontend, and you'll need to use `zrok access private` in order to _bind_ that share to a network address where it can be accessed. +When you use `zrok2 share public`, you are allowing your shared resources to be accessed using the shared, public frontend provided by the service instance (zrok.io). `zrok2 share private` creates a private share that does not use the shared public frontend, and you'll need to use `zrok2 access private` in order to _bind_ that share to a network address where it can be accessed. In v2.0, you can create persistent private shares using the `--share-token` flag, which works similarly to reserved names for public shares. ::: @@ -36,13 +36,13 @@ Imagine that we own the domain `example.com`. In our example, we want to expose We can accomplish this easily with cheap VPS instance. You could also do it with containers through a container hosting service. The VPS will need an IP address exposed to the internet. You'll also need to be able to create DNS entries for the `example.com` domain. -To accomplish this, we're going to run 3 separate `zrok access private` commands on our VPS (see the [frontdoor guide](../frontdoor.mdx), or [zrok-private-access Docker Compose guide](../../guides/docker-share/docker_private_share_guide.md#access-the-private-share) for details on an approach for setting this up). One command each for shares `A`, `B`, and `C`. The `zrok access private` command works like this: +To accomplish this, we're going to run 3 separate `zrok2 access private` commands on our VPS (see the [frontdoor guide](../frontdoor.mdx), or [zrok-private-access Docker Compose guide](../../guides/docker-share/docker_private_share_guide.md#access-the-private-share) for details on an approach for setting this up). One command each for shares `A`, `B`, and `C`. The `zrok2 access private` command works like this: ``` -$ zrok access private +$ zrok2 access private Error: accepts 1 arg(s), received 0 Usage: - zrok access private [flags] + zrok2 access private [flags] Flags: -b, --bind string The address to bind the private frontend (default "127.0.0.1:9191") @@ -58,11 +58,11 @@ Notice the `--bind` flag. That flag is used to bind a network listener to a spec To expose our HTTPS shares, we're going to use a reverse proxy like nginx. The reverse proxy will be exposed to the internet, terminating TLS and reverse proxying `a.example.com` and `b.example.com` to the network listeners for shares `A` and `B`. -So, we'll configure our VPS to persistently launch a `zrok access private` for both of these shares. We'll use the `--bind` flag to bind `A` to `127.0.0.1:9191` and `B` to `127.0.0.1:9192`. +So, we'll configure our VPS to persistently launch a `zrok2 access private` for both of these shares. We'll use the `--bind` flag to bind `A` to `127.0.0.1:9191` and `B` to `127.0.0.1:9192`. We'll then configure nginx to have a virtual host for `a.example.com`, proxying that to `127.0.0.1:9191` and `b.example.com`, proxying that to `127.0.0.1:9192`. -Exposing our TCP port for `gaming.example.com` is simply a matter of running a third `zrok access private` with a `--bind` flag configured to point to `1.2.3.4:25565`. +Exposing our TCP port for `gaming.example.com` is simply a matter of running a third `zrok2 access private` with a `--bind` flag configured to point to `1.2.3.4:25565`. Once you've created the appropriate DNS entries for `a.example.com`, `b.example.com`, and `gaming.example.com` and worked through the TLS configuration (letsencrypt is your friend here), you'll have a fully functional personalized frontend for your zrok shares that you control. @@ -70,6 +70,6 @@ Your protected resources remain disconnected from the internet and are only reac ## Privacy -When you use a public frontend (with a simple `zrok share public`) at a hosted zrok instance (like zrok.io), the operators of that service have some amount of visibility into what traffic you're sending to your shares. The load balancers in front of the public frontend maintain logs describing all of the URLs that were accessed, as well as other information (headers, etc.) that contain information about the resource you're sharing. +When you use a public frontend (with a simple `zrok2 share public`) at a hosted zrok instance (like zrok.io), the operators of that service have some amount of visibility into what traffic you're sending to your shares. The load balancers in front of the public frontend maintain logs describing all of the URLs that were accessed, as well as other information (headers, etc.) that contain information about the resource you're sharing. -If you create private shares using `zrok share private` and then run your own `zrok access private` from some other location, the operators of the zrok service instance only know that some amount of data moved between the environment running the `zrok share private` and the `zrok access private`. There is no other information available. +If you create private shares using `zrok2 share private` and then run your own `zrok2 access private` from some other location, the operators of the zrok service instance only know that some amount of data moved between the environment running the `zrok2 share private` and the `zrok2 access private`. There is no other information available. diff --git a/website/docs/guides/self-hosting/self-service-invite.mdx b/website/docs/guides/self-hosting/self-service-invite.mdx index 4e88e71e..6e3ddfeb 100644 --- a/website/docs/guides/self-hosting/self-service-invite.mdx +++ b/website/docs/guides/self-hosting/self-service-invite.mdx @@ -6,7 +6,7 @@ This is how to set up self-service invitations for your users to get an account ## Overview -- You can create user accounts directly with the `zrok admin create account` CLI or API instead of inviting them. +- You can create user accounts directly with the `zrok2 admin create account` CLI or API instead of inviting them. - You can welcome users to invite themselves via email. - To enable self-service invitations you must also configure the controller to send email. - You can require an invitation token if you want to restrict self-service. @@ -16,7 +16,7 @@ This is how to set up self-service invitations for your users to get an account This is what your users will do. ```bash -zrok invite +zrok2 invite ``` ```buttonless title="Output" @@ -32,7 +32,7 @@ invitation sent to 'user@domain.com'! ## How it Works -The `zrok invite` command presents a small form that allows you to enter (and then confirm) your email address. Tabbing to the `[ Submit ]` button will start the invitation process. +The `zrok2 invite` command presents a small form that allows you to enter (and then confirm) your email address. Tabbing to the `[ Submit ]` button will start the invitation process. Next, check the email where you sent the invite. You should receive a message asking you to click a link to create your `zrok` account. When you click that link, you will be brought to a web page that will allow you to set a password for your new account. diff --git a/website/docs/guides/v2-migration-guide.md b/website/docs/guides/v2-migration-guide.md index 2ef99265..6334ac36 100644 --- a/website/docs/guides/v2-migration-guide.md +++ b/website/docs/guides/v2-migration-guide.md @@ -50,11 +50,11 @@ These commands no longer exist in v2.0: ```bash # no longer available -zrok reserve public --backend-mode web /path/to/files -zrok reserve private http://localhost:3000 -zrok share reserved -zrok release -zrok overview public-frontends +zrok2 reserve public --backend-mode web /path/to/files +zrok2 reserve private http://localhost:3000 +zrok2 share reserved +zrok2 release +zrok2 overview public-frontends ``` ### New Commands @@ -63,29 +63,29 @@ zrok overview public-frontends ```bash # list available namespaces -zrok list namespaces +zrok2 list namespaces # list all your names -zrok list names +zrok2 list names # create a reserved name (persistent) -zrok create name -n +zrok2 create name -n # modify a name (e.g., toggle reserved status) -zrok modify name -n -r|-r=false +zrok2 modify name -n -r|-r=false # delete a name -zrok delete name -n +zrok2 delete name -n ``` #### Sharing with Names ```bash # public share with a name selection -zrok share public -n : +zrok2 share public -n : # private share with vanity token -zrok share private --share-token my-custom-token +zrok2 share private --share-token my-custom-token ``` --- @@ -98,22 +98,22 @@ zrok share private --share-token my-custom-token ```bash # create a reserved share -$ zrok reserve public --backend-mode web /var/www/mysite +$ zrok2 reserve public --backend-mode web /var/www/mysite your reserved share token is 'abc123xyz' reserved frontend endpoint: https://abc123xyz.share.zrok.io # start sharing -$ zrok share reserved abc123xyz +$ zrok2 share reserved abc123xyz # later, release it -$ zrok release abc123xyz +$ zrok2 release abc123xyz ``` **v2.0 workflow:** ```bash # first, check available namespaces -$ zrok list namespaces +$ zrok2 list namespaces ╭───────────────────────┬─────────────────┬─────────────╮ │ NAME │ NAMESPACE TOKEN │ DESCRIPTION │ ├───────────────────────┼─────────────────┼─────────────┤ @@ -121,16 +121,16 @@ $ zrok list namespaces ╰───────────────────────┴─────────────────┴─────────────╯ # create a reserved name in the 'public' namespace -$ zrok create name -n public api +$ zrok2 create name -n public api # start sharing using the name selection -$ zrok share public localhost:8080 -n public:api +$ zrok2 share public localhost:8080 -n public:api # the name persists across share restarts -$ zrok share public localhost:8080 -n public:api +$ zrok2 share public localhost:8080 -n public:api # when done, delete the name -$ zrok delete name -n public api +$ zrok2 delete name -n public api ``` ### Scenario 2: Private Reserved Share @@ -139,24 +139,24 @@ $ zrok delete name -n public api ```bash # reserve a private share -$ zrok reserve private http://localhost:8080 +$ zrok2 reserve private http://localhost:8080 your reserved share token is 'xyz789abc' # share it -$ zrok share reserved xyz789abc +$ zrok2 share reserved xyz789abc # access from another environment -$ zrok access private xyz789abc +$ zrok2 access private xyz789abc ``` **v2.0 workflow:** ```bash # share privately using the name (-s specifies a share token name) -$ zrok share private http://localhost:8080 -s myapi-prod +$ zrok2 share private http://localhost:8080 -s myapi-prod # access from another environment -$ zrok access private myapi-prod +$ zrok2 access private myapi-prod ``` ### Scenario 3: Ephemeral Shares (Unchanged) @@ -165,7 +165,7 @@ Ephemeral shares work mostly the same, but now support optional name selections: ```bash # v1.x - still works in v2.0 -$ zrok share public :8080 +$ zrok2 share public :8080 ``` --- @@ -184,19 +184,19 @@ Shares with reserved name selections automatically restart after abnormal exit o ```bash # create a reserved name (-n defaults to 'public') -$ zrok create name myapp +$ zrok2 create name myapp # when agent running, share will persist across agent restarts due to reserved name # selection -$ zrok share public http://localhost:3000 -n public:myapp +$ zrok2 share public http://localhost:3000 -n public:myapp # when agent running, private share with --share-token will persist across agent restarts -$ zrok share private http://localhost:3000 --share-token myapp +$ zrok2 share private http://localhost:3000 --share-token myapp ``` ### Improved Status Command -The `zrok agent status` command now shows: +The `zrok2 agent status` command now shows: - Detailed error states for failed processes - Frontend endpoints for public shares - Failure information with error messages @@ -209,11 +209,11 @@ One powerful v2.0 feature: a single share can use multiple name selections: ```bash # create multiple names -$ zrok create name myapp -$ zrok create name myapp-staging +$ zrok2 create name myapp +$ zrok2 create name myapp-staging # share using both names -$ zrok share public http://localhost:3000 \ +$ zrok2 share public http://localhost:3000 \ -n public:myapp \ -n public:myapp-staging @@ -236,7 +236,7 @@ A namespace is a logical grouping for names, similar to how a DNS zone works. Yo ### Listing Available Namespaces ```bash -$ zrok list namespaces +$ zrok2 list namespaces ╭───────────────────────┬─────────────────┬─────────────╮ │ NAME │ NAMESPACE TOKEN │ DESCRIPTION │ @@ -253,7 +253,7 @@ $ zrok list namespaces ### View All Your Names ```bash -$ zrok list names +$ zrok2 list names ╭───────────────────────────────┬─────────┬───────────┬─────────────┬──────────┬─────────────────────╮ │ URL │ NAME │ NAMESPACE │ SHARE TOKEN │ RESERVED │ CREATED │ @@ -265,11 +265,11 @@ $ zrok list names ### View Overview (Now Includes Names) ```bash -$ zrok overview +$ zrok2 overview # shows human-readable format with names and namespaces # for json output -$ zrok overview --json +$ zrok2 overview --json ``` --- @@ -302,9 +302,9 @@ You'll need to update your scripts to use the new command structure. The good ne If you run into issues during migration: -1. Check `zrok status` to verify your environment is properly enabled -2. Use `zrok list namespaces` to see what namespaces are available to you -3. Use `zrok list names` to see your current names +1. Check `zrok2 status` to verify your environment is properly enabled +2. Use `zrok2 list namespaces` to see what namespaces are available to you +3. Use `zrok2 list names` to see your current names 4. Review the error messages - v2.0 has improved error reporting 5. Consult the [self-hosting guides](/docs/category/self-hosting/) if you manage your own instance 6. Check the [concepts documentation](/concepts/index.md) for deeper understanding diff --git a/website/docs/guides/vpn.md b/website/docs/guides/vpn.md index d719a29c..3ee2b755 100644 --- a/website/docs/guides/vpn.md +++ b/website/docs/guides/vpn.md @@ -38,7 +38,7 @@ The `tcpTunnel` backend mode allows you to tunnel specific TCP ports between hos On the machine you want to access (the "sharing" side): ```bash -zrok share private --backend-mode tcpTunnel localhost:22 +zrok2 share private --backend-mode tcpTunnel localhost:22 ``` This creates a private share and outputs a share token (e.g., `abc123`). @@ -46,7 +46,7 @@ This creates a private share and outputs a share token (e.g., `abc123`). On your local machine (the "accessing" side): ```bash -zrok access private --bind 127.0.0.1:2222 abc123 +zrok2 access private --bind 127.0.0.1:2222 abc123 ``` Now you can SSH to the remote machine through the tunnel: @@ -60,13 +60,13 @@ ssh -p 2222 user@127.0.0.1 Share a PostgreSQL database: ```bash -zrok share private --backend-mode tcpTunnel localhost:5432 +zrok2 share private --backend-mode tcpTunnel localhost:5432 ``` Access it locally: ```bash -zrok access private --bind 127.0.0.1:5432 +zrok2 access private --bind 127.0.0.1:5432 ``` Connect with your database client: @@ -84,13 +84,13 @@ The `socks` backend mode creates a SOCKS5 proxy, enabling dynamic port forwardin On the remote machine (the "sharing" side): ```bash -zrok share private --backend-mode socks +zrok2 share private --backend-mode socks ``` On your local machine (the "accessing" side): ```bash -zrok access private --bind 127.0.0.1:1080 +zrok2 access private --bind 127.0.0.1:1080 ``` Now configure your applications to use the SOCKS5 proxy at `127.0.0.1:1080`. For example: diff --git a/website/docs/myzrok/custom-domains/index.mdx b/website/docs/myzrok/custom-domains/index.mdx index 1cb89d7d..af39ab61 100644 --- a/website/docs/myzrok/custom-domains/index.mdx +++ b/website/docs/myzrok/custom-domains/index.mdx @@ -96,15 +96,15 @@ In order to create shares that utilize your custom DNS, you will need to specify or update your environment configuration to use this new frontend by default. ``` -zrok share public --frontend foo-example--goPIhgtJtz +zrok2 share public --frontend foo-example--goPIhgtJtz ``` You can set the custom frontend as the environment default by running: ``` -zrok config set defaultFrontend foo-example--goPIhgtJtz +zrok2 config set defaultFrontend foo-example--goPIhgtJtz ``` -To validate which frontend is being used, use the `zrok status` command, which will identify the default frontend being used: +To validate which frontend is being used, use the `zrok2 status` command, which will identify the default frontend being used: ![zrok_status](images/zrok_status.png) diff --git a/website/docs/myzrok/upgrading.md b/website/docs/myzrok/upgrading.md index 298ab2e6..932ce3b8 100644 --- a/website/docs/myzrok/upgrading.md +++ b/website/docs/myzrok/upgrading.md @@ -12,7 +12,7 @@ No action is necessary. If you are running version `1.0.0` or `1.0.1`, you can run the following to rebase your environment to use the new versioned API: ``` - zrok rebase apiEndpoint https://api-v1.zrok.io + zrok2 rebase apiEndpoint https://api-v1.zrok.io ``` Resume zrok API interactions as normal! @@ -23,11 +23,11 @@ Resume zrok API interactions as normal! If you run into any issues after upgrading your environment, first verify your zrok version and review your current zrok configuration: ``` -zrok version +zrok2 version ``` Review the `apiEndpoint` configuration, if you are running version `1.0` or later, the `apiEndpoint` should be `https://api-v1.zrok.io` ``` -zrok status +zrok2 status ``` If you're still having issues, we recommend you reach out to our community support team at our [zrok discourse](https://openziti.discourse.group/c/zrok/24) forum. @@ -35,17 +35,17 @@ If you're still having issues, we recommend you reach out to our community suppo If you prefer to do a hard reset of your environment, you can also run the commands below: :::warning -Running `zrok disable` will delete any running environments or shares, and will release any reserved shares +Running `zrok2 disable` will delete any running environments or shares, and will release any reserved shares ::: ``` -zrok disable +zrok2 disable ``` Reset the config back to the default API endpoint for the binary version ``` -zrok config unset apiEndpoint +zrok2 config unset apiEndpoint ``` Create a fresh environment ``` -zrok enable +zrok2 enable ```