Update: After further testing, I no longer recommend this approach due to many limitations listed in the last section.
Restic and its companion UI Backrest already allow you to back up to many different locations. However, getting it setup to back up from one Unraid NAS to another might not be straight forward. Here I will go into details on the steps I have used to to make it work.
The goals of this setup are:
- Sender will use Backrest while receiver will use Tailvault app in Unraid.
- Both apps will have Tailscale integration enabled, and connectivity will be via Tailscale.
Tailvault is a very simple Alpine container that enables SFTP. However, Restic doesn’t support SFTP with password, hence the need for additional setup for key pairs between the 2 containers.
- Generate a keypair with PuTTYgen, choose EdDSA and Ed25519
- After the pair is generated, click Conversions >Export OpenSSH Key and named it id_ed25519
- The public key can be copied from the box “Public key for pasting into OpenSSH authorized_keys file:”
- Install TailVault app in the Community Store with the following modifications:
- Repository: nguyenquyhy/tailvault:latest
- Tailscale Hostname: change to something more specific if you are going to have multiple tailvault in your tailnet.
- Remove SFTP_PASS
- Add SFTP_PUB_KEY.
- Config Type: Variable
- Name: SFTP_PUB_KEY
- Key: SFTP_PUB_KEY
- Value: Use the public key in step 1
- Open TailVault container log and login to Tailscale using the link in log
- Open appdata/TailVault and download ssh_host_ed25519_key.pub
- Install Backrest app in the Community Store with Tailscale enabled
- Open Backrest container log and login to Tailscale using the link in log
- Create known_hosts file on your computer with the following content:
<tailvault domain from Tailscale> <content from ssh_host_ed25519_key.pub in step 3>- e.g.
tailvault.abc.ts.net ssh-ed25519 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA root@aaaaaaaaa
- Upload id_ed25519 from step 1 and known_hosts from step 5 to appdata/backrest
- Select id_ed25519, click Permissions, change Group and Other to No Access
- Edit backrest app in Unraid’s Docker and add the following:
- Path:
- Name: Private Key
- Container Path: /root/.ssh/id_ed25519
- Host Path: /mnt/user/appdata/backrest/id_ed25519
- Path:
- Name: Known Host
- Container Path: /root/.ssh/known_hosts
- Host Path: /mnt/user/appdata/backrest/known_hosts
- Path:
- Open backrest URL
- Add repo. For Repository URL, use
sftp:<username set in step 2>@<tailvault domain from Tailscale>:/backups
References
Guide from backrest: Using SSH (SFTP) Remotes with Docker Compose · Backrest
Alternatives
- Backrest is very flexible and the recent UI update makes it look much nicer. However, the lack of concurrency support (for both same repository and different repositories) is a deal breaker for me. I have been moving to Zerobyte for the following features:
- Concurrent backup: This is very important when there is a very large backup running for hours or days.
- Allow inputing SFTP private key and host public key directly in the UI, for each repository: step 7, 8, 9 and 10 can be skipped.
- SFTP is very slow comparing to the alternative of Restic Rest Server. From my benchmark tests on a Tailscale direct connection of 200ms latency:
- Initialize a repository: 5s with Rest server and 25s with SFTP
- Listing snapshots (single snapshot in total): 1s with Rest server and 5s with SFTP
- Backing up 50GB of data to HDD: 10-11m with Rest server and 15-45m with SFTP