I have a 20.x instance which I can’t upgrade in place because it’s not dockerized and the server needs to keep running MySQL 5 for legacy software. So the plan is to migrate that instance to a new host with MySQL (or MariaDB) 10 and do the upgrade there.
It depends on what approach you take. If your intention is to keep the existing Nextcloud instance and upgrade it, you should get the existing instance running on the new server (not a new instance) and then step through upgrades of NC, PHP, etc. as appropriate.
DO NOT upgrade more than one major version at a time (e.g. NC 20 to NC 22+)
On the other hand, if your intention is to make a NEW Nextcloud server and migrate the FILES to it, then you would not use the old server’s DATABASE.
What you’re describing sounds like a combination of the two which I’m afraid will probably just result in a broken setup.
pulled mariadb:10.5 and nextcloud:20.0.14-apache images on the new host (since 20 is the version of the old host)
started the mariadb container only and loaded the DB dump from the old host
rsynced the nextcloud dir from the old host and adjusted the changed DB params in config.php to fit those of the new server’s mariadb settings (as given in the environment vars in my docker-compose.yml), also adjusted datadirectory to the container default /var/www/html/data and added the test hosts domain to the allowed domains array
mounted that as a bind mount into the nextcloud container and started it
then ran through the version to version updates from the UI all the way up to 24, no issues
The only problem I’m observing is that the security and setup warnings claim that my data directory is invalid, I should check if an .ocdata exists and that it cannot create the data directory. This is strange, because everything else, in particular uploading new files works without any problems.
I also checked the file permissions, apache runs as www-data inside the container and has write access to /var/www/html/data and /var/www/html/data/.ocdata so I don’t understand where this is coming from?
So this is weirdly related to the cron settings. Changing those from cron to webcron lets that (imho misleading message) vanish. This seems to be a known issue, e.g. as described here. Nevertheless, the fix seems to be more of a workaround than a solution…