Nextcloud Refresh – Part 4 – Recovery Testing

In the previous post on the topic, I promised to follow up with a post on how to do a differential Nextcloud AIO restore. My application: Keep a cold standby Nextcloud AIO instance up to date so I can quickly activate it, should my main server fail. However, doing a periodic full restore to a backup instance in my case is just not practical due to the sheer amount of data that needs to be moved. Hence, a differential restore is required.

Before I go to the differential restore, I would like to make a short detour, as I do not only need a way to run a differential restore, but also a way to test if the backup server would actually work when the containers are started. The one thing I need for this is that I can dynamically change the domain name at which the backup server can be reached. While the instance is only the backup server, I don’t want to reach it at, let’s say, cloud.martin.com but rather at cloud-test.martin.com. Turns out this can be configured quite easily.

To initially set up a virtual machine as a backup instance, one can go ahead and run the ‘normal’ Nextcloud AIO installer procedure I described in the first post in this series. 5 minutes and you are done. During the setup, I used cloud-test.martin.com as the domain name for the instance. Important: Do not specify a backup location! Once done, there is a fully working but empty Nextcloud AIO instance. Changing the domain name by which it can be reached is actually straight forward. Stop the containers of the instance in the AIO web console and then run the following command on the server’s shell:

sudo docker run -it --rm --volume nextcloud_aio_mastercontainer:/mnt/docker-aio-config:rw alpine sh -c "apk add --no-cache nano && nano /mnt/docker-aio-config/data/configuration.json"

This opens the configuration.json of the master container in nano. Now change the following parameters:

nextcloud_datadir  --> Check that the data directory is correct for the backup system!

domain: change between cloud-test.martin.com or cloud.martin.com as required

AIO_URL: IP address of this instance.

When changing parameters on a new and empty Nextcloud AIO instance, only the domain parameter has to be changed. Make sure an IP to domain name mapping exists on the DNS server! If a backup from another instance is restored to this server, however, the Nextcloud data directory and the AIO URL/IP address are changed to the values used on the main instance and hence have to be adapted to the values for the standby instance before the containers are started again in the Nextcloud AIO web console. Once the Nextcloud instance is up and running again with the modified domain name, adapt the domain name in the configuration of the plugins such as Talk. Pretty much straight forward as well, it’s even described on the Nextcloud help pages. Have a look here.

So much for running a cold standby instance with a different domain name. Next stop: How to differentially restore data to the cold standby instance.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.