Migration from SNAP to something else


I wanted to do some cleanup in my photo auto upload folder, but I have a problem with all my .heic (from iOS) photo no having any thumbnails.

After some research, I found that the SNAP version of Nextcloud have some limitations, like no thumbnails for .heic files, and also not being able to have the smbclient to mount external shares.

So, I want to migrate my instance. For that I have 3 questions :

1 - what is the best installation method ? manual on a stock linux ? docker ? (I want a method where I may be able to install things that are needed)
2 - how can I transfert everything from the SNAP instance to my new instance ? keeping all the files, the passwords, and the user settings
3 - the snap is doing auto-update for me and it works great, do any other methods can do that too ?

Thanks for all.

1 Like

Hi. And good question.
I can wholeheartedly recommend creating this as a LXC instance with the following:

  • Postgresql
  • Redis
  • Optional but I have had GREAT benefit of it: LDAP server.

Alternatively use the NCP installation script for an all in one experience, still with full control.

The LDAP server can be omitted. However the above will give you full freedom and power.

Transfer: Use migration from nextcloud doc.

The SNAP is doing auto-update, however there is a little more to it than that. The snap is updated through snapcraft store by the developers, so it is not always the latest and greatest. And it is not only Nextcloud it updates, it is all packages: PHP, database application, NGINX, redis, etc. And the good thing about SNAP is that it is tested and verified before released. Only NCP has this as part of the “NCP package”.
I am deliberately avoiding the AIO solutions: VM and docker as your bullet point number 1 is making it hard using this. The VM image is still capable of living up to all your requirements, however if you dedicate a full machine to nextcloud anyway, the VM solution is waste of machine resources (needing one dedicated core at least for the host OS as well as memory).

I am running NC in a LXC. I have both auto updates of OS and installed packages as well as nextcloud and apps. However I can do this because I can do snapshotting, as I use ZFS as filesystem.
If you can find your own backup solution for easy rollback if updates fails and bricks your system, then I can share my cronjob that does all this.

I am right now, indeed, using a full VM with SNAP inside a proxmox server. I can switch to LXC, I like this idea, what base system do you suggests ? Alpine ? Or a Debian maybe ?

The proxmox API is nice enough to trigger a snapshot from the cli, even inside the container.

I also have a Truenas Scale NAS, and they have added a nice plugins systems based on Docker, the update process is so handled more securely ?

The Docker AIO, TrueNAS and most other appliances I have seen, has some weird buildin limitations, like a usercap, unless paying for enterprise. And only the Virtual machine images are truly open. Open in the sense you are asking: Able to install needed additional software, like the geoblocking, aia download client, clamAV etc. But even those VM’s will be at risk for being overwritten with new versions released.
Only true way to be in control is to either:

  • Split up the services to different containers.
  • Install it all on a base system yourself.

You asked which OS image I use for Nextcloud inb my LXC. I use Ubuntu, as that one has by far, the largest amount of supported packages from apt. On top of that I can mix it up with SNAPS (yes it works flawlessly inside LXC as well) and docker containers. All in same LXC.

I can recommend to split the services up anyway, if you are up to it…? Docker is perfect for this, as well as LXC. Differences is that LXC can give you a machine like experience, where installing new packages are as easy as following any guide for the choosen OS image.

  • 1 LXC for your database engine (can then be used by other projects).
  • 1 LXC for NGINX in reverse proxy mode proxying to the Nextcloud app LXC over FastCGI (PHP-FPM). Can now act as your primary reverse proxy and load balancer for your container ecosystem. Good when installing other services later. Keep redis on this one also. You could choose here to use the TrueNAS with a mount for the data folder, but it introduces a risk in terms of connectivity and dropping mount. But if you do, setup Redis as LXC on the TrueNAS.
  • 1 LXC for the nextcloud app (with PHP-FPM)
  • 1 LXC for ClamAV.

Now you “just” adds containers for each major services and still having the power to locally enhance and update individually without breaking the others.

If you are nor up to it, I suggests making one Ubuntu container and install it all in that one. TrueNAS can host LXC containers as well, so if that one got enough juice and has most disk space, use that one.

I migrated to Docker based Nextcloud installation recently and create a flexible script to deploy and migrate data as I have all my data in the old NC standalone installation.
It might not be fit for you, but you can have some ideas perhaps. GitHub - a3linux/homecloud-docker: HomeCloud services with docker compose

Oh and updating/upgrading is only a matter of scripting it. It sounds hard, but truly it is not.

#! /bin/bash
SQLFILE=“/path/to/desired/backupfolder/sqldumps/nc-$(date +”%Y-%m-%d_%M-%H")"

mysqldump --opt --user=‘ncdbuser’ --password=‘ncdbpassword’ ‘ncdatabase’ > “$SQLFILE.sql”
gzip -c “$SQLFILE.sql” > “$SQLFILE.gz”; rm “$SQLFILE.sql”

apt update -y; apt upgrade -y

PHPCOMMAND=“sudo -u www-data php8.1” #Keep PHP version up to date!!
commands[0]=“/var/www/nextcloud/updater/updater.phar --no-backup --no-interaction”
commands[1]=“/var/www/nextcloud/occ db:add-missing-indices”
commands[2]=“/var/www/nextcloud/occ maintenance:mode --off”
commands[3]=“/var/www/nextcloud/occ maintenance:data-fingerprint”
commands[4]=“/var/www/nextcloud/occ app:update --all”

for i in “${commands[@]}”; do eval $PHPCOMMAND $i; done

systemctl restart php8.1-fpm; systemctl restart apache2 #Keep PHP version up to date!!

I try to keep all my files stand separate with the docker or Nextcloud installation, mount them with fixed path. With this setting, I try to do Nextcloud database or application upgrade on demand. If something is wrong there, I use my restore plan, which will re-create the Nextcloud database and restore all files with occ files:scan. For me it is very few chance to do this in recently years, but it is still in my backup plan and maintenance document, in case the server died.

I assume files:scan is much faster than recovery xxxGB data from Docker volume import/export.
BTW, I keep my users authentication and management in Authentik, so Nextcloud do not care about that, NC only takes care of files.

Good approach. No files:scan --all is not always faster than a full restore. Restores can run paralel on the dofferent services and then you are up. files:scan --all takes hours if you have many users and many files. But I guess it is the safest working way of doing it.

Really? Maybe I can do some test later.
For my experience, files:scan --all is quiet faster, the slowest is the preview scan to generate the thumbs as I and my family most save photos in Nextcloud.
So actually, I try to backup appdata folder also in case. :slight_smile:

1 Like

Please notice my not always. I must hurry and say that I do not use docker. I have it based on LXC on a drive formattet as ZFS, so I do snapshotting and rsync of data once a week. Restoring from a snapshot takes seconds. So in truth, using the Docker import and export sounds like a painfull process, but that is only because I am making a qualified guess.

Thanks for all your tips. I found and tried the NextCloudPi installation script on a Debian based LXC container, it seems to works, but too many things make me want to do it again manually, first the script doesn’t allow you to choose the database engine, then there is a lot of error that can be seen during the execution, it can be normal, but I don’t like it. It also provide a web panel to be able to configure things the the first impression is not so great as wizard panel doesn’t works up to the end without showing an error.
I already have a PostgreSQL LXC container, I will use it like you suggest. And I use haproxy on a pfSense, so I will see for the nginx or Apache configuration.

Thanks for all.

I had same experience with NCP in LXC. On a clean Debian host it installs without issues.

I use HAProxy to. The suggestion use NGINX was only to get the best of two worlds: Reverse proxy and webserver. The NGINX can serve the webpage of Nextcloud using TCP based FPM connection, hence you could save the resources of running a reverse proxy and yet another webserver. :slight_smile: However you seems to have a solid idea. :slight_smile: