DEV Community

GU aka Matteo Guadrini
GU aka Matteo Guadrini

Posted on • Edited on

Implement an open source backup-restore system.

Intro

There are multiple open source backup/restore solutions, but almost all have an agent/server approach.

The disadvantage of such an approach is that the consumption of hardware resources exists on both the client and server side.

rsync, is a very simple tool with many very useful options. Unfortunately, this utility does not provide a backup/restore method, but only synchronization from point A to point B.

However, a somewhat more complex logic can be implemented on it so that multiple backups can be managed, maintaining a sort of historicity.
At this point, rsync becomes the core of something much more complex.

Butterfly Backup is a rsync wrapper, which increases its capacity, becoming a real backup/restore/archive tool. Butterfly Backup is a simple command line wrapper of rsync for complex task, written in python.

In a few simple steps, without repository configurations, particular settings and third-party software or plugins, you can implement an automatic enterprise backup/restore/archive system.

Deployment

Such as? In four steps:

1) INSTALLATION

git clone https://github.com/MatteoGuadrini/Butterfly-Backup.git
cd Butterfly-Backup
sudo python3 setup.py

2) EDIT LIST OF COMPUTER/SERVER UNDER BACKUP

cat << EOF > /mnt/san/bck_list
server01.local
server02
10.0.0.1
192.168.2.42
EOF

3) DEPLOY CONFIG SSH KEY

bb config --new
bb config --deploy server01.local
bb config --deploy server02
bb config --deploy 10.0.0.1
bb config --deploy 192.168.2.42

4) SETUP CRONTAB

CMDBB="bb backup --list /mnt/san/bck_list --destination /mnt/san --data User Config --type Unix"
echo "00 12 * * * $CMDBB" | crontab -

Et Voilà!

In 5 minutes, you have implemented an automatic backup system that saves the User folders and configuration folders (/etc) of four servers, every 12:00 PM, every day.

All the backups performed can be consulted in a catalog that is easy to read and consult, in this way:

bb list --catalog /mnt/san

Conclusion

Sometimes the simplest solution is the best possible choice.

For more information on this tool, follow the links below:

WEBSITE: https://matteoguadrini.github.io/Butterfly-Backup/
GITHUB: https://github.com/MatteoGuadrini/Butterfly-Backup
DOCS: https://butterfly-backup.readthedocs.io/en/latest/

Top comments (0)