Clone Nextcloud

It is more an idea than a question.

Before every update, I’m afraid that it could go wrong and that I have to spend the next few hours looking for a solution. Honestly, it hasn’t happened to me very often, but there are a few cases here in the forum and actually I’m more concerned with the certainty that I can safely import the next update.

Wouldn’t it be practical to have a way to clone a complete Nextcloud instance on the web space?
So copy all files into a parallel or subordinate directory and either create a new database (will be difficult for most hosts to automate) or insert the tables with a new prefix into the original database.
Then the update could be tested with this clone.

Of course, the config.php of the clone would have to be adjusted and it may not be necessary to copy the user files.

It would be important that the clone script runs via PHP and does not require SSH access so that it can also be used by users who only have a web space account.

How do you like this idea?
Is it worth creating such a script, or does it even make sense to program the whole thing as an app?
Are there technical reasons why this might not work?

My skills are not sufficient to program such a script well enough. If I should try it, I would be dependent on ideas and help.

Greetings Kolja

I think that is not important. I think for bigger installations it would not work. You need for test a similar environment.

Yes. But perhaps it is better to regularly backup and restore the nextclud installation. Than a upgrade-fail or a hdd-crash or stupidity in administration or usage does no matter.

https://docs.nextcloud.com/server/19/admin_manual/maintenance/backup.html

https://docs.nextcloud.com/server/19/admin_manual/maintenance/restore.html

1 Like

Thanks for your advice.
Can I ask a little more?

What role does the size of the installation play?
Although I suspect that such a script is needed by those who don’t have large clouds with many users.

Why isn’t it the same enviroment?
Except for the path and the prefix, everything is the same.

The backup & restore paths from the manual require SSH access and are therefore not suitable for many users.

BTW, the NC Updater already copies the data of the “old” installation into the data directory (without the user data files), is there a backup of the database somewhere?

edit: no!
Create backup: creates a backup of the existing code base in /updater-INSTANCEID/backups/nextcloud-CURRENTVERSION/ inside of the data directory (this does not contain the /data directory nor the database).
https://docs.nextcloud.com/server/19/admin_manual/maintenance/update.html

It is correct that users only with web space can not use the shell.
But why should a user with vps or home server use the inadequacy of a backup/restore or clone software of nextcloud installation only hosted on a webspace.

What role does the size of the installation play?

A webserver installation does not work. An with not more users a normal installation does not work, too.

Nothing beats regular backups but it’s easy to run a Nextcloud instance from a self-contained directory by using Docker Compose. With such a deployment, making an exact copy of the current instance is as easy as copying that directory. After that, you can try “risky” things and rest assured that you always can roll back to the previous state in no time. This method still needs file system access but it’s simple and it does the trick.

1 Like