pukcab

package module
v0.0.0-...-8f1a291 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2022 License: MIT Imports: 6 Imported by: 0

README

Pukcab

It's backup spelled backwards

Pukcab is a modular backup solution for simple, file-based backup needs.

Modules

  • Cloudflare: backup DNS BIND zones files for all domains associated with a Cloudflare account.
  • HTTP: backup any file specified by a URL using HTTP.
  • pfSense: backup the configuration of a pfSense device.
  • SCP: backup any file over SCP.
  • TAR: backup any local file or directory into a TAR (tape archive).
  • CMD: backup the output from any command.

See the README file in each module in the modules directory for detailed information and configuration.

Usage

Pukcab is controlled using a JSON configuration file with the following properties:

Key Type Description
modules array Array of modules and their associated configuration. The same module can be repeated multiple times.
output_dir string The directory where files should be saved.
artifact_retention number The number of days for backed up files to be retained.

For example:

{
    "modules": [],
    "output_dir": "/mnt/backup",
    "artifact_retention": 5
}

Then, run pukcab with that configuration file: ./pukcab config.json

Documentation

Overview

Package pukcab provides a common interface for a modular backup system.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanupModule

func CleanupModule(module Module) error

CleanupModule remove expired artifacts

func Configure

func Configure(config Config)

Configure will prepare pukcab for running with the given config instance

func GetFilePath

func GetFilePath(moduleName, fileName string) string

GetFilePath return an absolute path for a backup artifact. Must specify the module name, a description (which needs to be a filename-safe string), and an extension (without a dot)

func MarshallConfig

func MarshallConfig(in interface{}, out interface{}) error

func RunModule

func RunModule(module Module, config interface{}) error

RunModule will run the given backup module

Types

type Config

type Config struct {
	Modules           []ModuleType `json:"modules"`
	OutputDir         string       `json:"output_dir"`
	Verbose           bool         `json:"verbose"`
	ArtifactRetention int          `json:"artifact_retention"`
}

Config describes a configuration object for pukcab

type File

type File struct {
	Path string
}

File describes a backed-up file

type Module

type Module interface {
	Name() string
	Run(c interface{}) ([]File, error)
}

Module describes the interface for a pukcab module

type ModuleType

type ModuleType struct {
	Name   string      `json:"name"`
	Config interface{} `json:"config"`
}

ModuleType describes a module configuration for pukcab

Directories

Path Synopsis
cmd
modules
cmd
scp
tar

Jump to

Keyboard shortcuts

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