Skip to content

Instantly share code, notes, and snippets.

@tzusman
Created September 30, 2011 17:46
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save tzusman/1254466 to your computer and use it in GitHub Desktop.
Chef Recipe for MySQL backups to Amazon's S3
#
# Cookbook Name:: s3_backups
# Recipe:: default
# Author:: Todd Zusman (toddzusman.com)
#
execute "apt-get update" do
action :nothing
end
apt_repository "s3cmd" do
uri "http://s3tools.org/repo/deb-all"
components ["stable/"]
key "http://s3tools.org/repo/deb-all/stable/s3tools.key"
action :add
notifies :run, "execute[apt-get update]", :immediately
end
package "s3cmd" do
action :install
end
directory "/root/mysql_backups" do
owner "root"
group "root"
mode "0600"
action :create
end
cookbook_file "/root/.s3cfg" do
source "s3cfg"
mode 0400
owner "root"
group "root"
end
cookbook_file "/root/backup_mysql_to_s3.sh" do
source "backup_mysql_to_s3.sh"
mode 0500
owner "root"
group "root"
end
cron "run_s3_backup" do
minute "0"
hour "3"
day "*"
month "*"
weekday "*"
user "root"
command "/root/backup_mysql_to_s3.sh"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment