Version information
This version is compatible with:
- , ,
Start using this module
Add this module to your Puppetfile:
mod 'evenup-backup', '0.8.0'
Learn more about managing modules with a PuppetfileDocumentation
Table of Contents
- Overview
- Module Description - What the module does and why it is useful
- Setup - The basics of getting started with backup
- Usage - Configuration options and additional functionality
- Reference - An under-the-hood peek at what the module is doing and how
- Limitations - OS compatibility, etc.
- Development - Guide for contributing to the module
- Changelog/Contributors
Overview
Puppet module to install the ruby backup gem and create jobs to back up various services and directories.
Module Description
The ruby backup gem allows backing up files and various databases and optionally compressing, encrypting, and splitting them into smaller chunks, and copying them to remote systems or file storage service.
This module will install the backup gem, but more powerfully allows the creation and scheduling of jobs based on the backup DSL.
A script is provided in the scripts directory to create a standalone RPM with fpm which includes a global binary to run jobs.
Setup
What backup affects
- backup ruby gem
- backup config files
- backup job cron entries
Setup Requirements
Dependencies to build ruby gems (and backup and it's dependencies specifically) need to be installed for this module. It can optinally install all needed dependencies from a base system.
Beginning with backup
To install backup:
puppet module install evenup-backups
Usage
To install the backup gem:
class { 'backup': }
Creating a backup job to archive /etc to the local path /backups:
backup::job { 'etc':
types => 'archive',
add => '/etc',
storage_type => 'local',
path => '/backups',
}
Create a backup job to archive a riak database and its config, compressing, splitting into 1G chunks, and copying to S3 on Sundays at 01:10:
backup::job { 'riak':
types => ['archive', 'riak'],
add => '/etc/riak',
cookie => 'supersecret',
storage_type => 's3',
compressor => 'bzip2'
level => 9,
split_into => 1024,
aws_access_key => 'AWS_ACCESS_KEY',
aws_secret_key => 'AWS_SECRET_KEY',
bucket => 'backup-bucket',
weekday => 0,
hour => 1,
minute => 10,
}
Reference
Public Classes
'backup'
ensure
String. Whether or not the backup gem should be installed.
Default: latest
package_name
String. Name of the package to be installed
Default: backup
package_provider
String. Package provider to install the gem
Default: gem
install_dependencies
Boolean. Whether or not development dependenceis for building the backup gem should be installed.
Default: true
package_dependencies
String/Array of Strings. List of packages to install as development dependencies.
purge_jobs
Boolean. Whether or not unmanaged backup jobs should be purged.
Default: true
Public Defines
backup::job
Creates backup jobs.
types
String/Array of Strings. List of backup types to include in this job.
description
String. A description to use for this backup job.
hour
Cron syntax. Hour the backup job should be scheduled
Default: 23
minute
Cron syntax. Minute the backup job should be scheduled
Default: 5
monthday
Cron syntax. Day of the month the backup job should be scheduled
Default: *
month
Cron syntax. Month the backup job should be scheduled
Default: *
weekday
Cron syntax. Day of the week the backup job should be scheduled
Default: *
ensure
String. Whether or not the job should be present
Default: present
#####utilities
Hash. Commands and paths provided as key:value pairs to the location of utility commands if not available in the default path
#####tmp_path
String. Set the tmp-path for a backup job run
Default: ~/Backup/.tmp
add
String/Array of Strings. Used with the archive backup type, list of paths to be included for backup
exclude
String/Array of Strings. Used with the archive backup type, list of paths to be excluded for backup
dbname
String. Used with multiple database types, database name to back up
host
String. Hostname to back up
Default: localhost
username
String. Username to connect to the database as
password
String. Password for username
to use to connect to the database
port
Integer. Port to use to connect to the database
collections
String/Array of Strings. MongoDB collections to back up
lock
Boolean. Whether to enable MongoDB lock when backing up
Default: undef (false)
node
String. Used with Riak backups, node name to back up.
Default: riak@${::fqdn}
cookie
String. Cookie to be used for riak backups
Default: riak
#####rdb_path
String. Path to the redis database
Default: /var/lib/redis/dump.rdb
storage_type
String. Type of storage to use for the backup archive
keep
String. Number of backups to keep on storage
split_into
Integer. Size (MB) to split individual backup archives into
path
String. Path for destination archive
aws_access_key
String. AWS access key when using S3 storage type
aws_secret_key
String. AWS secret key when using S3 storage type
bucket
String. Bucket to store archive when using S3 storage type
aws_region
String. Region to store archive when using S3 storage type
encryptor
String. Encryptor to use on backup archive
openssl_password
String. Password for archive when using OpenSSL encryptor
compressor
String. Compressor to use on backup archive
level
String. Compression level to use with compressor
enable_email
Boolean. Enable email notifications
Default: false
email_success
Boolean. If email enabled, should successful backups generate an email
Default: false
email_warning
Boolean. If email enabled, should backups exiting with warnings generate an email
Default: true
email_failure
Boolean. If email enabled, should backups exiting with errors generate an email
Default: true
email_from
String. Email address backup job emails should be sent from
email_to
String. Email address backup job emails should be sent to
relay_host
String. Host backup job notifications should be relayed off of
Default: localhost
relay_port
Integer. Port on relayhost
emails should be sent to
Default: 25
enable_hc
Boolean. Whether backup job noticies should be sent to HipChat
Default: false
hc_success
Boolean. If HipChat notifications are enabled, should successful backups be posted
Default: false
hc_warning
Boolean. If HipChat notifications are enabled, should backup jobs exiting with warning be posted
Default: true
hc_failure
Boolean. If HipChat notifications are enabled, should backup jobs exiting with an error be posted
Default: true
hc_token
String. HipChat API token
hc_from
String. Name backup job alerts should be posted as
Default: Backup
hc_notify
Array of Strings. HipChat rooms that should be notified about backup jobs
Private Classes
- backup::config: Global configuration
- backup::install: Installs packages
- backup::params: Default parameters
Limitations
- Requires ruby >= 1.9.3
Development
Improvements and bug fixes are greatly appreciated. See the contributing guide for information on adding and validating tests for PRs.
Changelog / Contributors
20151109 - v0.8.0 Add support for eu-central-1 (vvondra) Support custom ruby bin path (vvondra) Support S3 reduced redundancy (vvondra) Support MySQL backup type (vvondra) 20151030 - v0.7.1 Fix before/after blocks 20151030 - v0.7.0 Add support for before/after blocks 20150917 - v0.6.1 Correct typo in max_bytes variable name 20150917 - v0.6.0 Add ability to set logging options 20150513 - v0.5.0 Add ability to set tmp-path 20150416 - v0.4.0 Add redis database support 20150217 - v0.3.0 Add job params to class for defaults 20150216 - v0.2.1 Correct RHEL-based version check 20150130 - v0.2.0 Added FTP storage support 20150105 - v0.1.1 Update RPM generation script Correct documentation 20150105 - v0.1.0 Initial public release (rename from evenup/backups)
Dependencies
- puppetlabs/concat (>=1.1.0 <2.0.0)
- puppetlabs/stdlib (>=4.5.0 <5.0.0)
Copyright 2013 EvenUp Inc Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.