Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// LogPath is the oath on disk where repbak log file. Defaults to /var/log/repbak.log.
LogPath string `yaml:"log_path"`
// LogLevel sets the level of logging. Valid levels are: panic, fatal, trace, debug, warn, info, and error. Defaults to error
LogLevel string `yaml:"log_level"`
HTTP *HTTP `yaml:"http"`
MySQL *MySQL `yaml:"mysql"`
Email *Email `yaml:"email"`
}
Config is an object representation of the YAML configuration file.
func OpenConfig ¶
OpenConfig returns a new Config option by reading the YAML file at path. If the file doesn't exist, can't be read, is invalid YAML, or doesn't match the repbak spec then an error is returned.
type Dumper ¶
type Dumper interface {
// Dump does a backup of the database
Dump() error
// Stop stops the database backup if one is running
Stop()
}
Dumper defines an interface for backing up a database.
type Email ¶
type Email struct {
// Host is the hostname or IP of the SMTP server.
Host string `yaml:"host"`
// Port is the port of the SMTP server.
Port int `yaml:"port"`
// User is the username used to authenticate.
User string `yaml:"user"`
// Pass is the password used to authenticate.
Pass string `yaml:"pass"`
// StartTLS enables TLS security. If both StartTLS and SSL are true then StartTLS will be used.
StartTLS bool `yaml:"starttls"`
// Skip verifying the server's certificate chain and host name.
InsecureSkipVerify bool `yaml:"insecure_skip_verify"`
// SSL enables SSL security. If both StartTLS and SSL are true then StartTLS will be used.
SSL bool `yaml:"ssl"`
// Optional subject field for notification emails
Subject string `yaml:"subject"`
// From is the email address the email will be sent from.
From string `yaml:"from"`
// To is an array of email addresses for which emails will be sent.
To []string `yaml:"to"`
}
type EmailNotifier ¶
type EmailNotifier struct {
// contains filtered or unexported fields
}
EmailNotifier sends emails based on repliaction failure
func NewEmailNotifier ¶
func NewEmailNotifier(config *Config) *EmailNotifier
NewEmailNotifier creates a EmailNotifier using the config
func (*EmailNotifier) Notify ¶
func (n *EmailNotifier) Notify(err error) error
Notify sends a failure notification
type HTTP ¶
type HTTP struct {
// The address the http server will listen on.
Addr string `yaml:"addr"`
// The port the http server will listen on.
Port int `yaml:"port"`
}
HTTP defines the configuration for http health checks.
type MySQL ¶
type MySQL struct {
// Retention is the number of backups to keep before rotating old backups out. Defaults to 7.
Retention int `yaml:"retention"`
// OutputPath is the path where backups will be stored.
OutputPath string `yaml:"output_path"`
// Schedule is the cron expression that defines when backups are created.
Schedule string `yaml:"schedule"`
// ExecutablePath is the path to the tool used to create the mysql backup. Defaults to mysqldump.
ExecutablePath string `yaml:"executable_path"`
// ExecutableArgs are the arguments passed to the executable used to create the mysql backup. Defaults to --add-drop-database --all-databases.
ExecutableArgs string `yaml:"executable_args"`
// TimeLimit is an optional limit to the time it takes to run the backup.
TimeLimit string `yaml:"time_limit"`
// contains filtered or unexported fields
}
MySQL defines how a mysql backup will be created.
type MySQLDumper ¶
type MySQLDumper struct {
// contains filtered or unexported fields
}
MySQLDumper dumps a mysql backup to a file.
func NewMySQLDumper ¶
func NewMySQLDumper(config *Config) *MySQLDumper
NewMySQLDumper creates a MySQLDumper.
func (*MySQLDumper) Dump ¶
func (d *MySQLDumper) Dump() error
Dump dumps the mysql data to a file based on the settings in config.
func (*MySQLDumper) Stop ¶
func (d *MySQLDumper) Stop()
Stop stops the current dump if one is running.