-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
507 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,3 +57,71 @@ nfpms: | |
- src: /opt/openziti/bin/zrok | ||
dst: /usr/bin/zrok | ||
type: "symlink" | ||
|
||
- package_name: zrok-share | ||
id: zrok-share | ||
vendor: NetFoundry | ||
homepage: https://zrok.io/ | ||
maintainer: [email protected] | ||
description: |- | ||
This package provides zrok-share.service. To enable, edit the "/opt/openziti/etc/zrok/zrok-share.env" file with the | ||
desired sharing configuration, and run "systemctl enable zrok-share.service && systemctl restart zrok-share.service". | ||
license: Apache 2.0 | ||
|
||
# do not bundle the built binaries, only supporting files | ||
meta: true | ||
|
||
# Formats to be generated. | ||
formats: | ||
- deb | ||
- rpm | ||
|
||
# {{ .ConventionalFileName }} satisfies the RPM name convention. | ||
file_name_template: "{{ .ConventionalFileName }}" | ||
|
||
# Umask to be used on files without explicit mode set. (overridable) | ||
umask: 0o002 | ||
|
||
# Package version within this release version. | ||
release: 1 | ||
|
||
# Section. | ||
section: default | ||
|
||
# Priority. | ||
priority: optional | ||
|
||
# GoReleaser will automatically add the binaries here | ||
dependencies: | ||
- zrok | ||
|
||
recommends: | ||
- jq | ||
|
||
# Contents to add to the package. | ||
contents: | ||
- dst: /lib/systemd/system/ | ||
src: ./nfpm/zrok-share.service | ||
|
||
- dst: /opt/openziti/etc/zrok | ||
type: dir | ||
file_info: | ||
mode: 0755 | ||
|
||
- dst: /opt/openziti/bin/ | ||
src: ./nfpm/zrok-share.bash | ||
file_info: | ||
mode: 0755 | ||
|
||
- dst: /opt/openziti/bin/ | ||
src: ./nfpm/zrok-enable.bash | ||
file_info: | ||
mode: 0755 | ||
|
||
- dst: /opt/openziti/etc/zrok/ | ||
src: ./nfpm/zrok-share.env | ||
type: config|noreplace | ||
|
||
- dst: /opt/openziti/etc/zrok/ | ||
src: ./etc/caddy/multiple_upstream.Caddyfile | ||
type: config|noreplace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,3 +57,71 @@ nfpms: | |
- src: /opt/openziti/bin/zrok | ||
dst: /usr/bin/zrok | ||
type: "symlink" | ||
|
||
- package_name: zrok-share | ||
id: zrok-share | ||
vendor: NetFoundry | ||
homepage: https://zrok.io/ | ||
maintainer: [email protected] | ||
description: |- | ||
This package provides zrok-share.service. To enable, edit the "/opt/openziti/etc/zrok/zrok-share.env" file with the | ||
desired sharing configuration, and run "systemctl enable zrok-share.service && systemctl restart zrok-share.service". | ||
license: Apache 2.0 | ||
|
||
# do not bundle the built binaries, only supporting files | ||
meta: true | ||
|
||
# Formats to be generated. | ||
formats: | ||
- deb | ||
- rpm | ||
|
||
# {{ .ConventionalFileName }} satisfies the RPM name convention. | ||
file_name_template: "{{ .ConventionalFileName }}" | ||
|
||
# Umask to be used on files without explicit mode set. (overridable) | ||
umask: 0o002 | ||
|
||
# Package version within this release version. | ||
release: 1 | ||
|
||
# Section. | ||
section: default | ||
|
||
# Priority. | ||
priority: optional | ||
|
||
# GoReleaser will automatically add the binaries here | ||
dependencies: | ||
- zrok | ||
|
||
recommends: | ||
- jq | ||
|
||
# Contents to add to the package. | ||
contents: | ||
- dst: /lib/systemd/system/ | ||
src: ./nfpm/zrok-share.service | ||
|
||
- dst: /opt/openziti/etc/zrok | ||
type: dir | ||
file_info: | ||
mode: 0755 | ||
|
||
- dst: /opt/openziti/bin/ | ||
src: ./nfpm/zrok-share.bash | ||
file_info: | ||
mode: 0755 | ||
|
||
- dst: /opt/openziti/bin/ | ||
src: ./nfpm/zrok-enable.bash | ||
file_info: | ||
mode: 0755 | ||
|
||
- dst: /opt/openziti/etc/zrok/ | ||
src: ./nfpm/zrok-share.env | ||
type: config|noreplace | ||
|
||
- dst: /opt/openziti/etc/zrok/ | ||
src: ./etc/caddy/multiple_upstream.Caddyfile | ||
type: config|noreplace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,3 +53,71 @@ nfpms: | |
- src: /opt/openziti/bin/zrok | ||
dst: /usr/bin/zrok | ||
type: "symlink" | ||
|
||
- package_name: zrok-share | ||
id: zrok-share | ||
vendor: NetFoundry | ||
homepage: https://zrok.io/ | ||
maintainer: [email protected] | ||
description: |- | ||
This package provides zrok-share.service. To enable, edit the "/opt/openziti/etc/zrok/zrok-share.env" file with the | ||
desired sharing configuration, and run "systemctl enable zrok-share.service && systemctl restart zrok-share.service". | ||
license: Apache 2.0 | ||
|
||
# do not bundle the built binaries, only supporting files | ||
meta: true | ||
|
||
# Formats to be generated. | ||
formats: | ||
- deb | ||
- rpm | ||
|
||
# {{ .ConventionalFileName }} satisfies the RPM name convention. | ||
file_name_template: "{{ .ConventionalFileName }}" | ||
|
||
# Umask to be used on files without explicit mode set. (overridable) | ||
umask: 0o002 | ||
|
||
# Package version within this release version. | ||
release: 1 | ||
|
||
# Section. | ||
section: default | ||
|
||
# Priority. | ||
priority: optional | ||
|
||
# GoReleaser will automatically add the binaries here | ||
dependencies: | ||
- zrok | ||
|
||
recommends: | ||
- jq | ||
|
||
# Contents to add to the package. | ||
contents: | ||
- dst: /lib/systemd/system/ | ||
src: ./nfpm/zrok-share.service | ||
|
||
- dst: /opt/openziti/etc/zrok | ||
type: dir | ||
file_info: | ||
mode: 0755 | ||
|
||
- dst: /opt/openziti/bin/ | ||
src: ./nfpm/zrok-share.bash | ||
file_info: | ||
mode: 0755 | ||
|
||
- dst: /opt/openziti/bin/ | ||
src: ./nfpm/zrok-enable.bash | ||
file_info: | ||
mode: 0755 | ||
|
||
- dst: /opt/openziti/etc/zrok/ | ||
src: ./nfpm/zrok-share.env | ||
type: config|noreplace | ||
|
||
- dst: /opt/openziti/etc/zrok/ | ||
src: ./etc/caddy/multiple_upstream.Caddyfile | ||
type: config|noreplace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
# Caddyfile Samples | ||
|
||
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 | ||
http:// { | ||
bind {{ .ZrokBindAddress }} | ||
# customize reverse_proxy, file_server, etc. | ||
} | ||
``` | ||
|
||
## Notes | ||
|
||
simple_reverse_proxy.Caddyfile is bundled in the zrok-share package for Linux as an example Caddyfile. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
# nfpm supporting files | ||
|
||
These files are sourced by nfpm when invoked by goreleaser to build Linux packages. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# this script uses a zrok enable token to enable a zrok environment in $HOME/.zrok | ||
# | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
# set HOME to the first colon-sep dir in STATE_DIRECTORY inherited from systemd, e.g. /var/lib/zrok-share | ||
export HOME="${STATE_DIRECTORY%:*}" | ||
|
||
if (( $# )); then | ||
if [[ -s "$1" ]]; then | ||
source "$1" | ||
else | ||
echo "ERROR: $1 is empty or not a readable file" >&2 | ||
exit 1 | ||
fi | ||
else | ||
# TODO: consider defining a default environment file | ||
# if [[ -s /opt/openziti/etc/zrok.env ]]; then | ||
# source /opt/openziti/etc/zrok.env | ||
# else | ||
# echo "ERROR: need /opt/openziti/etc/zrok.env or filename argument to read share configuration" >&2 | ||
# exit 1 | ||
# fi | ||
echo "ERROR: need filename argument to read env configuration" >&2 | ||
exit 1 | ||
fi | ||
|
||
if [[ -s ~/.zrok/environment.json ]]; then | ||
echo "INFO: zrok environment is already enabled. Delete '$(realpath ~/.zrok/environment.json)' if you want to destroy"\ | ||
" it and create a new environment." | ||
exit 0 | ||
else | ||
if [[ -z "${ZROK_ENABLE_TOKEN}" ]]; then | ||
echo "ERROR: ZROK_ENABLE_TOKEN is not defined" >&2 | ||
exit 1 | ||
else | ||
zrok config set apiEndpoint "${ZROK_API_ENDPOINT:-https://api.zrok.io}" | ||
echo "INFO: running: zrok enable ..." | ||
exec zrok enable --headless --description "${ZROK_ENVIRONMENT_NAME:-$(hostname -s) reserved public share}" "${ZROK_ENABLE_TOKEN}" | ||
fi | ||
fi | ||
|
Oops, something went wrong.