jump to navigation

BackupFriend – Self-hosted backup to your RaspberryPi with a history and UI! July 19, 2021

Posted by GuySoft in open source, programming, python, wxpython.
Tags: , , , , ,
trackback
BackupFriend logo
Atribution: Icon by: Freepik

Hey all,
I am releasing today something I’ve been working on the past year. It stared with a friend that had a requirement to do off-site backups of his work for his insurance, but BackupFriend has became a full blown backup solution.
The idea is you get a RaspberryPi and plug a harddrive to it, put it at your friends, family or just in your house and backup up to it using a desktop client that should have the feel like Dropbox/Google Drive/etc. You also get history! The RaspberryPi can also be changed to a remote server (instructions here). This guide focuses on self-hosted instructions, because I think its strange all backup solutions out there require you to pay rent for your own data.
Using a 4TB drive for under $100 and a Pi, you can get much more storage which is not ephemeral.
The desktop client has been tested on both Linux, MacOS and Windows.

Also, many thanks to Pull Request Community that featured BackupFriend as a project to work on, that helped get a few PRs on-board.

What you will need

  1. A Raspberry Pi, preferably 4B because of the USB3
  2. A home network with a computer running Linux, MacOS or Windows, which you will be backing up from
  3. An external hard drive that can connect to the Pi (I use a 4TB WD My Passport drive, you can also just use a thumb drive for testing).

How to install on a Pi

  1. Download and the BackupFriend image (source code so you can see what’s under the hood)
  2. Unzip the image and install it to an SD card like any other Raspberry Pi image
  3. Configure your WiFi by editing backupfriendpi-wpa-supplicant.txt at the root of the flashed card when using it like a flash drive (You can also just plug the device to an Ethernet port on your router).
  4. Attach the external drive and power up.
  5. Hostname is backupfriend (not raspberrypi as usual), username: pi and inital password is: raspberry
  6. After a few minutes you should be able to access http://backupfriend/ or http://backupfriend.local.
  7. Default password for the Web UI is admin password admin123.

You should see a login screen like this:

At this point you have the backup server running. Excellent!

The backup server is now sitting on your local network. If you want to have it backing up on a remote location, you will need to open the router port to it, and set the domain name on the nginx-proxy container there. More info on that here.

How to set up the Desktop Client

Now that we have a server on the Pi, let’s backup to it form the local host.

Linux

sudo python3 -m pip install backupfriend

Windows

  1. Download .zip for windows run the executable backupfriend-client.exe.
  2. If you want to make it start on boot follow this guide.

Mac

  1. Download the .zip for mac and open it to extract the .app
  2. Copy it to our applications folder.
  3. If you want to make it start on boot follow this guide (guide would not work if the .app is not in the applications folder).

First Time Run

On the first run you will be asked to follow a wizard and create your connection keys. Those let you backup sequentially to the server. Just follow the guide and copy the public key:

First time run
The SSH public key you need to copy and place in the server

Server setup

Now that we have a key, let’missing apostrophes place it in the server.
Log in to your backup server using the default

user: admin
password: admin123

You should get this view as shown below

Go to admin on the top right and select “Profile”

We need to set up the sync folder and SSH key.

Web interface first login

In the SSH key page press “add new SSH key” and paste the public SSH key you got from the BackupFriend Client:

Adding an SSH key to the webserver

Now there is one more step to do before we can start backing up – setting the root folder for the user.
Click on “Admin area” and then on the “Users: 1” button as shown below:

The admin area page

Select the only admin user in the list and click on the “edit” button. You should see the following edit page.

Here you need to add the “Root directory” to be “/backup”. This means that anything in the “/backup” folder on the Pi would be visible in the web interface.

Edit admin user

Once the changes are saved you will see the amount of free space on the main window:

Main page with free storage shown

Now we can finally sync. The first install comes with an example sync. It just syncs your temp folder. Click the “edit” and then you can confirm that it all works using the “test” button. You should get “connection succeeded”.
Note: Sometimes you might see first “warning: server added to authorized servers”. Just press “Test” again, its the SSH system setting that server as an authorized one.

When the job is running it will turn blue, when it’s finished it will turn green:

Example job running

Once it’s done, or in the middle, you can access the backup on the web interface.

To do so you might need on the first time to refresh the repositories to it will be shown. To do that go to the “profile” and press “refresh repositories”:

Profile page scrolled to the bottom to show “refresh repositories”

Finally, you can see now the repositories and the files with their versions:

Example repository stored

That’s it, you should have now a backup server on a Pi that you can also move elsewhere.

Development – Source Code Repos

There are quite a few parts for the project, here are the repos for them:

This is just version 0.1.0 and there is a lot to improve. Since I am only one person I would greatly appreciate PRs and help getting this to be a full blown solution.

Comments»

1. masanefesh - July 20, 2021

Cool! I can use rclone for backup but another users maybe want gui.

GuySoft - July 20, 2021

rclone does not support history such as rdiff-backup, which is what BackupFriend currently uses. You could also use the rdiff-backup commandline.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: