DEV Community

GU aka Matteo Guadrini
GU aka Matteo Guadrini

Posted on • Edited on

1 2

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

4) SETUP CRONTAB

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

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
Enter fullscreen mode Exit fullscreen mode

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/

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more