Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

RSS

backup (14) Versions 1.1.2

Installs/Configures backup

Berkshelf/Librarian
Policyfile
Knife
cookbook 'backup', '= 1.1.2'
cookbook 'backup', '= 1.1.2', :supermarket
knife cookbook site install backup
knife cookbook site download backup
README
Dependencies
Changelog
Quality 0%

Build Status

Description

Uses the Backup Ruby Gem to perform backups.

Requirements

Tested on Ubuntu Linux with Ruby 1.9.3, but should run on any Unix with Ruby.

Ruby 1.8.7 and 1.9.2 are no longer supported. If you require the support of older Ruby versions, you should use v1.0.0 of this cookbook. If you want to use v4 of the gem, you need to use this version.

Attributes

See attributes/default.rb for default vaules.

  • node['backup']['config_path'] - Where backup configuration data will be stored. Defaults is /etc/backup
  • node['backup']['log_path'] - Where backup logs will be stored. Defaults is /var/log
  • node['backup']['model_path'] - Where backup models (definitions) are stored. Default is node['backup']['config_path']/models
  • node['backup']['dependencies'] - An array of arrays of additional dependencies and optional versions needed for backups. The backup gem will inform you about these when the backup runs. (examples: ['fog'], [['fog', '1.4.0'], ['s3']])
  • node['backup']['user'] - User that performs backups. Default is root
  • node['backup']['group'] - Group that performs backups. Default is root
  • node['backup']['version'] - Version of the Backup gem to be installed. The latest version of this cookbook should have the latest stable version of the gem
  • node['backup']['server'] - Data about a centralized backup server. Used by the backup_mount resource. Default is an empty hash.
  • node['backup']['server']['address'] - Address of the backup server.
  • node['backup']['server']['root_path'] - Root path on the server where backups go.

Recipes

default

The default recipe installs the backup gem and its dependencies and sets up the basic configuration.

Resources and Providers

backup_model

Creates a backup model with an optional cron schedule.

Actions

  • :create - Create a model. The default.
  • :delete - Delete a model

Attribute Parameters

  • The name attribute - A symbol used as the trigger name.
  • description - A description for the backup. Default is the same as the name.
  • definition - A string (best formed as a heredoc) defining the backup. Will be interpoleted and turned into a model file. Required.
  • schedule - A hash of times (minute, hour, day, month, weekday) that will be passed to a cron resource.
  • cron_options - A hash of other options to be passed to the cron resource. Includes :command (will be set to the generated backup command by default), :mailto, :path, :shell, :user. Set output_log option to redirect output of the generated backup command to the log file (by default this output will be ignored).

Example

This will create a model scheduled to back up a database daily:

backup_model :my_db do
  description "Back up my database"

  definition <<-DEF
    split_into_chunks_of 4000

    database MySQL do |db|
      db.name = 'mydb'
      db.username = 'myuser'
      db.password = '#{node['mydb']['password']}' # will be interpolated
    end

    compress_with Gzip

    store_with S3 do |s3|
      s3.access_key_id = '#{node['aws']['access_key_id']}'
      s3.secret_access_key = '#{node['aws']['secret_access_key']}'
      s3.bucket = 'mybucket'
    end
  DEF

  schedule({
    :minute => 0,
    :hour   => 0
  })
end

backup_mount

Defines an NFS mount to be used for backup storage and creates the necessary directories. Uses the node['backup']['server'] attributes.

This fits a specific use case and may or may not be useful. It is intended to be used with the RSync::Local syncer and Local storage option.

Actions

  • :enable - Enables and mounts the device
  • :disable - Disables and unmounts the device

Attribute Parameters

  • Name attribute: The path where the mount will be placed.
  • remote_path: The path being accessed on the remote server

Example

Given the following attributes:

  • node['backup']['server']['address'] = '192.168.0.2'
  • node['backup']['server']['root_path'] = 'volume1'

And this in the recipe:

backup_mount '/mnt/backup/myapp' do
  remote_path '/backups/myapp' # Will be prefixed with with the `node['backup']['server']['root_path']` if it is set.
end

will create an NFS mount at /mnt/backup/myapp with the device 192.168.0.2:/volume1/backups/myapp.

Backup Cookbook Changelog

v1.1.2: 2014-10-20

  • Fix for device_name in mount provider

v1.1.1: 2014-08-28

  • Add support for cron home option

v1.1.0: 2014-08-11

  • Allow installation of backup gem from a git repository

v1.0.0: 2014-06-28

  • Upgrade to v4.0.1 of backup gem

v0.4.0: 2014-02-17

  • Make Travis builds work
  • Do not create cron job in model provider if no schedule is given
  • Redirect output of the generated command to the log file if it is specified in cron\_options

v0.3.2: 2014-01-02

  • Allow for model names with dashes
  • Fix path in model provider's delete action

v0.3.1: 2013-09-25

  • Fix typo in README
  • Fix some bugs in templating

v0.3.0: 2013-07-31

  • Add changelog
  • Travis CI support
  • Foodcrititc and basic testing support
  • Attribute to optionally upgrade backup gem
  • Use a template for backup model output
  • Various other cleanup items

v0.2.0: 2013-04-10

  • Add cron_options
  • Pipe cron output to /dev/null

v0.1.0: 2013-03-27

  • Initial release

Foodcritic Metric
            

1.1.2 failed this metric

FC017: LWRP does not notify when updated: /tmp/cook/fecc09d268e0b32d0c34ef4b/backup/providers/model.rb:6
FC017: LWRP does not notify when updated: /tmp/cook/fecc09d268e0b32d0c34ef4b/backup/providers/model.rb:52
FC017: LWRP does not notify when updated: /tmp/cook/fecc09d268e0b32d0c34ef4b/backup/providers/mount.rb:6
FC017: LWRP does not notify when updated: /tmp/cook/fecc09d268e0b32d0c34ef4b/backup/providers/mount.rb:25