Raw copy repositories from a restic rest server

I finally followed rawtaz suggestions, at least in a way, and I’d like to present my solution. Maybe someone runs into the same kind of situation/confusion.

I duplicate the backup by activating 2 different backup scripts on each individual node (mostly RPis), one that goes directly to the 24/7 server (which should always work) and the second which polls the desktop machine using:

while  "[[ $(curl -s -o /dev/null -w ''%{http_code}'' neo.lan:8000/morpheus/config)" != "200" ]] ; do sleep 60; done && restic backup -r rest:http://neo.lan:8000/morpheus ...

‘neo’ being the desktop machine ‘morpheus’ the repository for the machine performing the backup

The script will run until the desktop machine shows up and is activated daily by a systemd timer event. The timer will not start a new instance of this process unless it has already terminated (the default behaviour).

This way all nodes in my network will back-up independent of the existence of the desktop machine, but will always create a second backup on it if possible. Also checking, forgetting and pruning is duplicated that way and should not create any (additional) inconsistencies, there is no additional need to synchronize nodes.

Edit: You have to make sure a backup on the restic rest server is created once, otherwise the config file for the system won’t exist and 404 is returned (and the backup will never be started). Simply start the backup by hand once when the machine is up.

3 Likes