Skip to content
A cookbook for installing/configuring backups using `backupninja`
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
attributes
providers
recipes
resources
templates/default
.gitignore
.kitchen.yml
Berksfile
CHANGELOG.md
Gemfile
README.md
Thorfile
Vagrantfile
chefignore
metadata.rb

README.md

backupninja Cookbook

The main highlights of this cookbook are the resources for managing backups. The following providers are currently implemented:

  • backupninja_rdiff: backup action for rdiff-backup (incremental backups)
  • backupninja_mysql: backup action for safe MySQL dumps
  • backupninja_pgsql: backup action for safe PostgreSQL dumps

Requirements

Chef version 0.11+

Platforms

  • Ubuntu

All other platforms are currently untested.

Resources/Providers

These resources aim to expose an abstraction layer for generating the ini-style configuration files necessary to configure a backup job in backupninja.

If you wish to install backupninja, add the included recipe[backupninja] to your runlist or wrapper cookbook.

backupninja

Generic backupninja resource. This resource contains all the generic configuration data available in all the backup job-specific resources. This resource is in charge of the file naming-scheme and the generation of the INI-file.

Actions
  • :create: create the ini file
  • :delete: removes the ini file
Attribute Parameters
  • name: name attribute. Short descriptive name that will be used in the filename.
  • priority
  • description
  • when_executed
  • type: the extension of the INI-file indication which procedure for backup will be used.
  • options: Hash of additional values to appear in the INI-file.

More information of about ordering, naming and scheduling can be found here.

The options hash will be heavily used by the job-specific resources to fill in their additional parameters.

Generation of these options depends on the class type of the hash value being used:

  • Value is of type Array: A seperate "key = item" line will be generated for each item in the array.
  • Value is of type Hash: the key will be used as a section [key] and the value should again be of type Hash. Everything in that hash will be generated as attributes inside this section.
  • Everything else will simply be generated as "key = value"

backupninja_rdiff

Rdiff-specific job to make remote, incremental backups of the filesystem.

Actions
  • :create: create the ini file
  • :delete: removes the ini file
Attribute Parameters

The following attribute parameters are present alongside those in the backupninja resource:

The source section:

  • source_label, String
  • source_type, String
  • source_keep, Integer
  • source_include, Array
  • source_exclude, Array

The dest (destination) section:

  • dest_type, String
  • dest_host, String
  • dest_directory, String
  • dest_user, String

More information about these attributes can be found here.

backupninja_mysql

MySQL-specific job to backup a mysql database using mysqldump.

Actions
  • :create: create the ini file
  • :delete: removes the ini file
Attribute Parameters

The following attribute parameters are present alongside those in the backupninja resource:

  • databases, String

  • backupdir, String

  • hotcopy, String

  • sqldump, String

  • sqldumpoptions, String

  • compress, String

  • nodata, String

  • vsname, String

  • user, String

  • dbusername, String

  • dbpassword, String

  • configfile, String

More information about these attributes can be found here.

backupninja_pgsql

PostgreSQL-specific job to backup a PostgreSQL database.

Actions
  • :create: create the ini file
  • :delete: removes the ini file
Attribute Parameters

The following attribute parameters are present alongside those in the backupninja resource:

  • databases, String
  • backupdir, String
  • compress, String
  • vsname, String

More information about these attributes can be found here.

Recipes

backupninja::default

Install and configure the backupninja daemon.

Key Type Description Default
['backupninja']['backupninja_package_name'] String Package name for backupninja 'backupninja'
['backupninja']['rdiff_backup_package_name'] String Package name for rdiff-backup 'rdiff-backup'
['backupninja']['loglevel'] Integer Verbosity level for logging:
  • 5: Debug and below
  • 4: Information and below
  • 3: Warnings and below
  • 2: Errors and below
  • 1: Fatal errors only
4
['backupninja']['reportemail'] String Backup summaries will be emailed to this address 'root'
['backupninja']['reportsuccess'] String When set to 'yes', a report email will be generated even if there was no error. 'yes'
['backupninja']['reportwarning'] String When set to 'yes', a report email will be generated even if there was no error. 'yes'
['backupninja']['logfile'] String All logs will be written to this file '/var/log/backupninja.log'
['backupninja']['configdirectory'] String Directory where all the backup configuration files live '/etc/backup.d'
['backupninja']['scriptdirectory'] String Where backupninja handler scripts are found /usr/share/backupninja'
['backupninja']['usecolors'] String Use colors in the log file 'yes'

backupninja::rdiff_backup_client

The recipe will install the rdiff-backup package and generates an ssh keypair for the root user. The generated public key will be saved as a node attribute (backupclient_pubkey) so the backup server knows which public ssh keys it should authorize.

Key Type Description Default
['backupninja']['rdiff_backup_package_name'] String Package name for rdiff-backup 'rdiff-backup'

backupninja::rdiff_backup_server

Use this recipe in the run list of the server that should receive the backups from the client.

Basically, it will create a backup user and allow him access to the backup location. An .ssh/authorized_keys will be generated based on the backupclient_pubkey attribute found on all nodes known to the Chef Server to allow all backup clients access to send their backups.

Key Type Description Default
['backupninja']['rdiff_backup_server_user'] String User used to connect to the backup server. 'backupuser'
['backupninja']['rdiff_backup_server_directory'] String Directory where backups will be kept '/backups'

Usage

backupninja::default

Installs and configures a backupninja daemon on the machine. No backup tasks are added.

e.g. Just include backupninja in your node's run_list:

{
  "name":"my_node",
  "run_list": [
    "recipe[backupninja]"
  ]
}

To Do

  • Make job-specific resources more DRY-er
  • Implement other job processes
  • Change all 'yes' attribute parameters from strings to booleans.
  • Ensure only one of three allowed authorization techniques in the MySQL job can be configured in a resource.

Contributing

  1. Fork the repository on Github
  2. Create a named feature branch (like add_component_x)
  3. Write your change
  4. Write tests for your change (if applicable)
  5. Run the tests, ensuring they all pass
  6. Submit a Pull Request using Github

License and Authors

Authors: Kevin Van Wilder kevin@van-wilder.be

You can’t perform that action at this time.