[abandoned] Need help migrating Snap -> Docker (and MySQL -> PostgreSQL)


I am currently trying to migrate my Nextcloud 15 Snap installation to a Docker installation for use with Collabora and many many more reasons. Since my installation holds a bunch of data and I don’t want to migrate it manually like a noob every time (better to learn it properly once), I wanted to ask for advice/help before messing around.

What I think I need to do

So, as far as I understand so far, I need to migrate

  • User files
  • Apps
  • The database (MySQL since I am coming from the official Snap)

I have heard that to migrate apps and user data, I basically just need to copy the folders to their place in my Docker setup. (is this correct?) For the database, since I am going to use PostgreSQL in my Docker installation, I will have to convert the database. When/Where do I do this? Do I convert the database in my existing Snap installation, or should I first migrate everything to Docker and do the conversion there? Would I need to set up MySQL on Docker first before being able to convert it to PostgreSQL?
Honestly for this I would really just appreciate your input on how to proceed. Any experiences or advice is very appreciated.

What I have done so far

  • Exported and backed up all data from the Snap
  • Set up a docker-compose.yml file for Nextcloud with PostgreSQL (As well as Caddy as reverse proxy and Collabora, which all works)

I am happy to provide my docker-compose.yml file or anything else you need to help. Thanks in advance!

i would

  • setup somewhere a virtual machine (cloud, vmware, virtualbox) with both database management systems (as a docker container).
  • try one of converters a google search will find.
  • dump the converted database from this postgres container and
  • try to restore it into the new environment.

never touch the existing installation. unless you your sure you restore it.

(if you need an easy setup of a dockerized nextcloud for your testing: -> nextcloud_on_docker or selfhosted_on_docker )
in this playbooks a database webgui (adminer) is also included. so you could inspect the converted database. :wink: )

Thank you! Good tip about trying this in an isolated environment first. Either way I have full backups of my data, but not having to mess with that is better^^
Is there any particular reason not to use occ to convert the database? I saw that it is possible to convert databases using that :slight_smile:

maybe only the documentation is misleading: “You can convert a SQLite database to a better performing MySQL, MariaDB or PostgreSQL database”
but it’s worth to try.

Ah yeah, I remember reading that part but forgot in the meantime :sweat_smile:
I saw that they say you need to specify a type, but now that I am having a closer look again, it seems it’s just the destination type you can specify, not the source database. I will give it a try anyway :slight_smile:
If it doesn’t work, I’ll try a third party converter and see how it goes.

Just for the sake of keeping this up to date, I haven’t gotten to testing it yet, but I saw an article showing that it’s possible to convert to PostgreSQL using occ.
The command would be as follows:

./occ db:convert-type --all-apps --password "Password_of_PGDB" pgsql PGDBUser Hostname NextcloudDB

Of course, replacing Password_of_PGDB, PGDBUser, Hostname (eg. with docker-compose this would be replaced with the service name as hostname) and NextcloudDB with the name of the target database.
You may be told that some tables cannot be converted, in which case you’ll have to check the manual on how to proceed!

I have not tried this yet but I will today/tomorrow and update this thread :slight_smile:

Alright, I actually gave up on migrating things the pretty way and since there was not too much data, it ended up being easier to just transfer data/calendars etc manually. I’m sorry for disappointing anyone looking for a solution to this here, but hopefully the starting ideas will help anyway, they should work if you see them through! :slight_smile:

1 Like

Don’t be: this just saved me time researching the exact same thing :slight_smile: Thanks!