Migration to NextCloud Docker

Good morning,
in our small office we are using NextCloud deployment to share file with our customer.
NextCloud is running on Ubuntu 20.04 LTS Virtual Machine with “Apache2 + PHP 7.4 + MySQL”

I know PHP 7.4 is no longer supported so I would upgrade my deployment.
I would like to use this opportunity to migrate the installation to docker platform.

I tried to deploy NextCloud docker (NextCloud + MySQL docker) on a new VM using docker-compose
Here you can see my file configuration

version: '3'

services:
  db:
    image: mariadb:10.5
    restart: always
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    volumes:
      - /home/localuser/nextcloud/db:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=XXXX
      - MYSQL_PASSWORD=XXXX
      - MYSQL_DATABASE=nextcloud_db
      - MYSQL_USER=nextcloud_user

  app:
    image: nextcloud
    restart: always
    ports:
      - 8080:80
    links:
      - db
    volumes:
      - /home/localuser/nextcloud/app:/var/www/html
    environment:
      - MYSQL_PASSWORD=XXXX
      - MYSQL_DATABASE=nextcloud_db
      - MYSQL_USER=nextcloud_user
      - MYSQL_HOST=db

In this moment I tried to move data using a third host using NextCloud Windows Client.
It seems to work properly.

In this moment we have two kind of users:

  1. Local users → we imported AD Security Group using LDAP plugin Then we applied permission to specific NC folders
  2. External user → we created local nextcloud users. Then we applied permission to specific NC folders

Finally I am using a local NC administrator to manage all settings, for example I used this account to create folder, create local NC users, manage LDAP integration and so on.
I created the same local NC administrator on this new Docker deployment.

Is there a way to export and import users from old NextCloud server?
Is there a way to export and import folder permission from old NC to new NC server?
Is it possible?

Thanks a lot :grinning:

hello @coppolino97 welcome to the forum :handshake:

for server migration please follow the official

https://docs.nextcloud.com/server/latest/admin_manual/maintenance/migrating.html

docker is little different than native server but nothing every admin should know. The key is to migrate the database - this holds all users, shares, access rights etc… I would recommend you to setup another docker installation in parallel and try the migration before you touch your production instance…

Hello @wwe

for server migration please follow the official
Thanks for this detailed guide.

I would recommend you to setup another docker installation in parallel and try…
Yes, I cloned my original NextCloud VM and i am working with that.
I setup another docker installation in parallel. In this parallel deployment I installed docker-ce using rootless mode.

The key is to migrate the database - this holds all users, shares, access rights etc…
Exactly this is the point, to migrate the most important information i.e. users, permissions etc.
I tried to backup (MySQL dump) and restore (MySQL restore).
In my case MySQL migration failed. I did some checks and I found some information about my original NC deployment for example:
oc_storages tables store NC data location. This path will not be the same using docker.
Are there other information that I am going to update in MySQL after that I restored it?

Do you suggest me to export only necessary NC tables in my case?
For example I noticed these tables:
oc_users
oc_share
oc_share_external
oc_storages (I have to update record concering data location)

Thanks for your help!

no the database must remain untouched (until you really know what you do). Docker containers are very flexible regarding mount points - you can point the mount point of your container to every destination in your new system…

this is the right way to go. you should resolve database backup/restore the problem first… moving files is the easy part.

Hello,

no the database must remain untouched (until you really know what you do). Docker containers are very flexible regarding mount points - you can point the mount point of your container to every destination in your new system…

I am going to replicate this data path if necessary.
However I saw NextCloud docker deployment suggest “volume” and not “mount point” (At the moment I tried mount point in docker-compose.yaml file).

Regards

using “mount points” or “bind mounts” as in your example is perfectly valid - I’m using the same construct for long time already and moved at least twice to another platform (but always using docker-compose)