How do you install an App with HostPath configuration/database files?

bollar

Patron
Joined
Oct 28, 2012
Messages
411
I've installed SCALE 21.08-BETA.1 on a test machine and I'm playing with Apps.

I assume this is a noob question, but my search skills didn't yield an answer.

I haven't figured out how to get the application's databases and configuration files to live outside the app. I have installed the TrueCharts catalog and I've watched the how-to videos. I've also looked at Helm Charts tutorials.

Using the TrueCharts Lidarr template as an example, if I simply click through the installer, Lidarr provisions and runs correctly and creates databases in /config.

I'd like to have the app use an existing database I have. I thought it would be simple enough to add HostPath / Additional App Storage and point my config directory to /config, but when I do that, the existing /config that the app created remains.

I also tried adding the additional app storage at initial creation, which fails with an error:

Code:
middlewared.service_exception.CallError: [EFAULT] Failed to install chart release: Error: Deployment.apps "lidarr" is invalid: spec.template.spec.containers[0].volumeMounts[1].mountPath: Invalid value: "/config": must be unique


Yes, I understand that error. So what do I need to do? Add my config to a different directory and point the app to use that? If so, how do I do that? Or, is there a way to make my external storage assignment take precedence over the one created by the app with an environment variable startup string or something like that?

Thank you for your wisdom.
 

truecharts

Guru
Joined
Aug 19, 2021
Messages
788
Some pointers:
- Default App configuration, which is always shown in the GUI, is stored in PVC, information about which is available on our website.
- You cannot the always-shown storage options with additional storage
- You can change the always-shown to hostPath. Which we DO NOT advice, as it breaks rollback.
- You can migrate existing config into the PVC.

For more in-depth support for TrueCharts Apps you can reach us by by both Email and Discord :cool:
 

bollar

Patron
Joined
Oct 28, 2012
Messages
411
Thanks!

I'll join the Discord, but what's the process for migrating the config into the PVC and then having a backup that doesn't get destroyed if something happens with Kubernetes?
 

bollar

Patron
Joined
Oct 28, 2012
Messages
411
Since this isn't TrueCharts related, I'll continue here. I see the documentation on how to copy files into a pod here: https://www.truenas.com/docs/scale/apps/usingapps/

Code:
k3s kubectl cp /tmp/foo <some-namespace>/<some-pod>:/tmp/bar

This works, but with the app still running, it seems like there's a risk of database corruption. And of course, if I stop the app, access to the pod goes away.

I see that Kubernetes doesn't have a direct way to suspend a running app while leaving the file system open (that I have found). The one suggestion I found was to change the number of replicas to 0. When I try that, the number is helpfully increased to 1 when the pod is started, so that doesn't work.

Is there a way to get this done, or should I just take a risk on the potential database corruption?
 

truecharts

Guru
Joined
Aug 19, 2021
Messages
788
Considering you are trying this with one of our Apps, we would suggest you check the discord. As there was just a discussion about it a few days ago.
We are also the only public catalog, that we know of, that actually uses PVC storage on TrueNAS SCALE.


TLDR: There are multiple ways of doing this, all with upsides and downsides. There isn't one single "best" way of migrating data to and from PVC storage :smile:
 

sjieke

Contributor
Joined
Jun 7, 2011
Messages
125
Some pointers:
- Default App configuration, which is always shown in the GUI, is stored in PVC, information about which is available on our website.
- You cannot the always-shown storage options with additional storage
- You can change the always-shown to hostPath. Which we DO NOT advice, as it breaks rollback.
- You can migrate existing config into the PVC.

For more in-depth support for TrueCharts Apps you can reach us by by both Email and Discord :cool:

I have a few questions/remarks which you might give some feedback on :)
  1. I asume hostPath breaks 'rollback' because you can't create 'snapshots' before the update and the config data might already be upgraded?
  2. I think a drawback of PVC is that if you delete the app, the config also gets deleted. Upgrades to charts with a newer common template are not supported, so in those cases you sometimes have to delete the app. Using hostPath this isn't an issue, as you just install it again, point to the same folders and everything is up and running in no time. Using PVC I have to remember to backup my configs and restore them after reïsntall.
 

bollar

Patron
Joined
Oct 28, 2012
Messages
411
With hints found on TrueCharts' Discord, here and in a Kubernetes forum, I was able to move my previous config into the TrueCharts containers including ingress & traefik. The process I used was fairly straightforward.

- Create, run, configure and stop the app.
- In the TrueNAS shell, do a zfs list to identify the app's dataset volume. It looks something like this for my librespeed instance:
tank/ix-applications/releases/librespeed/volumes/pvc-12abac60-06b8-4f04-80f6-ab890d8c106d
- In the TrueNAS shell zfs set mountpoint=/temporary tank/ix-applications/releases/librespeed/volumes/pvc-12abac60-06b8-4f04-80f6-ab890d8c106d . This will make the volume available at /mnt/temporary
- ssh into the TrueNAS server and note the permissions the files have in /mnt/temporary . Probably 568:568 if you didn't make any changes.
Replace the files in /mnt/temporary with your backup config. I used rsync with a command like this: sudo rsync -aP --human-readable --info=progress2 /mnt/tank/apps/librespeed/config/* /mnt/temporary/
- Reset the permissions to what you noted before: sudo chown -R 568:568 /mnt/temporary
- Back in the TrueNAS shell, reset the mountpoint to legacy: zfs set mountpoint=legacy tank/ix-applications/releases/librespeed/volumes/pvc-12abac60-06b8-4f04-80f6-ab890d8c106d
- Restart the app and validate your settings are now visible in the app.

The TrueCharts apps all installed easily and with the help videos on their site, it's a manageable process and probably wouldn't have been possible without the detailed information on linking apps internally.

The one exception was Plex -- I tried the official app and the TrueCharts app and I'm currently using the official app. There are several reasons -- the main one being that I couldn't make Plex remote access work reliably with traefik.

And now that I have a setup that is mostly complete, there's one thing that I wish I could work around and that's separate IP addresses for each app. My firewall (Untangle) limits several filters to IP address only, so now everything on Untangle applies to the entire SCALE server instead of specific apps.

I guess my next project will be hardware transcoding in Plex. Is that ready to test and what kind of Nvidia card is needed?
 

truecharts

Guru
Joined
Aug 19, 2021
Messages
788
Great summary from the discussion on the discord! :)
Feel free to send it in as a PR for documentation, under quick-start guides ;-)

The one exception was Plex -- I tried the official app and the TrueCharts app and I'm currently using the official app. There are several reasons -- the main one being that I couldn't make Plex remote access work reliably with traefik.
It's adviseable to always keep running nodeport 32400 for Plex, even wen running Ingress as well.
There's some flakyness going on from plex when using just ingress to reach plex.
 

bigzaj

Explorer
Joined
Jan 6, 2016
Messages
95
As opposed to the legacy process with jails of pointing configs to certain paths, with the new SCALE apps if / when doing a server upgrade would we need to manually backup the configs (reverse of this)?
 

truecharts

Guru
Joined
Aug 19, 2021
Messages
788
As opposed to the legacy process with jails of pointing configs to certain paths, with the new SCALE apps if / when doing a server upgrade would we need to manually backup the configs (reverse of this)?

generally speaking the backup procedure on our website + saving the SCALE config should cover all the ground required.
But as long as you don't migrate pools system upgrades don't really mater, luckily :)
 
Top