Everyone loves a Raspberry Pi. Software devs? Perhaps a little too much...

Nowadays I try to automate as much as possible, partially due to laziness but mainly in an effort to increase efficiency, consistency, and reliability.

This also includes all of my backups.

A combination of a Raspberry Pi, CentOS, rsync and SSH leads to a small but powerful backup unit. That runs to this day keeping an off-site backup of all my projects, sitting between my workstation and an old CRT I keep around to play light gun games.

It's a little dusty these days, a testament to how autonomous it is. I rarely have to touch or SSH into it.

This unit proves instrumental in saving me time and money. In the future, I'm going to look at creating a compact enclosure for the unit and a unified PSU so that it's not spread across a desktop shelf.

I'm also considering selling this as a mail order product (non-bespoke), once I can work out the legalities of CentOS resale and if I'd need to get a retailers license from RedHat.

If you'd like one for yourself in the meantime, please contact me and I can set you one up as bespoke work.

History

I used to rent a VPS from 123-reg, the very same company that wound up in the news for a catastrophic case of data loss in 2016.

Unfortunately, I was affected, along with a significant number of my client's websites. Fortunately, I kept regular backups and was able to restore these sites and their data with minimal data loss. Not long after I moved my servers across to a more reliable, local hosting company based in Sheffield (HA Hosting).

This incident was part of the inspiration for the backup unit but didn't lead directly to its creation.

After the data loss, I improved how I took backups and made inroads into partial automation.

It wasn't until about a year later when I was testing a Raspberry Pi as a potential dev server (and seeing if ARM CentOS was capable of running a LAMP stack) that the backup unit was constructed.

Using the groundwork taken from earlier work into automation I constructed the Unit after completing my tests.

For those curious, it is possible to use a Raspberry Pi as a dev server but I wouldn't recommend it, too slow.

How it works

The unit is made from a Raspberry Pi 3 model B with a large heatsink and the case cover open to reduce CPU temperatures (and create no noise).

It's a fairly simple idea, the difficult bit was compiling certain parts from source to make them work on ARM.

Rsync and rsnapshot take regular backups from connected servers via SSH on a regular basis.

MySQL databases and FTP sites (shared hosting) are backed up via shell scripts I created, these are executed via cron at about 1 AM GMT (off-peak hours) so that the database access doesn't affect the running of the sites. New sites are added by a single command in the list shell script.

For security reasons, FTP and MySQL backups are locked to the IP the unit will communicate from. Along with the relevant SSH keys, passwords etc. You also can only access the unit from my internal network, no outside access. It's also been secured with the standard CentOS security measures.

I've also added an e-mail onto the executed shell script, which will give me relevant info such as the CPU temp and how much space is left.

All backups are stored on an old external SATA drive I had lying around, connected via a USB dock.


Pi
The Setup

Related