ix-applications recovering deleted apps from snapshots ~ experiments

beaster

Dabbler
Joined
May 17, 2021
Messages
27
I'll preface the following by noting that I am currently using TrueNAS-SCALE-23.10.0.1 - Cobia

The Apps UI is quite different to the mainline version and has some functionality that can lead to easy mistakes.
(be careful the selected Application on the left is not in sync with the App Details in the middle tab, which I discovered after trying to delete the wrong app, operating on muscle memory, too late)

I had a hard time locating how to recover an APP that was accidentally deleted from my ix-applications installation.
I'd setup a plex instance and used a lot of host path configuration that I'd assumed would help restore the application in the event that did something very wrong.
Turns out that was not as simple as I had expected, in part because you have to recall what the settings are for the App in question.
I did know where the config folders were vs using PVCs but the specific of all of the config was more complex than I could recall easily

As mentioned above I had accidentally deleted plex whilst trying to install/un-install a new app.

I used the following steps without having used the heavyscript backup process prior.
I'm not saying this is an approved method for this, but it worked for me so just sharing that.
I'll also preface that I only cared about recovering the whole ix-applications folder structure
I almost always used host-path rather than PVC so had more confidence that I would not care about minor changes to application states within the ix-applications folder.

The following are the steps that I used to recover the ix-applications folder on my machine and recover the deleted application and it's backups in my default ix-applications folder.

So based on my understanding the right way to backup and restore the ix-applications settings and apps is to use the heavyscript backup options
I discovered this only after needing to use it.

#1 download heavyscript (using the instructions on the git site https://github.com/Heavybullets8/heavy_script)
make sure you can run the command from the shell
I manly used this for stopping and starting all the applications
It's possible you could not require this if you were just using the UI to stop the visible apps.

#2 stop all your apps
$> heavyscript app -x ALL

#3 locate your backup for the ix-applications folder
I replicate my ix-application folder, (yes there are many threads saying this is likely not wise... but I only just found that out after the fact)
I happen to have a replication task for the whole folder to a backup disk in my case /mnt/BACKUP/ix-applications
you most likely could clone the snapshot to a new folder and achieve the same outcome ie /mnt/DATASET/ix-backup-clone

#4 I did a bit of messing around about this time and it's possible I skipped a step but this should be the correct sequence.
now unset the pool folder from the UI, BEFORE YOU DO THIS TAKE NOTE OF THE CURRENT POOL Location (> choose Pool)
> APPS > SETTINGS > Unset Pool Folder

#5 now IP copied my Backup ix-applications folder over the top of my existing one
in this case
$> cp -R -f /mnt/BACKUP/ix-applications /mnt/MACHINES/ix-applications
waited till it was done... I recommend keeping the session open to confirm it is completed without error.

#6 at this stage I started all my apps from the CLI, its possible that this could be done after the next step, but in my case I started them first.
$> heavyscript app -s ALL

#7 Go back to the UI and set the POOL location back to the original location , in my case MACHINES/ix-applications
When I did this , the UI started to discover the apps that were installed at the time of the snapshot
I updated all the apps just after this step and there was some strange behavior with the apps going missing from the screen.
I later rebooted the server and the whole system was the ix-applications pages where then operating as they were when the backup/replication was made.

More than happy for others to correct the above, or flame as you see fit.
This worked for me in a pinch, after some hasty reading and hacking around with various steps.
If you can correct advise a better method by all means do so.

It's possible this process could be used to recover specific application snapshots/backups however that would depend on the use of PVC vs host path settings for configuration and databases used by the applications and their locations. My understanding is that is sort of the reason why heavyscript backups are a better option.
 
Top