replica

package module
v0.0.2-0...-cdf9e78 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 8, 2021 License: MIT Imports: 0 Imported by: 0

README

Replica

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:

  1. Backup Plugins generate backups of a system
  2. 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.

Installation:

From Source:

Replica requires Go version 1.14 or newer, the Makefile requires GNU make.

  1. Install Go >=1.14 (1.15 recommended)
  2. Clone the Replica repository:
    git clone https://github.com/rogercoll/replica.git
    
  3. Run make from the source directory
    make build
    sudo cp ./replica /usr/bin
    

Backup Plugins

Distributor Plugins

Configuration

Replica will try to find a default config file at these locations (in order):

  1. $REPLICA_CONFIG_PATH
  2. $HOME/.replica/replica.conf
  3. /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.

How to use it?

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!

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backup

type Backup interface {
	PluginDescriber
	//Should we return error or the backup should have its own logger
	//Returns a list with the paths of the backups
	Do() ([]string, error)
}

type Distributor

type Distributor interface {
	PluginDescriber
	Save([]string) (int64, error)
}

type PluginDescriber

type PluginDescriber interface {
	// SampleConfig returns the default configuration of the Processor
	SampleConfig() string

	// Description returns a one-sentence description on the Processor
	Description() string
}

Directories

Path Synopsis
cmd
replica command
plugins

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL