Getting Started with TrueNAS: Buddy backups with Duplicati
I mentioned in my previous post that I had setup my friend and I's servers with three distinct datasets: Data, Media, and Backup.
Data was created as a dataset where all our personal documents would be stored.
Media was created as a dataset for movies and music, which don't require an offsite backup. This is where I put my collection of movies and series that I've ripped and make available to Plex.
Backup is the offsite backup dataset. This is where my cloud servers backup, as well as as where our backups of each other's Data dataset lives.
Now, to be honest, I didn't setup encrypted datasets on our servers, as I've not done it before and this data is too important to me to take a chance. Someday I'll toy with it and learn that aspect of TrueNAS and ZFS. The problem with that decision is that you can't just use a TrueNAS Replication to encrypt your data on the remote system only. Additionally the cloud sync tasks include multiple methods of backing your data up to remote systems, including FTP and SFTP, but also do not include encryption.
This is why I chose Duplicati (Website, Github).
Duplicati is available as an community provided App in the TrueNAS app marketplace. The software's Github page states:
Duplicati is a free, open-source backup client that securely stores encrypted, incremental, and compressed backups on cloud storage services and remote file servers. It supports:
Amazon S3, IDrive e2, Backblaze (B2), Box, Dropbox, FTP, Google Cloud and Drive, MEGA, Microsoft Azure and OneDrive, Rackspace Cloud Files, OpenStack Storage (Swift), Storj DCS, SSH (SFTP), WebDAV, Tencent Cloud Object Storage (COS), Aliyun OSS, and more!
Duplicati is licensed under the MIT license and is available for Windows, macOS, and Linux.
This is the perfect solution to allow us to keep our data on each other's servers and still retain our privacy!
Setup was rather simple, as you click 'Install' in the market and you're presented with a page to add your storage to the app and set a password. I added /mnt/Pool, and mounted it on my Duplicati deployment as /mnt/Pool as well.
Once it's deployed you'll need to hit the WebUI button to access the software. One weird thing is Duplicati on TrueNAS, by default, cannot be access by hostname. You'll need to access by IP, go into the settings, add your hostname(s), and restart the service.

The next step was to create users and directories. On his server I created a backup_steve user with an SSH key. Then I created another dataset under Backup named backup_steve, and changed the ownership of that dataset to the user. On my server I did the same process with a backup_friend user and directory. Finally, on both servers, I had to go to the TrueNAS services settings, start SSH, and tick the Start Automatically slider. Also hit the pencil while you're at it and make sure Allow password authentication is unchecked.
Then in Duplicati I created a new backup. You name it and setup encryption. It defaults to AES-256, but you can turn it off or use GPG. Once you've typed in your encryption password you hit next and choose your storage type. There are many, many options, but for our use we chose SSH. From here you enter the server, port, path, and username. You then hit Add Advanced Option and ssh-key. Paste in the private key and hit Test Destination. As long as it's successful you're ready to continue.

Next up is the source selection, which was easy. I specified /mnt/Pool/Data.
Then you set the schedule. By default it's set to run at 1am daily. Sounded good to me. Continue.
The last screen is where you setup backup retention. By default it's set to Smart backup retention, which means there will be one backup for each of the last 7 days, each of the last 4 weeks, and each of the last 12 months. I don't expect our data will change a lot, it's deduplicated, and right now we have plenty of room, so that's what I chose.

That's it! Just check on it the next day to make sure your backups are processing properly. Duplicati does have the option to email logs, which I may look into in the future.
Of course with this to work correctly from two different locations we had to setup dynamic DNS hostnames and setup port forwarding on our firewalls. I personally use freedns.afraid.org for my dynamic DNS.

