Nextcloud on Truenas - updating version 20 to version 23
How to update Nextcloud version 20 to version 23 on Truenas. Nexcloud is hosted in an iocage on Truenas
Don't do it. (Okay, I'm being a little dramatic)
Problem:
After hours spent trying to update my Nextcloud instance (it's a plugin to Truenas so it should be easy, right?), I realized that Nextcloud doesn't actually let you upgrade multiple versions at once. Theoretically you can do several incremental upgrades, but there's no easy want in Truenas and there was no guarantee it would even work.
In addition, Nextclound version 23 requires a reconfiguration of all networking (it expects NAT whereas I had assigned a static IP - and the changes in the GUI don't actually take effect correctly!)
Solutions:
- several incremental upgrade - no way
- exporting MySQL database and data and uploading into an instance of v23 - possible but I'm the only user and I don't mind reconfiguring my few settings
- copying just the data to a fresh v23 instance and recreating the user(s) manually (this is already accessible in Truenas directly so it's super simple)
I chose the last option - and it only took half an hour.
- Spin up an instance of Nextcloud v23
- Sign in using the default credentials and create your personal user account.
- Mount
/mnt/tank/nextcloudv23
in nextcloud/mnt/tank/iocage/jails/nextcloudv23/root/usr/local/www/nextcloud/dataMnt
- copy the files over
sudo cp -rp /mnt/tank/nextcloud/myuser/files/* /mnt/tank/nextcloudv23/myuser/files/
- Open a shell in your new Nextcloud instance (something like
sudo jexec 10 tcsh
where 10 is the jail number returned byjls
) - Update nextcloud to read from your mount:
- edit
/usr/local/www/nextcloud/config/config.php
and update the datadirectory line to be'datadirectory' => '/usr/local/www/nextcloud/dataMnt'
- Restart Nextcloud within the jail by running
nginx -s reload
- Reread all the files
occ files:scan --all
- If there's any errors, make sure the permissions are correct
chown -R www:www /usr/local/www/nextcloud/dataMnt/
- That's (hopefully) it!