cookbook 'backupninja', '~> 0.1.0'
backupninja (1) Versions 0.1.0 Follow0
Installs/Configures backupninja
cookbook 'backupninja', '~> 0.1.0', :supermarket
knife supermarket install backupninja
knife supermarket download backupninja
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
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
, Stringuser
, Stringdbusername
, Stringdbpassword
, Stringconfigfile
, String
More information about these attributes can be found here.
Attributes
backupninja::default
Install and configure the backupninja daemon.
<table>
<tr>
<th>Key</th>
<th>Type</th>
<th>Description</th>
<th>Default</th>
</tr>
<tr>
<td><tt>['backupninja']['backupninja_package_name']</tt></td>
<td>String</td>
<td>Package name for backupninja</td>
<td><tt>'backupninja'</tt></td>
</tr>
<tr>
<td><tt>['backupninja']['rdiff_backup_package_name']</tt></td>
<td>String</td>
<td>Package name for rdiff-backup</td>
<td><tt>'rdiff-backup'</tt></td>
</tr>
<tr>
<td><tt>['backupninja']['loglevel']</tt></td>
<td>Integer</td>
<td>
Verbosity level for logging:
<ul>
<li>5: Debug and below</li>
<li>4: Information and below</li>
<li>3: Warnings and below</li>
<li>2: Errors and below</li>
<li>1: Fatal errors only</li>
</ul>
</td>
<td><tt>4</tt></td>
</tr>
<tr>
<td><tt>['backupninja']['reportemail']</tt></td>
<td>String</td>
<td>Backup summaries will be emailed to this address</td>
<td><tt>'root'</tt></td>
</tr>
<tr>
<td><tt>['backupninja']['reportsuccess']</tt></td>
<td>String</td>
<td>When set to 'yes', a report email will be generated even
if there was no error.</td>
<td><tt>'yes'</tt></td>
</tr>
<tr>
<td><tt>['backupninja']['reportwarning']</tt></td>
<td>String</td>
<td>When set to 'yes', a report email will be generated even
if there was no error.</td>
<td><tt>'yes'</tt></td>
</tr>
<tr>
<td><tt>['backupninja']['logfile']</tt></td>
<td>String</td>
<td>All logs will be written to this file</td>
<td><tt>'/var/log/backupninja.log'</tt></td>
</tr>
<tr>
<td><tt>['backupninja']['configdirectory']</tt></td>
<td>String</td>
<td>Directory where all the backup configuration files live</td>
<td><tt>'/etc/backup.d'</tt></td>
</tr>
<tr>
<td><tt>['backupninja']['scriptdirectory']</tt></td>
<td>String</td>
<td>Where backupninja handler scripts are found</td>
<td><tt>/usr/share/backupninja'</tt></td>
</tr>
<tr>
<td><tt>['backupninja']['usecolors']</tt></td>
<td>String</td>
<td>Use colors in the log file</td>
<td><tt>'yes'</tt></td>
</tr>
</table>
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.
<table>
<tr>
<th>Key</th>
<th>Type</th>
<th>Description</th>
<th>Default</th>
</tr>
<tr>
<td><tt>['backupninja']['rdiff_backup_package_name']</tt></td>
<td>String</td>
<td>Package name for rdiff-backup</td>
<td><tt>'rdiff-backup'</tt></td>
</tr>
</table>
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.
<table>
<tr>
<th>Key</th>
<th>Type</th>
<th>Description</th>
<th>Default</th>
</tr>
<tr>
<td><tt>['backupninja']['rdiff_backup_server_user']</tt></td>
<td>String</td>
<td>User used to connect to the backup server.</td>
<td><tt>'backupuser'</tt></td>
</tr>
<tr>
<td><tt>['backupninja']['rdiff_backup_server_directory']</tt></td>
<td>String</td>
<td>Directory where backups will be kept</td>
<td><tt>'/backups'</tt></td>
</tr>
</table>
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
- Fork the repository on Github
- Create a named feature branch (like
add_component_x
) - Write your change
- Write tests for your change (if applicable)
- Run the tests, ensuring they all pass
- Submit a Pull Request using Github
License and Authors
Authors: Kevin Van Wilder kevin@van-wilder.be
Dependent cookbooks
This cookbook has no specified dependencies.
Contingent cookbooks
There are no cookbooks that are contingent upon this one.
backupninja CHANGELOG
This file is used to list changes made in each version of the backupninja cookbook.
0.1.0
- [your_name] - Initial release of backupninja
Check the Markdown Syntax Guide for help with Markdown.
The Github Flavored Markdown page describes the differences between markdown on github and standard markdown.
Collaborator Number Metric
0.1.0 failed this metric
Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.
Contributing File Metric
0.1.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Foodcritic Metric
0.1.0 failed this metric
FC008: Generated cookbook metadata needs updating: backupninja/metadata.rb:2
FC008: Generated cookbook metadata needs updating: backupninja/metadata.rb:3
FC009: Resource attribute not recognised: backupninja/recipes/rdiff_backup_server.rb:17
FC064: Ensure issues_url is set in metadata: backupninja/metadata.rb:1
FC065: Ensure source_url is set in metadata: backupninja/metadata.rb:1
FC066: Ensure chef_version is set in metadata: backupninja/metadata.rb:1
FC067: Ensure at least one platform supported in metadata: backupninja/metadata.rb:1
FC075: Cookbook uses node.save to save partial node data to the chef-server mid-run: backupninja/recipes/_sshkeypair.rb:52
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
No Binaries Metric
0.1.0 passed this metric
Testing File Metric
0.1.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
0.1.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
0.1.0 failed this metric
0.1.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Foodcritic Metric
0.1.0 failed this metric
FC008: Generated cookbook metadata needs updating: backupninja/metadata.rb:2
FC008: Generated cookbook metadata needs updating: backupninja/metadata.rb:3
FC009: Resource attribute not recognised: backupninja/recipes/rdiff_backup_server.rb:17
FC064: Ensure issues_url is set in metadata: backupninja/metadata.rb:1
FC065: Ensure source_url is set in metadata: backupninja/metadata.rb:1
FC066: Ensure chef_version is set in metadata: backupninja/metadata.rb:1
FC067: Ensure at least one platform supported in metadata: backupninja/metadata.rb:1
FC075: Cookbook uses node.save to save partial node data to the chef-server mid-run: backupninja/recipes/_sshkeypair.rb:52
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
No Binaries Metric
0.1.0 passed this metric
Testing File Metric
0.1.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
0.1.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
0.1.0 failed this metric
FC008: Generated cookbook metadata needs updating: backupninja/metadata.rb:3
FC009: Resource attribute not recognised: backupninja/recipes/rdiff_backup_server.rb:17
FC064: Ensure issues_url is set in metadata: backupninja/metadata.rb:1
FC065: Ensure source_url is set in metadata: backupninja/metadata.rb:1
FC066: Ensure chef_version is set in metadata: backupninja/metadata.rb:1
FC067: Ensure at least one platform supported in metadata: backupninja/metadata.rb:1
FC075: Cookbook uses node.save to save partial node data to the chef-server mid-run: backupninja/recipes/_sshkeypair.rb:52
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
0.1.0 passed this metric
Testing File Metric
0.1.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
0.1.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
0.1.0 failed this metric
0.1.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number