Initial Chef repository
This commit is contained in:
8
cookbooks/database/templates/default/app_grants.sql.erb
Normal file
8
cookbooks/database/templates/default/app_grants.sql.erb
Normal file
@@ -0,0 +1,8 @@
|
||||
# Generated by Chef. Local modifications will be overwritten.
|
||||
<% @db_info.each do |env,db| -%>
|
||||
# Privileges for databases in <%= env %>
|
||||
GRANT ALL ON <%= db['database'] %>.* TO '<%= db['username'] %>'@'localhost' IDENTIFIED BY '<%= db['password'] %>';
|
||||
GRANT ALL ON <%= db['database'] %>.* TO '<%= db['username'] %>'@'<%= node['fqdn'] %>' IDENTIFIED BY '<%= db['password'] %>';
|
||||
GRANT ALL ON <%= db['database'] %>.* TO '<%= db['username'] %>'@'%' IDENTIFIED BY '<%= db['password'] %>';
|
||||
<% end -%>
|
||||
flush privileges;
|
||||
3
cookbooks/database/templates/default/aws_config.erb
Normal file
3
cookbooks/database/templates/default/aws_config.erb
Normal file
@@ -0,0 +1,3 @@
|
||||
AWS_ACCESS_KEY_ID=<%= @access_key %>
|
||||
AWS_SECRET_ACCESS_KEY=<%= @secret_key %>
|
||||
BUCKET_BASE_NAME=db-backups
|
||||
@@ -0,0 +1,6 @@
|
||||
# Managed by Chef
|
||||
# m h dom mon dow command
|
||||
# Keep 1 day of hourly snapshots
|
||||
PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||
<% cs = "chef-solo -j #{@json_attribs} -c #{@config_file}" %>
|
||||
<%= @schedule %> root <%= cs %>
|
||||
@@ -0,0 +1 @@
|
||||
<%= require 'json'; JSON.pretty_generate(@output) %>
|
||||
@@ -0,0 +1,6 @@
|
||||
executable_path ENV['PATH'] ? ENV['PATH'].split(File::PATH_SEPARATOR) : []
|
||||
<% if @cookbook_path.is_a? Array %>
|
||||
cookbook_path [ <%= @cookbook_path.collect { |cb| "\"#{cb}\""}.join(", ") -%> ]
|
||||
<% else %>
|
||||
cookbook_path "<%= @cookbook_path -%>"
|
||||
<% end %>
|
||||
2
cookbooks/database/templates/default/ebs-backup-cron.erb
Normal file
2
cookbooks/database/templates/default/ebs-backup-cron.erb
Normal file
@@ -0,0 +1,2 @@
|
||||
# Chef Name: ebs_db_backup
|
||||
15 0 * * * root /usr/local/bin/db-backup.sh
|
||||
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Back up a MySQL database via EBS snapshot
|
||||
|
||||
. /mnt/aws-config/config
|
||||
|
||||
/opt/ec2_mysql/bin/ec2_mysql -a $AWS_ACCESS_KEY_ID -s $AWS_SECRET_ACCESS_KEY -p '<%= @mysql_root_passwd %>' -k 5 master
|
||||
echo "done"
|
||||
10
cookbooks/database/templates/default/ebs-db-restore.sh.erb
Normal file
10
cookbooks/database/templates/default/ebs-db-restore.sh.erb
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Restore a MySQL database from EBS
|
||||
|
||||
mkdir -p /mnt/restore
|
||||
|
||||
. /mnt/aws-config/config
|
||||
|
||||
/opt/ec2_mysql/bin/ec2_mysql -a $AWS_ACCESS_KEY_ID -s $AWS_SECRET_ACCESS_KEY -p '<%= @mysql_root_password %>' -v '<%= @ebs_vol_id %>' -m /mnt/restore -d <%= @mysql_device %> -r <%= @mysql_device %> -l debug -n slave
|
||||
echo "done"
|
||||
27
cookbooks/database/templates/default/s3cfg.erb
Normal file
27
cookbooks/database/templates/default/s3cfg.erb
Normal file
@@ -0,0 +1,27 @@
|
||||
[default]
|
||||
access_key = <%= @aws['aws_access_key_id'] %>
|
||||
acl_public = False
|
||||
bucket_location = US
|
||||
debug_syncmatch = False
|
||||
default_mime_type = binary/octet-stream
|
||||
delete_removed = False
|
||||
dry_run = False
|
||||
encrypt = False
|
||||
force = False
|
||||
gpg_command = /usr/bin/gpg
|
||||
gpg_decrypt = %(gpg_command)s -d --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s
|
||||
gpg_encrypt = %(gpg_command)s -c --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s
|
||||
gpg_passphrase =
|
||||
guess_mime_type = False
|
||||
host_base = s3.amazonaws.com
|
||||
host_bucket = %(bucket)s.s3.amazonaws.com
|
||||
human_readable_sizes = False
|
||||
preserve_attrs = True
|
||||
proxy_host =
|
||||
proxy_port = 0
|
||||
recv_chunk = 4096
|
||||
secret_key = <%= @aws['aws_secret_access_key'] %>
|
||||
send_chunk = 4096
|
||||
simpledb_host = sdb.amazonaws.com
|
||||
use_https = True
|
||||
verbosity = WARNING
|
||||
Reference in New Issue
Block a user