This cookbook aims to provide a foundation for you to backup your infrastructure. This cookbook helps you deploy the backup gem and generate the models to back up.
Ruby installed either in the system or via omnibus
Generates a model file for the backup gem and creates a cron entry.
Actions:
create
- Generate a model filedisable
- Disable the scheduled cron for the modelremove
- Remove the model from the system and the scheduled cron.
Attribute Parameters:
split_into_chunks_of
- Fixnum - defaults to 250description
- String - Description of backupdefinition
- String - Definition of the backup in backup languagehour
- String - Hour to run the scheduled backup - default -1
minute
- String - Minute to run the scheduled backup - default -*
day
- String - Day to run the scheduled backup - default -*
weekday
- String - Weekday to run the scheduled backup - default -*
mailto
- String - Enables the cron resource to mail the output of the backup output.user
- String - User used to launch backup
There is an ininite ways you can implement this cookbook into your environment in theory. An working example might be,
- Backing up MySQL to S3
include_recipe "backup"
backup_model :my_db do
description "Back up my database"
definition <<-EOH
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
EOH
mailto "[email protected]"
action :create
end
Author:: Scott Likens ([email protected])
Copyright 2012, Scott M. Likens, 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.
Thank You Heavy Water for contributing the original backup cookbook.