NCP: Backup from pi, restore to docker

Long question short: How can I backup a NCP instance installed on raspbian using the curl script, onto a NCP instance running in docker?

Hi,

I’ve been running NextcloudPi on a Pi 3 for a few years, now I want to transfer it to NextcloudPi running on a Pi 4 (2gb) in docker.

The new docker is setup with the following docker-compose (the backup volume is where the backups from the old pi are, the data dir is on a USB harddrive, empty, owned by www-data)

version: '3'
services:
  nextcloudpi:
    image: ownyourbits/nextcloudpi
    command: "NAMEREMOVED.com"
    ports:
     - "80:80"
     - "443:443"
     - "4443:4443"
    volumes:
     - /media/main-usb/nextcloud_data:/data
     - /media/main-usb/ncp-backups:/backup
     - /media/main-usb/files_external:/files_external
     - /etc/localtime:/etc/localtime:ro
    container_name: nextcloudpi
    restart: unless-stopped

I’ve run nc-backup from the old pi, with and without data, and running nc-restore inside the new docker does not work.
With datadir included in backup, it seem to try to put the data back in the data directory from the old pi (/media/USBdrive/), and since that doesn’t exist it fills up the SD card before it finishes.
With no datadir in backup, it gives this error:
{"reqId":"RLO5kJg7W4RtUqk9DkEx","level":2,"time":"2021-04-12T14:46:25+00:00","remoteAddr":"","user":"--","app":"no app in context","method":"","url":"--","message":"Temporary directory /var/www/nextcloud/data/tmp is not present or writable","userAgent":"--","version":"20.0.8.1"} Your data directory is invalid Ensure there is a file called ".ocdata" in the root of the data directory.
But this should be ‘/data’, not ‘/var/www/nextcloud/data’

I’m now stuck with the new docker not loading in data. I still have the old raspbian version running, and want the changeover to be as simple as pointing my router port forwarding at a new device, mostly to keep my wife happy by avoiding having to set everything up from scratch!

When you restore a backup from a normal installation to a docker instance.
The PATH to data will be restored also, which is where trouble starts.
You have to manually edit config.php to point to the container’s internal PATH (/data/nextcloud/data) and make sure the volumes are mounted correctly.
Same thing for the PATH to /tmp
Check and make note of these settings in config.php before and after restoring a backup.

Yep, that worked!

I activated the new docker image, then compared the fresh new config.php to the old config.php. Changed the paths, corrected the permissions, rescanned the files, and all happy!

Still kept all the apps, data and settings intact, there were warnings with the desktop sync apps, but all worked out well.