Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zerotier: add persistent storage by default #664

Closed
LjMario007 opened this issue Oct 16, 2024 · 1 comment · Fixed by #675
Closed

Zerotier: add persistent storage by default #664

LjMario007 opened this issue Oct 16, 2024 · 1 comment · Fixed by #675
Assignees

Comments

@LjMario007
Copy link

Make persistent storage default to fix most struggles with Zerotier

Setting up ZeroTier on TrueNAS Scale is uniquely odd and difficult. Unlike other platforms where you just:

  1. install the app
  2. add your network id

and that client's setup is done,

With the Scale version, you have to

  1. generate the identity.secret and identity.public strings from another ZeroTier installation
  2. generate an API key from the Zerotier One website
  3. Install the app with these strings and your network id
  4. Still run into the app being stuck on "deploying" and other issues

This is because the SCALE implementation of ZT's Docker container has no persistent storage by default and instead attempts to do it entirely statelessly through the optional environment variables the container exposes.

Doing it this way is non-standard and leads to many more issues and headaches, like discussions here and here trying to figure it out with only partial success, or the fact that if storage is borked ZeroTier used to just generate a random new identity on each container restart, or the fact that on the latest SCALE install I'm still getting a Fatal error: invalid identity loaded from disk. Please remove identity.public and identity.secret from /var/lib/zerotier-one and try again despite the container not even having that directory. Not to mention that users shouldn't be forced to manually generate client secrets off of another ZT instance, just to install another client.

The simple solution is to make the optional data volume the default selection, as this allows the ZeroTier container to both generate and persist its own identity, and sidestep all of the above issues. In addition to fixing the above issues with having to manually generate client identities, and random regeneration, it also resolves the issue of the ZeroTier container showing "Deploying" while actively running. I also found it fixes the invalid identity loaded from disk issue. It seems the ZeroTier client is still partially built with the expectation of persistent storage, optional flags notwithstanding.

To implement this, we just need to map /var/ on the container by default to a new volume/location, creating a "ZeroTier Data Storage" volume like the other containers that require persistent storage. I’d be happy to take a shot at this, but I noticed a warning on the front page suggesting to hold off for now so I figured I'd wait before writing a possible implementation.

@stavros-k stavros-k self-assigned this Oct 16, 2024
@stavros-k
Copy link
Contributor

Looks like the docs for containerized ZT do not mention alternative ways for the identities.
And the only thing it has even now is the env vars.
Poking some issues around, I found that we just have to mount /var/lib/zerotier-one

I'll make the fields optional and mount a storage to that location by default.
If inputs are field, a mount will still happen but ZT will use the envs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants