Nextcloud core to scale migration

Kraken

Cadet
Joined
Mar 22, 2017
Messages
4
I am migrating Nextcloud from a CORE to a server running TrueNAS SCALE. Has anyone done this successfully? It seems like it must be a common issue but haven’t seen a lot of discussion.

The biggest issue seems to be that the core app uses mysql backend and the official scale app uses postgresql so even if i manage to import the database it wouldnt be compatible.

I could use a big blue button installs of nextcloud and mysql docker containers, but that seems like it would be more trouble in the long run.
I think I will have to reconstruct the database after moving the files into the new data directory. I don’t have much experience with containerized apps. I will have to figure out how to run occ commands as www-data but I don’t have access this user if I open a shell inside the app. will probably need to run from outside the container, something like k3s kubectrl nextcloud … su www-data occ…

If people have been able to do this. I and I’m sure others in the community would love to hear any tips and suggestion for navigating this process.

Thanks
 

Kraken

Cadet
Joined
Mar 22, 2017
Messages
4
OK this is the solution I ended up with.
I set up the Nextcloud app with the TrueNAS GUI
logged into the Nextcoud web GUI and added the users to set up the directory structure.
Made a samba share with my Nextcloud data data-set and copied the "files" folders from the old server data to the new one.
you could use the TN GUI to launch a shell prompt in the Next cloud app
OR
ssh into the machine and use:
k3s kubectl describe nodes
to list the pods
k3s kubectl -n ix-nextcloud exec -ti nextcloud-XXXXXXXXX-XXXXX bash
replace -n "ix-nextcloud" with the name space if necessary. replace nextcloud-XXX with pod name

Then
apt-get update
apt-get install sudo nano

sudo -u www-data ./occ
returns a memory error for me

to get around this
edit autoload_real.php
nano /var/www/html/3rdparty/composer/autoload_real.php
ADD the line "ini_set('memory_limit', '4G');"
to make this:
<?php

// autoload_real.php @generated by Composer

ini_set('memory_limit', '4G');

class ComposerAutoloaderInit2f23f73bc0cc116b4b1eee1521aa8652
{
private static $loader;

public static function loadClassLoader($class)
{
if ('Composer\Autoload\ClassLoader' === $class) {
require __DIR__ . '/ClassLoader.php';
}
}
...

now update the database
sudo -u www-data ./occ files:scan --all

This worked for me. It looks like there may be a way to export a converted postgresql database and upload it rather than needing to rebuild it. If anyone is interested here is the Nextcloud documentation:

 

andre1981

Cadet
Joined
Jul 17, 2020
Messages
3
Dude (@Kraken), this still worked in Mar in 2022!!!!! I'm not sure why information on how to migrate this was not easier to find considering that most people migrating from Nextcloud from Core to Scale would probably need to know this information.
 

NetSoerfer

Explorer
Joined
May 8, 2016
Messages
57
Now that I know what to look for, I found the information in the SCALE UI Reference Guide's Using SCALE Apps page, all the way at the bottom there's a section "Accessing the Shell in an Active Container".

It took me some serious searching until I got here though, and I agree with @andre1981 that it might help to have this linked in the Guide's Nextcloud page, since this really is what many people will be looking for.

Maybe it should include how to migrate from MySQL to PostgreSQL - I had Nextcloud with MySQL (MariaDB) set up manually as a jail rather than a plugin, but in the end the plugin is just a jail too, so I would've done the same with a Nextcloud plugin.

I installed PostgreSQL and used Nextcloud's OCC to migrate from MySQL to PostgreSQL, then exported the PostgreSQL db as explained in the Nextcloud documentation's Migrating to a different server page. I plan to import this into the SCALE app. (Which is where I got stuck until I found this thread.)

I'll have to wrap my head around backups and such, but I may write up a guide for doing this, once I've got the whole process figured out.

If I don't, maybe this'll help someone who's in the same place as we were :)
 
Top