Preserve Nextcloud user sessions after reinstall

Hey,

I am using Nextcloud on Docker (not AIO). I was recently reinstalling the system (clean reinstall) [without restoring SQL backup] and configuring it back to original state with occ. I was successful and all works fine apart the fact that users have to login to NC again (session is lost).

I was wondering, is there a way, how to backup user sessions reliably in order to bring them back after reinstall and avoid login? Are those sessions stored somewhere? I do understand that apache stores session files in (default) /tmp dir, but that must not be sufficient to fully restore user session.

Thanks

Session termination is expected and useful in such scenario. Setting up a fresh system and expecting some previous session to seamlessly connect there makes no sense in my eyes.

I would in general recommend complete backup/restore as you loose all the metadata if you drop the database - which is usually not desired. You will likely brake things you don’t expect if you simple “replace” an existing session as all files and other settings “silently” change otherwise from the client PoV.

Hey, thanks for quick reply and I understood your idea.

We are using extremely stripped Nextcloud installation. There is just core: file browsing and full text search only. So honestly, there is not a lot we can lose here as users mostly use desktop clients for file sync and file usage.

Goal was to make a system that would not be incrementally modified/configured, but rather each modification for the system would result in complete wipe and reinstall with updated configuration.

The main reason is that most of the apps and their abilities still are a bit behind our needs and also such way allows relatively easy update process (because we do not save anything).

But all in all, we are very happy with Nextcloud and its vision! Really looking forward to future improvements and updates.

Thanks!

this is exactly where you brake things. the client sync relies on the backend DB metadata and you could expect high data usage for complete re-sync in a best case and data loss in worst case. see HELP! Nextcloud nuked my files for an example.

And to be honest upgrading a lean server with only few core apps is much easier and faster than complete rebuild the server and re-scan all the file using occ files:scan (which is required to insert your files into an empty installation)

Thanks for that post, really helpful. Appreciate that.