B2 Backup



A huge upside to how the UniFi Controller works is that it’s not really dependent on where it runs to operate, it does however require the DNS hostname, some firewall ports and most importantly, the site data.
This results in that there is no real need to perform server level backups, all you need is the site data.
If the server were to break for some reason, spin up a new one, install the Controller software again and import the backup data, the gear will reprovision once but no further action is needed. ofcourse, provided that the gear is set up with a DNS inform-url.

  1. B2 Backup
  2. Brennan B2 Backup

To use the Backblaze B2 storage with the command line version of Duplicacy, enter a storage url in the format of b2://bucket, where bucket is the name of the bucket to be used. You will then be prompted for entering the account id and application key. B2 is the cloud storage offering from the very reputable online backup company, Backblaze.

The Controller does provide a way of automating the backups as of version 5.1.0 but the resulting .unf files are stored locally in {data.dir}/backup/autobackup. As in, if the server were to break the backups wouldn’t do us much good.
Solution: Move the backup data off-site.

I’m a big believer in Cloud infrastructure and Backblaze is a service I’m using to backup my local workstation data, when they announced B2 I jumped ship right away.
B2 is for my purposes a Backblaze backed FTP service, in reality though it’s so much more, the beauty of it for this purpose is that the first 10GB are free, seeing as the UniFi backups doesn’t grow too large in my environment I’m left with a free off-site reliable cloud hosted backup location.

What you’ll need

– SSH Access to the Ubuntu/Debian based machine running UniFi Controller
– A Backblaze account

Setup

The setup is split up in a few steps, when complete you’ll end up with an automated solution to move .tar.gz copies of the controllers automated backup files as well as all of the pure site data from local storage to a Backblaze B2 Bucket.

UniFi Controller

First off, enable the automatic backup feature of the UniFi Controller.
Settings – Auto Backup – Enable Auto Backup.
Performing the backup does increase resource usage for a short while, depending on size, and should ideally be done during a maintenance window or off-hours.
Select a time that works for you.

B2 Backup

Client

Backblaze

Brennan B2 Backup

You’ll need to create a Backblaze account aswell as a Bucket. At the time of writing this is completely free.
With the account created, head over to the B2 page and sign up using the same email address. Verify your email, setup your phone number as well as the not needed but highly recommended two-factor authentication option.
When the processing is done you should be able to see “B2 Cloud Storage” in the left hand side menu of Backblazes “My account” section, this however might take a few minutes.
Begin by selecting “Show Account ID and Application Key” followed by “Create Application Key”, note the provided values, as these can’t for all intended purposes be changed later.
While you’re here, go ahead and create a Private Bucket, give it a unique name.

Server

I’ve created and distributed the installation procedure/command reference over on GitHub as well as below.

unifi-b2-setup.sh