Created
October 12, 2012 05:02
-
-
Save smith/3877421 to your computer and use it in GitHub Desktop.
Backup Gem With Chef
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example of what integration of the backup gem with chef could look like | |
backup 'my app' do | |
# The stuff here (taken from https://github.com/meskyanichi/backup) would be | |
# passed into the backup gem with class_eval or something. In a real recipe | |
# most of these variables would be replaced by | |
# node or other attributes, so: | |
# | |
# backup 'my app' do => Backup::Model.new(:"my app", 'my app') do... | |
split_into_chunks_of 4000 | |
database MySQL do |database| | |
database.name = 'my_sample_mysql_db' | |
database.username = 'my_username' | |
database.password = 'my_password' | |
database.skip_tables = ['logs'] | |
database.additional_options = ['--single-transaction', '--quick'] | |
end | |
archive :user_avatars do |archive| | |
archive.add '/var/apps/my_sample_app/public/avatars' | |
end | |
# ...and so on. Anything in a backup LWRP call would be passed directly into a | |
# backup model. | |
# The backup gem doesn't do scheduling, so this part would be translated into | |
# a chef cron resource call: | |
schedule do | |
hour 12 | |
minute 0 | |
end | |
end | |
~ | |
~ ~ | |
~ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment