Neat! That looks like it would work for the package, and would enable many concurrent share services with zrok v4 without manually creating more service units. I like the idea of changing it this way as long as it doesn't complicate things too much for sharing a single service.
With v5 the service will be a centrally managed daemon, so one service will provide many shares. The limitations of the Linux service to a single share and only public shares will be further addressed with v5.
I finally had a reason to reach for this today and arrived at a slightly-simpler approach. This assumes you already installed the Linux package named "zrok".
Here's my templated service unit:
[Unit]
Description=zrok share reserved service - %i
After=network-online.target
[Service]
Type=simple
UMask=0007
ExecStart=/opt/openziti/bin/zrok share reserved %i --headless
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target
To use this template:
-
create the service unit template in ~/.config/systemd/user/zrok-share@.service
-
load the unit
systemctl daemon-reload --user
-
enable your login user's zrok environment if necessary, substituting your account token from the web console for "myaccounttoken"
zrok enable myaccounttoken
-
reserve a share token, optionally with a closed permission mode or custom/unique name or both
zrok reserve private 3000 --closed
[ 0.387] INFO main.(*reserveCommand).run: your reserved share token is 'f0xnfn6dtnvb'
-
start the background service to share
systemctl --user start zrok-share@f0xnfn6dtnvb.service
-
check the log
journalctl --user -eu zrok-share@f0xnfn6dtnvb.service
-
repeat the last steps for each additional share: reserve then start