Hostpath Snapshots on App Update

Hello everyone!

I’m migrating my home lab to TrueNAS Scale (25.04.1). I am trying to run all of my previous apps (Bitwarden, Traefik, Pi-Hole, etc.) and some custom apps on TrueNAS. I also want to start using NextCloud and Paperless-NGX since the new system has more CPU and RAM (before I had everything running in docker on a Raspberry PI)

I’m a huge fan of HostPath datasets because they give me better control over my datasets, allowing me to back them up and share them more easily. Also, when an app is deleted, I don’t lose the user data.

I noticed that when you update an app, a snapshot is created for all ix-apps datasets. This is important for keeping the data version synchronous with the app version. For example, if a new app version (Docker image) introduces a database migration step, and I need to roll back due to any issues, the old version of the app will not be compatible with the “modern” database schema. Therefore, I need a snapshot of the old database’s state and/or the user data to ensure consistency.

For a demo I configured the Dockge app to use these two ZFS datasets.

Type Source Destination Mode
bind /mnt/storage/stacks /mnt/storage/stacks
bind /mnt/.ix-apps/app_mounts/dockge/data /app/data

Since I didn’t want to lose the stacks folder when I removed Dockge, I created a HostPath called /mnt/storage/stacks. This allows me to share the stacks folder with other apps, such as Arcane.

Now, when I update an app. Only the /ix-apps/app_mounts/dockge/data ZFS dataset gets a snapshot. The /mnt/storage/stacks HostPath dataset does not.

storage/ix-apps/app_mounts/dockge@1.2.4                            0B      -   140K  -
storage/ix-apps/app_mounts/dockge/data@1.2.4                      93K      -   157K  -

(For Dockge, it’s not a big problem, but let’s pretend it’s Nextcloud or a database.) In the event of a rollback, only the ix-apps datasets would be able to roll back; the other would be left alone, and the app might end up in a corrupted state. I could manually create snapshots of the HostPath dataset, but that would be error-prone and render the centralized versionized update/rollback mechanism in the UI useless.

Is there a way to make HostPath datasets eligible for snapshots when updating an app? A checkbox would be great. Alternatively, there could be a pre-app update script so that I can specify all the datasets belonging to an app in case of an update.

On my old system I was using GitHub - schuhumi/cipug: Container Images Pinning and Updating Gadget which handled my app versions and snapshots all in sync on BTRFS with one simple CLI command.

A’m I missing something? How are you handling this issue besides putting everything in TureNAS managed ix-apps datasets?

How are you handling this issue besides putting everything in TureNAS managed ix-apps datasets?

I think the answer is: they aren’t. You’re just supposed to use ix-apps, and not back it up.

For this any many other reasons, I recommend anyone to not use the community apps if they can help it. The whole thing is really poorly done. Just install Dockge like you did, and manage all your apps in there. Unfortunately, that doesn’t integrate with ZFS so it won’t automatically create snapshots when you update, so you’ll have to do that manually.

1 Like

Thank you very much for your answer. :handshake:

I fear you are right. :worried: For now, I will manage all apps myself with using git and dockge. Hopefully, this issue will be resolved in the future, which would make things much more convenient, allowing you to administer your apps on your smartphone.

The CIPUG tool does not currently support ZFS. However, I may be able to help the developer integrate it. Since Python is available on TrueNAS, this may solve the consistency problems.