4ps4all's picture

Upgrade/Migrate TurnKey Nextcloud Appliance 14.1 to Turnkey Nextcloud Appliance 15.1 , Proxmox system.

I have tested this procedure just once, I have to do it again to be sure it's working.

basic guide
https://docs.nextcloud.com/server/13/admin_manual/maintenance/migrating....

https://docs.nextcloud.com/server/13/admin_manual/maintenance/manual_upg...

turnkey FORUM
https://www.turnkeylinux.org/forum/general/tue-20181016-1441/appliance-s...

https://www.turnkeylinux.org/forum/general/tue-20181016-1441/appliance-s...

https://www.turnkeylinux.org/forum/general/mon-20190429-1324/nextcloud-1...

https://www.turnkeylinux.org/nextcloud

 

I made the tests for  Upgrade/Migrate with a container backup just restored(CT=container in proxmox). It means that if something does not work I shutdown the CTs , and I keep using my old original CT.
A TurnKey Nextcloud Appliance 14.1 BACKUP/RESTORED is runnin in my network and my original Turnkey Nextcloud CT is OFF !!!

Update && Upgrade Turnkey Nextcloud Appliance
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install sudo
reboot

COMMANDS ON SOURCE CONTAINER

Disable all 3rd apps you were using with nextcloud
Put nextcloud in maintenance mode
Add this line to /usr/share/nextcloud/config/config.php
'maintenance' => true,
Stop web server apache
/etc/init.d/apache2 status
/etc/init.d/apache2 stop
 


COMMANDS ON DESTINATION CONTAINER
I'll consider you have installed your  Turnkey Nextcloud Appliance 15.1 with a different IP and a different DOMAIN.

Put nextcloud in maintenance mode
Add this line to /var/www/nextcloud/config/config.php
'maintenance' => true,

Now we have to export all important directories and files with RSYNC

COMMANDS ON DESTINATION CONTAINER
mv /var/www/nextcloud/data  /root/data-old
We wil EXPORT diretories : data apps deck calendar contacts notes bookmarks
rsync -avz /usr/share/nextcloud/data root@YOURIPADDRESS:/var/www/nextcloud/
rsync -avz /usr/share/nextcloud/apps/deck root@YOURIPADDRESS:/var/www/nextcloud/apps/
rsync -avz /usr/share/nextcloud/apps/notes root@YOURIPADDRESS:/var/www/nextcloud/apps/
rsync -avz /usr/share/nextcloud/apps/bookmarks root@YOURIPADDRESS:/var/www/nextcloud/apps/
rsync -avz /usr/share/nextcloud/apps/contacts root@YOURIPADDRESS:/var/www/nextcloud/apps/
rsync -avz /usr/share/nextcloud/apps/tasks root@YOURIPADDRESS:/var/www/nextcloud/apps/

We make a backup of our TurnKey 15.1 Nextcloud appliance  /var/www/nextcloud/config/config.php

mv /var/www/nextcloud/config/config.php /var/www/nextcloud/config.php/config.phpOLD

rsync -avz /usr/share/nextcloud/config/config.php root@YOURIPADDRESS:/var/www/nextcloud/config.php

EXPORT old DATABASE in source-container, DELETE CREATE new DATABASE in destination-container, IMPORT old database in new empty database in detination-container

OLD_MYSQLPASSWORD_OLD_32CHARACTERS, TKL 14.1 old myql database passsword, you can find it in /usr/share/nextcloud/config.php
NEW_MYSQLPASSWORD_NEW_32CHARACTERS , TKL 15.1 new mysql database password, you can find it in /var/www/nextcloud/config.php

COMMANDS ON SOURCE CONTAINER
TO EXPORT THE DATABASE WAIT 7 minutes after you stopped apache2
mysqldump --single-transaction -h localhost -u nextcloud -pOLD_MYSQLPASSWORD_OLD_32CHARACTERS nextcloud > nextcloud-sqlbkp_`date +"%Y%m%d"`.bak
COMMANDS ON DESTINATION CONTAINER
mysql -h localhost -u nextcloud -p
NEW_MYSQLPASSWORD_NEW_32CHARACTERS -e "DROP DATABASE nextcloud"

mysql -h localhost -u nextcloud -p
NEW_MYSQLPASSWORD_NEW_32CHARACTERS   -e "CREATE DATABASE nextcloud"

TO IMPORT OLD DATABASE IN NEW DATABASE you have to use adminer user and the passaword set for adminer user.
mysql -h localhost -u adminer -pADMINERPASSWORD nextcloud < /root/nextcloud-sqlbkp_DATE_.bak

 


COMMANDS ON DESTINATION CONTAINER
change file directories permission
chown -R www-data:www-data nextcloud
find /var/www/nextcloud/ -type d -exec chmod 750 {} \;
find /var/www/nextcloud/ -type f -exec chmod 640 {} \;

Now it's time to upgrade nextcloud version

restart webserver

systemctl stop apache2
systemctl status apache2

sudo apt-get install sudo
cd  /var/www/nextcloud/
sudo -u www-data php occ upgrade

Put nextcloud in maintenance mode
Add this line to /var/www/nextcloud/config/config.php
'maintenance' => false,

Re-ENABLe all the apps that were disabled.

It was important to me to export DECK APP moslty, and it moslty works !!!!

You should then reinstall apps,  using your new IP and new domain of your upgraded nextcloud. (check config.php that someitmes do not get updated with trusted IPs or domains).

 

 

Forum: 
4ps4all's picture

 

Upgrade/Migrate TurnKey Nextcloud Appliance 14.1 to Turnkey Nextcloud Appliance 15.1 , Proxmox system.

I'm sorry I was unable to modify directly my post, is it possible?

 

basic guide
https://docs.nextcloud.com/server/13/admin_manual/maintenance/migrating....

https://docs.nextcloud.com/server/13/admin_manual/maintenance/manual_upg...

turnkey FORUM
https://www.turnkeylinux.org/forum/general/tue-20181016-1441/appliance-s...

https://www.turnkeylinux.org/forum/general/tue-20181016-1441/appliance-s...

https://www.turnkeylinux.org/forum/general/mon-20190429-1324/nextcloud-1...

https://www.turnkeylinux.org/nextcloud

 

I made the tests for  Upgrade/Migrate with a container backup just restored(CT=container in proxmox). It means that if something does not work I shutdown the CTs , and I keep using my old original CT.
A TurnKey Nextcloud Appliance 14.1 BACKUP/RESTORED is runnin in my network and my original Turnkey Nextcloud CT is OFF !!!


Update && Upgrade Turnkey Nextcloud Appliance
sudo apt-get update && sudo apt-get upgrade
Install sudo to use commands in nextcloud upgrade/migrate manuals
sudo apt-get install sudo
reboot

COMMANDS ON SOURCE CONTAINER

Disable all 3rd apps you were using with nextcloud
Put nextcloud in maintenance mode
Add this line to /usr/share/nextcloud/config/config.php
'maintenance' => true,
Stop web server apache
/etc/init.d/apache2 status
/etc/init.d/apache2 stop
systemctl stop apache2.service
systemctl status apache2.service


COMMANDS ON DESTINATION CONTAINER
I'll consider you have installed your  Turnkey Nextcloud Appliance 15.1 with a different IP and a different DOMAIN.

Put nextcloud in maintenance mode
Add this line to /var/www/nextcloud/config/config.php
'maintenance' => true,

Now we have to export all important directories and files with RSYNC

COMMANDS ON DESTINATION CONTAINER
systemctl stop apache2.service
mv /var/www/nextcloud/data  /root/data-old
We wil EXPORT diretories : data apps deck calendar contacts notes bookmarks
rsync -avz /usr/share/nextcloud/data root@YOURIPADDRESS:/var/www/nextcloud/
rsync -avz /usr/share/nextcloud/apps/deck root@YOURIPADDRESS:/var/www/nextcloud/apps/
rsync -avz /usr/share/nextcloud/apps/notes root@YOURIPADDRESS:/var/www/nextcloud/apps/
rsync -avz /usr/share/nextcloud/apps/bookmarks root@YOURIPADDRESS:/var/www/nextcloud/apps/
rsync -avz /usr/share/nextcloud/apps/contacts root@YOURIPADDRESS:/var/www/nextcloud/apps/
rsync -avz /usr/share/nextcloud/apps/tasks root@YOURIPADDRESS:/var/www/nextcloud/apps/

CONFIG.PHP must be maintened the new one, corrected this passage. strangely config.php must NOT BE imported from the old container, otherwise the nextcloud upgrade does not work.
Anyway must be adjusted the trusted_domains /var/www/nextcloud/config/config.php
adding new IP and new DOMAIN.
'trusted_domains' =>
  array (
    0 => 'localhost',
    1 => 'NEWDOMAIN_www.example.org',
    2 => 'NEW_IP_xxx.xxx.xxx.xxx',
  ),

EXPORT old DATABASE in source-container, DELETE CREATE new DATABASE in destination-container, IMPORT old database in new empty database in destination-container

copy somewhere the old mysql password and new mysqlpassword, plus you will have the new adminer mysql password.
OLD_MYSQLPASSWORD_OLD_32CHARACTERS, TKL 14.1 old myql database passsword, you can find it in /usr/share/nextcloud/config.php
NEW_MYSQLPASSWORD_NEW_32CHARACTERS , TKL 15.1 new mysql database password, you can find it in /var/www/nextcloud/config.php

COMMANDS ON SOURCE CONTAINER
TO EXPORT THE DATABASE WAIT 7 minutes after you stopped apache2
mysqldump --single-transaction -h localhost -u nextcloud -pOLD_MYSQLPASSWORD_OLD_32CHARACTERS nextcloud > nextcloud-sqlbkp_`date +"%Y%m%d"`.bak

COMMANDS ON DESTINATION CONTAINER
mysql -h localhost -u nextcloud -pNEW_MYSQLPASSWORD_NEW_32CHARACTERS -e "DROP DATABASE nextcloud"

mysql -h localhost -u nextcloud -pNEW_MYSQLPASSWORD_NEW_32CHARACTERS   -e "CREATE DATABASE nextcloud"

TO IMPORT OLD DATABASE IN NEW DATABASE you have to use adminer user and the passaword set for adminer user.
mysql -h localhost -u adminer -pADMINERPASSWORD nextcloud < /root/nextcloud-sqlbkp_DATE_.bak


COMMANDS ON DESTINATION CONTAINER
change file directories permission
chown -R www-data:www-data nextcloud
find /var/www/nextcloud/ -type d -exec chmod 750 {} \;
find /var/www/nextcloud/ -type f -exec chmod 640 {} \;

Now it's time to upgrade nextcloud version

restart webserver
systemctl status apache2.service
systemctl start apache2.service
sudo apt-get install sudo
cd  /var/www/nextcloud/
sudo -u www-data php occ upgrade

Put nextcloud out of 'maintenance mode'
Add this line to /var/www/nextcloud/config/config.php
'maintenance' => false,

Re-ENABLe all the apps that were disabled.

It was important ot me to export DECK APP moslty, it moslty works !!!!

Enable all the  apps that have been disabled before nextcloud upgrade.

 

4ps4all's picture

 

Upgrade/Migrate TurnKey Nextcloud Appliance 14.1 to Turnkey Nextcloud Appliance 15.1 , Proxmox system.

I'm sorry I was unable to modify directly my post, is it possible?

 

basic guide
https://docs.nextcloud.com/server/13/admin_manual/maintenance/migrating....

https://docs.nextcloud.com/server/13/admin_manual/maintenance/manual_upg...

turnkey FORUM
https://www.turnkeylinux.org/forum/general/tue-20181016-1441/appliance-s...

https://www.turnkeylinux.org/forum/general/tue-20181016-1441/appliance-s...

https://www.turnkeylinux.org/forum/general/mon-20190429-1324/nextcloud-1...

https://www.turnkeylinux.org/nextcloud

 

I made the tests for  Upgrade/Migrate with a container backup just restored(CT=container in proxmox). It means that if something does not work I shutdown the CTs , and I keep using my old original CT.
A TurnKey Nextcloud Appliance 14.1 BACKUP/RESTORED is runnin in my network and my original Turnkey Nextcloud CT is OFF !!!


Update && Upgrade Turnkey Nextcloud Appliance
sudo apt-get update && sudo apt-get upgrade
Install sudo to use commands in nextcloud upgrade/migrate manuals
sudo apt-get install sudo
reboot

COMMANDS ON SOURCE CONTAINER

Disable all 3rd apps you were using with nextcloud
Put nextcloud in maintenance mode
Add this line to /usr/share/nextcloud/config/config.php
'maintenance' => true,
Stop web server apache
/etc/init.d/apache2 status
/etc/init.d/apache2 stop
systemctl stop apache2.service
systemctl status apache2.service


COMMANDS ON DESTINATION CONTAINER
I'll consider you have installed your  Turnkey Nextcloud Appliance 15.1 with a different IP and a different DOMAIN.

Put nextcloud in maintenance mode
Add this line to /var/www/nextcloud/config/config.php
'maintenance' => true,

Now we have to export all important directories and files with RSYNC

COMMANDS ON DESTINATION CONTAINER
systemctl stop apache2.service
mv /var/www/nextcloud/data  /root/data-old
We wil EXPORT diretories : data apps deck calendar contacts notes bookmarks
rsync -avz /usr/share/nextcloud/data root@YOURIPADDRESS:/var/www/nextcloud/
rsync -avz /usr/share/nextcloud/apps/deck root@YOURIPADDRESS:/var/www/nextcloud/apps/
rsync -avz /usr/share/nextcloud/apps/notes root@YOURIPADDRESS:/var/www/nextcloud/apps/
rsync -avz /usr/share/nextcloud/apps/bookmarks root@YOURIPADDRESS:/var/www/nextcloud/apps/
rsync -avz /usr/share/nextcloud/apps/contacts root@YOURIPADDRESS:/var/www/nextcloud/apps/
rsync -avz /usr/share/nextcloud/apps/tasks root@YOURIPADDRESS:/var/www/nextcloud/apps/

CONFIG.PHP must be maintened the new one, corrected this passage. strangely config.php must NOT BE imported from the old container, otherwise the nextcloud upgrade does not work.
Anyway must be adjusted the trusted_domains /var/www/nextcloud/config/config.php
adding new IP and new DOMAIN.
'trusted_domains' =>
  array (
    0 => 'localhost',
    1 => 'NEWDOMAIN_www.example.org',
    2 => 'NEW_IP_xxx.xxx.xxx.xxx',
  ),

EXPORT old DATABASE in source-container, DELETE CREATE new DATABASE in destination-container, IMPORT old database in new empty database in destination-container

copy somewhere the old mysql password and new mysqlpassword, plus you will have the new adminer mysql password.
OLD_MYSQLPASSWORD_OLD_32CHARACTERS, TKL 14.1 old myql database passsword, you can find it in /usr/share/nextcloud/config.php
NEW_MYSQLPASSWORD_NEW_32CHARACTERS , TKL 15.1 new mysql database password, you can find it in /var/www/nextcloud/config.php

COMMANDS ON SOURCE CONTAINER
TO EXPORT THE DATABASE WAIT 7 minutes after you stopped apache2
mysqldump --single-transaction -h localhost -u nextcloud -pOLD_MYSQLPASSWORD_OLD_32CHARACTERS nextcloud > nextcloud-sqlbkp_`date +"%Y%m%d"`.bak

COMMANDS ON DESTINATION CONTAINER
mysql -h localhost -u nextcloud -pNEW_MYSQLPASSWORD_NEW_32CHARACTERS -e "DROP DATABASE nextcloud"

mysql -h localhost -u nextcloud -pNEW_MYSQLPASSWORD_NEW_32CHARACTERS   -e "CREATE DATABASE nextcloud"

TO IMPORT OLD DATABASE IN NEW DATABASE you have to use adminer user and the passaword set for adminer user.
mysql -h localhost -u adminer -pADMINERPASSWORD nextcloud < /root/nextcloud-sqlbkp_DATE_.bak


COMMANDS ON DESTINATION CONTAINER
change file directories permission
chown -R www-data:www-data nextcloud
find /var/www/nextcloud/ -type d -exec chmod 750 {} \;
find /var/www/nextcloud/ -type f -exec chmod 640 {} \;

Now it's time to upgrade nextcloud version

restart webserver
systemctl status apache2.service
systemctl start apache2.service
sudo apt-get install sudo
cd  /var/www/nextcloud/
sudo -u www-data php occ upgrade

Put nextcloud out of 'maintenance mode'
Add this line to /var/www/nextcloud/config/config.php
'maintenance' => false,

Re-ENABLe all the apps that were disabled.

It was important ot me to export DECK APP moslty, it moslty works !!!!

Enable all the  apps that have been disabled before nextcloud upgrade.

 

Jeremy Davis's picture

TBH, I have only glanced through it so don't yet have any specific advice to add.

Although I can say that, yes you can edit your initial post. It's just a little different to editing a comment in a thread. To edit the initial post, you need to scroll right to the top, then just below the banner, you should see an "edit" tab (by default it will be on the "view" tab).

Hopefully early next week I'll have time to have a closer look at your content and I may be able to provide some additional ideas on how it may be streamlined.

Regardless, thanks very much for sharing your process. I'm sure it'll be useful for others.

4ps4all's picture

Some more details :
My nextcloud version is Nextcloud 14.0.3, Turnkey 15.1.
I noticed some setting problem in Nexcloud>Setting>Administration>Overview

I corrected some of them in this way:

RE/enabled background JOBS with systemd
https://docs.nextcloud.com/server/14/admin_manual/configuration_server/background_jobs_configuration.html

Probably necessary to give permisison to execute "x" to ugo using "chmod":
chmod ugo+x /etc/systemd/system/nextcloudcron.service
chmod ugo+x /etc/systemd/system/ nextcloudcron.timer

While everything is working (nextcloud,apache,mysql):

https://docs.nextcloud.com/server/14/admin_manual/maintenance/upgrade.html

cd /var/www/nextcloud

$ sudo -u www-data php occ db:add-missing-indice

$ sudo -u www-data php occ db:convert-filecache-bigint

Both two last commands gave not any problems to me.

Add new comment