Solved How does restoring apps actually work?
Lonkle last edited by Lonkle
So, I mentioned this elsewhere. But I was running a test Wordpress Multisite on Cloudron (I don't run anything production on Cloudron atm) - and I changed it's domain and the whole app went berserk because there's a line in wp-config.php + 4 or 5 database entries that need to be updated when a multisite's domain gets changed.
But it left my app in an error-ed state. And the "restore" from any of the previous backups was disabled. Luckily, you guys have the clone function, so I cloned it, and fixed it up with the new domain via the CLI and manual SQL entries (before I found out you guys undocumented-ly supported Remote SQL ). Anyyywayyy, I have said all of this to ask - why did I have to make a clone and have to lose all of the original app's backups in doing so? I didn't mind, of course, but I'm curious about why I couldn't have just restored the app, even if "in the background" Cloudron" had cloned it and replaced it with the cloned subcontainer? It was just a weird thing that I had to do manually and got me curious as to why.
robi last edited by
Ooh, thanks for the reminder, that's another annoyance where it's unclear how to actually restore.
In the Backup section of an app you can restore from the listed backup(s), but if it's a remote cloudron, and you plumbed the backup location correctly, you can simply copy the backup ID, but it's HIDDEN on the left side of the backup list instead of the right side where all the actions are!
In such a case, where manual migration steps are required or the app is just broken due to installed plugins, the app can be set into "Recovery Mode" in the "Repair" section. That way the addons and the container will be running and you can use the Filemanager and/or the web terminal to fixup the app. Once done just disable Recovery Mode again.
Overall this is also a reason why apps run ideally everything in read-only filesystem, since that ensures people can't just hack around the apps and inevitably break them eventually, which just means a lot of support work for us and sometimes even data-loss.
Lonkle last edited by
Well, I believe this was strictly a Multisite Support issue (which I plan on fixing myself for you guys given how much you’ve helped me). Because all I did was change the URL on Cloudron’s side and it happened.
I believe recovery mode was greeted out as the app was in an
Errorstatus due to
redisbeing very confused about the new URL. If an app is in an error state does recovery mode still work?
And that brings me back to my original question - if that’s the way to make my situations restore work, then why disable restore? Instead, when restore is hit, enter the app into recovery mode and restore. Basically, is there a technical reason why manual steps like the ones mentioned in first comment (like cloning and replacing if the app can’t even make it to recovery mode) or this comment’s suggestion shouldn’t be automated?
Well, restore is to restore an app from an older backup. This will ensure the app package version matches the one when the backup was made. It however does not restore the domain or so.
So in your case this does not fix anything, since the backup would have the old domains in the database.
The recovery mode essentially runs the app normally from a platform point of view (mounting storage, allocating addons,...) BUT it does not run the apps entrypoint (usually start.sh) but instead just an empty "shell" which allows to use the webterminal to fix things.
The use-cases for both actions are different.
@Lonk a bit off topic, but to fix your uderlying issue of multisite when changing domain, you should tweak start.sh to always assume the domain changed / check if it changed, based on the environment variable
CLOUDRON_APP_DOMAIN(cf https://docs.cloudron.io/custom-apps/guide/#environment-variables ), and do the proper migrations if necessary.
Lonkle last edited by
@mehdi That’s exactly what I’m going to do. Thanks for pointing me in the right direction. I will do a merge request post 6.0 for first-class official Multisite support; I’ve got a list of 4 things to change to support Multisite now - I’m hoping I can get them all done in 2021! ️