Replica is a tool to generate directory backups and replicate them in multiple environments. It is a plugin-driven application, and for the moment it distinguishes 2 plugin types:
- Backup Plugins generate backups of a system
- Distributor Plugins distributes the previous backups among diferent systems
New plugins are designed to be easy to contribute, pull requests are super welcomed. For example, databases backup plugins or cloud services distributor like AWS S3.
Replica requires Go version 1.14 or newer, the Makefile requires GNU make.
- Install Go >=1.14 (1.15 recommended)
- Clone the Replica repository:
git clone https://github.com/rogercoll/replica.git
- Run
make
from the source directorymake build sudo cp ./replica /usr/bin
Replica will try to find a default config file at these locations (in order):
- $REPLICA_CONFIG_PATH
- $HOME/.replica/replica.conf
- /etc/replica/replica.conf
Example file:
[[backup.targz]]
paths = ["/home/neck/influxd"]
# Time format to be used in the backup file names (https://golang.org/pkg/time/#Time)
# Default is layoutISO = "2006-01-02"
[[distributor.local]]
destinations = ["/home/neck/backups/", "/home/neck/backups/test1/", "/home/neck/backups/test2/"]
[[distributor.ssh]]
hosts = ["192.168.1.90:22:pi"]
passwords = [""]
destinations = ["/home/pi/extBackups/"]
The file plugins contains additional information on how to check and get a sample configuration for each available plugin.
Once a configuration file has been defined with the desired plugins, you can simple run it:
replica
The best would be to add the execution as a cron job, thus automatically make and replicate backups when needed.
The program workflow is based on Telegraf agent, kudos to them for the great work!