elzar 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.chef/knife.rb +3 -0
- data/.gitignore +1 -0
- data/.rvmrc +1 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +96 -0
- data/README.md +42 -0
- data/Rakefile +1 -0
- data/Vagrantfile +16 -0
- data/cookbooks/.gitkeep +0 -0
- data/cookbooks/apt/README.md +122 -0
- data/cookbooks/apt/files/default/apt-cacher +9 -0
- data/cookbooks/apt/files/default/apt-cacher.conf +144 -0
- data/cookbooks/apt/files/default/apt-proxy-v2.conf +50 -0
- data/cookbooks/apt/metadata.rb +13 -0
- data/cookbooks/apt/providers/repository.rb +73 -0
- data/cookbooks/apt/recipes/cacher-client.rb +44 -0
- data/cookbooks/apt/recipes/cacher.rb +45 -0
- data/cookbooks/apt/recipes/default.rb +50 -0
- data/cookbooks/apt/resources/repository.rb +30 -0
- data/cookbooks/build-essential/README.md +24 -0
- data/cookbooks/build-essential/metadata.rb +10 -0
- data/cookbooks/build-essential/recipes/default.rb +45 -0
- data/cookbooks/database/README.md +403 -0
- data/cookbooks/database/libraries/provider_database_mysql.rb +97 -0
- data/cookbooks/database/libraries/provider_database_mysql_user.rb +76 -0
- data/cookbooks/database/libraries/provider_database_postgresql.rb +126 -0
- data/cookbooks/database/libraries/provider_database_postgresql_user.rb +78 -0
- data/cookbooks/database/libraries/provider_database_sql_server.rb +109 -0
- data/cookbooks/database/libraries/provider_database_sql_server_user.rb +106 -0
- data/cookbooks/database/libraries/resource_database.rb +111 -0
- data/cookbooks/database/libraries/resource_database_user.rb +90 -0
- data/cookbooks/database/libraries/resource_mysql_database.rb +34 -0
- data/cookbooks/database/libraries/resource_mysql_database_user.rb +34 -0
- data/cookbooks/database/libraries/resource_postgresql_database.rb +35 -0
- data/cookbooks/database/libraries/resource_postgresql_database_user.rb +35 -0
- data/cookbooks/database/libraries/resource_sql_server_database.rb +34 -0
- data/cookbooks/database/libraries/resource_sql_server_database_user.rb +34 -0
- data/cookbooks/database/metadata.rb +21 -0
- data/cookbooks/database/recipes/default.rb +20 -0
- data/cookbooks/database/recipes/ebs_backup.rb +89 -0
- data/cookbooks/database/recipes/ebs_volume.rb +196 -0
- data/cookbooks/database/recipes/master.rb +78 -0
- data/cookbooks/database/recipes/snapshot.rb +62 -0
- data/cookbooks/database/templates/default/app_grants.sql.erb +8 -0
- data/cookbooks/database/templates/default/aws_config.erb +3 -0
- data/cookbooks/database/templates/default/chef-solo-database-snapshot.cron.erb +10 -0
- data/cookbooks/database/templates/default/chef-solo-database-snapshot.json.erb +1 -0
- data/cookbooks/database/templates/default/chef-solo-database-snapshot.rb.erb +6 -0
- data/cookbooks/database/templates/default/ebs-backup-cron.erb +2 -0
- data/cookbooks/database/templates/default/ebs-db-backup.sh.erb +8 -0
- data/cookbooks/database/templates/default/ebs-db-restore.sh.erb +10 -0
- data/cookbooks/database/templates/default/s3cfg.erb +27 -0
- data/cookbooks/mysql/README.md +148 -0
- data/cookbooks/mysql/attributes/server.rb +68 -0
- data/cookbooks/mysql/libraries/database.rb +19 -0
- data/cookbooks/mysql/libraries/helpers.rb +33 -0
- data/cookbooks/mysql/metadata.rb +90 -0
- data/cookbooks/mysql/recipes/client.rb +51 -0
- data/cookbooks/mysql/recipes/default.rb +20 -0
- data/cookbooks/mysql/recipes/server.rb +133 -0
- data/cookbooks/mysql/recipes/server_ec2.rb +49 -0
- data/cookbooks/mysql/templates/default/debian.cnf.erb +12 -0
- data/cookbooks/mysql/templates/default/grants.sql.erb +15 -0
- data/cookbooks/mysql/templates/default/my.cnf.erb +176 -0
- data/cookbooks/mysql/templates/default/mysql-server.seed.erb +10 -0
- data/cookbooks/mysql/templates/default/port_mysql.erb +3 -0
- data/cookbooks/openssl/README.md +37 -0
- data/cookbooks/openssl/libraries/secure_password.rb +37 -0
- data/cookbooks/openssl/metadata.rb +8 -0
- data/cookbooks/openssl/recipes/default.rb +19 -0
- data/cookbooks/passenger_enterprise/README.rdoc +8 -0
- data/cookbooks/passenger_enterprise/attributes/default.rb +28 -0
- data/cookbooks/passenger_enterprise/cc.gemspec +36 -0
- data/cookbooks/passenger_enterprise/metadata.json +44 -0
- data/cookbooks/passenger_enterprise/metadata.rb +16 -0
- data/cookbooks/passenger_enterprise/recipes/apache2.rb +54 -0
- data/cookbooks/passenger_enterprise/recipes/default.rb +30 -0
- data/cookbooks/passenger_enterprise/recipes/nginx.rb +50 -0
- data/cookbooks/passenger_enterprise/templates/default/passenger.conf.erb +2 -0
- data/cookbooks/passenger_enterprise/templates/default/passenger.load.erb +1 -0
- data/cookbooks/passenger_enterprise/templates/default/passenger_nginx.conf.erb +2 -0
- data/cookbooks/ruby_enterprise/README.rdoc +55 -0
- data/cookbooks/ruby_enterprise/attributes/default.rb +33 -0
- data/cookbooks/ruby_enterprise/cc.gemspec +36 -0
- data/cookbooks/ruby_enterprise/definitions/ree_gem.rb +28 -0
- data/cookbooks/ruby_enterprise/metadata.json +45 -0
- data/cookbooks/ruby_enterprise/metadata.rb +13 -0
- data/cookbooks/ruby_enterprise/recipes/default.rb +67 -0
- data/data_bags/deploy/authorized_keys.json +9 -0
- data/dna.json +25 -0
- data/elzar.gemspec +22 -0
- data/lib/elzar.rb +21 -0
- data/lib/elzar/assistant.rb +77 -0
- data/lib/elzar/chef_dna.rb +48 -0
- data/lib/elzar/template.rb +24 -0
- data/lib/elzar/templates/Gemfile +11 -0
- data/lib/elzar/templates/Vagrantfile.erb +16 -0
- data/lib/elzar/templates/dna.json +25 -0
- data/lib/elzar/templates/solo.rb.erb +6 -0
- data/lib/elzar/version.rb +3 -0
- data/roles/enterprise_appstack.rb +4 -0
- data/roles/plumbing.rb +11 -0
- data/roles/postgres_database.rb +4 -0
- data/roles/ruby_appstack.rb +4 -0
- data/script/install_cookbook +6 -0
- data/script/new_cookbook +5 -0
- data/site-cookbooks/.gitkeep +0 -0
- data/site-cookbooks/curl/README.md +17 -0
- data/site-cookbooks/curl/metadata.rb +6 -0
- data/site-cookbooks/curl/recipes/default.rb +11 -0
- data/site-cookbooks/nginx/CHANGELOG.md +11 -0
- data/site-cookbooks/nginx/CONTRIBUTING +29 -0
- data/site-cookbooks/nginx/LICENSE +201 -0
- data/site-cookbooks/nginx/README.md +76 -0
- data/site-cookbooks/nginx/attributes/default.rb +65 -0
- data/site-cookbooks/nginx/definitions/nginx_site.rb +35 -0
- data/site-cookbooks/nginx/files/default/mime.types +73 -0
- data/site-cookbooks/nginx/metadata.rb +89 -0
- data/site-cookbooks/nginx/recipes/default.rb +57 -0
- data/site-cookbooks/nginx/recipes/source.rb +126 -0
- data/site-cookbooks/nginx/templates/default/default-site.erb +11 -0
- data/site-cookbooks/nginx/templates/default/nginx.conf.erb +42 -0
- data/site-cookbooks/nginx/templates/default/nginx.init.erb +91 -0
- data/site-cookbooks/nginx/templates/default/nxdissite.erb +29 -0
- data/site-cookbooks/nginx/templates/default/nxensite.erb +38 -0
- data/site-cookbooks/passenger/README.md +12 -0
- data/site-cookbooks/passenger/attributes/default.rb +3 -0
- data/site-cookbooks/passenger/metadata.rb +6 -0
- data/site-cookbooks/passenger/recipes/default.rb +39 -0
- data/site-cookbooks/passenger/templates/default/passenger_nginx.conf.erb +2 -0
- data/site-cookbooks/postgresql/README.md +150 -0
- data/site-cookbooks/postgresql/attributes/default.rb +72 -0
- data/site-cookbooks/postgresql/metadata.rb +21 -0
- data/site-cookbooks/postgresql/recipes/client.rb +40 -0
- data/site-cookbooks/postgresql/recipes/default.rb +20 -0
- data/site-cookbooks/postgresql/recipes/server.rb +74 -0
- data/site-cookbooks/postgresql/recipes/server_debian.rb +62 -0
- data/site-cookbooks/postgresql/recipes/server_redhat.rb +82 -0
- data/site-cookbooks/postgresql/templates/default/debian.postgresql.conf.erb +499 -0
- data/site-cookbooks/postgresql/templates/default/pg_hba.conf.erb +83 -0
- data/site-cookbooks/postgresql/templates/default/redhat.postgresql.conf.erb +501 -0
- data/site-cookbooks/rails_app/README.md +15 -0
- data/site-cookbooks/rails_app/attributes/default.rb +2 -0
- data/site-cookbooks/rails_app/files/default/sudoers +26 -0
- data/site-cookbooks/rails_app/metadata.rb +6 -0
- data/site-cookbooks/rails_app/recipes/default.rb +143 -0
- data/site-cookbooks/rails_app/recipes/system_libraries.rb +12 -0
- data/site-cookbooks/rails_app/templates/default/pg_hba.conf.erb +84 -0
- data/site-cookbooks/rails_app/templates/default/rails_app_nginx.erb +10 -0
- data/site-cookbooks/ruby/README.md +12 -0
- data/site-cookbooks/ruby/attributes/default.rb +6 -0
- data/site-cookbooks/ruby/metadata.rb +6 -0
- data/site-cookbooks/ruby/recipes/default.rb +54 -0
- data/solo.rb +7 -0
- data/upgrade-chef.sh +8 -0
- metadata +272 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Author:: AJ Christensen (<aj@opscode.com>)
|
|
3
|
+
# Cookbook Name:: database
|
|
4
|
+
# Recipe:: snapshot
|
|
5
|
+
#
|
|
6
|
+
# Copyright 2009-2010, Opscode, Inc.
|
|
7
|
+
#
|
|
8
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
# you may not use this file except in compliance with the License.
|
|
10
|
+
# You may obtain a copy of the License at
|
|
11
|
+
#
|
|
12
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
#
|
|
14
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
# See the License for the specific language governing permissions and
|
|
18
|
+
# limitations under the License.
|
|
19
|
+
#
|
|
20
|
+
include_recipe "aws"
|
|
21
|
+
include_recipe "xfs"
|
|
22
|
+
|
|
23
|
+
%w{ebs_vol_dev db_role app_environment username password aws_access_key_id aws_secret_access_key snapshots_to_keep volume_id}.collect do |key|
|
|
24
|
+
Chef::Application.fatal!("Required db_snapshot configuration #{key} not found.", -47) unless node.db_snapshot.has_key? key
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
connection_info = {:host => localhost, :username => node.db_snapshot.username, :password => node.db_snapshot.password}
|
|
28
|
+
|
|
29
|
+
mysql_database "locking tables for #{node.db_snapshot.app_environment}" do
|
|
30
|
+
connection connection_info
|
|
31
|
+
sql "flush tables with read lock"
|
|
32
|
+
action :query
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
execute "xfs freeze" do
|
|
36
|
+
command "xfs_freeze -f #{node.db_snapshot.ebs_vol_dev}"
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
aws_ebs_volume "#{node.db_snapshot.db_role.first}_#{node.db_snapshot.app_environment}" do
|
|
40
|
+
aws_access_key node.db_snapshot.aws_access_key_id
|
|
41
|
+
aws_secret_access_key node.db_snapshot.aws_secret_access_key
|
|
42
|
+
size 50
|
|
43
|
+
device node.db_snapshot.ebs_vol_dev
|
|
44
|
+
snapshots_to_keep node.db_snapshot.snapshots_to_keep
|
|
45
|
+
action :snapshot
|
|
46
|
+
volume_id node.db_snapshot.volume_id
|
|
47
|
+
ignore_failure true # if this fails, continue to unfreeze and unlock
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
execute "xfs unfreeze" do
|
|
51
|
+
command "xfs_freeze -u #{node.db_snapshot.ebs_vol_dev}"
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
mysql_database "unflushing tables for #{node.db_snapshot.app_environment}" do
|
|
55
|
+
connection connection_info
|
|
56
|
+
sql "unlock tables"
|
|
57
|
+
action :query
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
aws_ebs_volume "#{node.db_snapshot.db_role.first}_#{node.db_snapshot.app_environment}" do
|
|
61
|
+
action :prune
|
|
62
|
+
end
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Generated by Chef. Local modifications will be overwritten.
|
|
2
|
+
<% @db_info.each do |env,db| -%>
|
|
3
|
+
# Privileges for databases in <%= env %>
|
|
4
|
+
GRANT ALL ON <%= db['database'] %>.* TO '<%= db['username'] %>'@'localhost' IDENTIFIED BY '<%= db['password'] %>';
|
|
5
|
+
GRANT ALL ON <%= db['database'] %>.* TO '<%= db['username'] %>'@'<%= node['fqdn'] %>' IDENTIFIED BY '<%= db['password'] %>';
|
|
6
|
+
GRANT ALL ON <%= db['database'] %>.* TO '<%= db['username'] %>'@'%' IDENTIFIED BY '<%= db['password'] %>';
|
|
7
|
+
<% end -%>
|
|
8
|
+
flush privileges;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Managed by Chef
|
|
2
|
+
# m h dom mon dow command
|
|
3
|
+
# Keep 1 day of hourly, 7 days of daily, 4 weeks of weekly and 1 year of monthly snapshots
|
|
4
|
+
PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
|
5
|
+
<% cs = "chef-solo -j #{@json_attribs} -c #{@config_file}" %>
|
|
6
|
+
00 * * * * root <%= cs %>
|
|
7
|
+
15 0 * * * root <%= cs %>
|
|
8
|
+
30 0 * * 0 root <%= cs %>
|
|
9
|
+
45 0 1 * * root <%= cs %>
|
|
10
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= require 'json'; JSON.pretty_generate(@output) %>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
#
|
|
3
|
+
# Restore a MySQL database from EBS
|
|
4
|
+
|
|
5
|
+
mkdir -p /mnt/restore
|
|
6
|
+
|
|
7
|
+
. /mnt/aws-config/config
|
|
8
|
+
|
|
9
|
+
/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
|
|
10
|
+
echo "done"
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[default]
|
|
2
|
+
access_key = <%= @aws['aws_access_key_id'] %>
|
|
3
|
+
acl_public = False
|
|
4
|
+
bucket_location = US
|
|
5
|
+
debug_syncmatch = False
|
|
6
|
+
default_mime_type = binary/octet-stream
|
|
7
|
+
delete_removed = False
|
|
8
|
+
dry_run = False
|
|
9
|
+
encrypt = False
|
|
10
|
+
force = False
|
|
11
|
+
gpg_command = /usr/bin/gpg
|
|
12
|
+
gpg_decrypt = %(gpg_command)s -d --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s
|
|
13
|
+
gpg_encrypt = %(gpg_command)s -c --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s
|
|
14
|
+
gpg_passphrase =
|
|
15
|
+
guess_mime_type = False
|
|
16
|
+
host_base = s3.amazonaws.com
|
|
17
|
+
host_bucket = %(bucket)s.s3.amazonaws.com
|
|
18
|
+
human_readable_sizes = False
|
|
19
|
+
preserve_attrs = True
|
|
20
|
+
proxy_host =
|
|
21
|
+
proxy_port = 0
|
|
22
|
+
recv_chunk = 4096
|
|
23
|
+
secret_key = <%= @aws['aws_secret_access_key'] %>
|
|
24
|
+
send_chunk = 4096
|
|
25
|
+
simpledb_host = sdb.amazonaws.com
|
|
26
|
+
use_https = True
|
|
27
|
+
verbosity = WARNING
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
Description
|
|
2
|
+
===========
|
|
3
|
+
|
|
4
|
+
Installs and configures MySQL client or server.
|
|
5
|
+
|
|
6
|
+
Requirements
|
|
7
|
+
============
|
|
8
|
+
|
|
9
|
+
Platform
|
|
10
|
+
--------
|
|
11
|
+
|
|
12
|
+
* Debian, Ubuntu
|
|
13
|
+
* CentOS, Red Hat, Fedora
|
|
14
|
+
|
|
15
|
+
Tested on:
|
|
16
|
+
|
|
17
|
+
* Debian 5.0
|
|
18
|
+
* Ubuntu 10.04
|
|
19
|
+
* CentOS 5.5
|
|
20
|
+
|
|
21
|
+
Cookbooks
|
|
22
|
+
---------
|
|
23
|
+
|
|
24
|
+
Requires Opscode's openssl cookbook for secure password generation.
|
|
25
|
+
|
|
26
|
+
Requires a C compiler and Ruby development package in order to build mysql gem with native extensions. On Debian and Ubuntu systems this is satisfied by installing the "build-essential" and "ruby-dev" packages before running Chef. See USAGE below for information on how to handle this during a Chef run.
|
|
27
|
+
|
|
28
|
+
Resources and Providers
|
|
29
|
+
=======================
|
|
30
|
+
|
|
31
|
+
The LWRP that used to ship as part of this cookbook has been refactored into the [database](https://github.com/opscode/cookbooks/tree/master/database) cookbook. Please see the README for details on updated usage.
|
|
32
|
+
|
|
33
|
+
Attributes
|
|
34
|
+
==========
|
|
35
|
+
|
|
36
|
+
* `mysql['server_root_password']` - Set the server's root password with this, default is a randomly generated password with `OpenSSL::Random.random_bytes`.
|
|
37
|
+
* `mysql['server_repl_password']` - Set the replication user 'repl' password with this, default is a randomly generated password with `OpenSSL::Random.random_bytes`.
|
|
38
|
+
* `mysql['server_debian_password']` - Set the debian-sys-maint user password with this, default is a randomly generated password with `OpenSSL::Random.random_bytes`.
|
|
39
|
+
* `mysql['bind_address']` - Listen address for MySQLd, default is node's ipaddress.
|
|
40
|
+
* `mysql['data_dir']` - Location for mysql data directory, default is "/var/lib/mysql"
|
|
41
|
+
* `mysql['conf_dir']` - Location for mysql conf directory, default is "/etc/mysql"
|
|
42
|
+
* `mysql['ec2_path']` - location of mysql data_dir on EC2 nodes, default "/mnt/mysql"
|
|
43
|
+
|
|
44
|
+
Performance tuning attributes, each corresponds to the same-named parameter in my.cnf; default values listed
|
|
45
|
+
|
|
46
|
+
* `mysql['tunable']['key_buffer']` = "250M"
|
|
47
|
+
* `mysql['tunable']['max_connections']` = "800"
|
|
48
|
+
* `mysql['tunable']['wait_timeout']` = "180"
|
|
49
|
+
* `mysql['tunable']['net_write_timeout']` = "30"
|
|
50
|
+
* `mysql['tunable']['net_write_timeout']` = "30"
|
|
51
|
+
* `mysql['tunable']['back_log']` = "128"
|
|
52
|
+
* `mysql['tunable']['table_cache']` = "128"
|
|
53
|
+
* `mysql['tunable']['max_heap_table_size']` = "32M"
|
|
54
|
+
* `mysql['tunable']['expire_logs_days']` = "10"
|
|
55
|
+
* `mysql['tunable']['max_binlog_size']` = "100M"
|
|
56
|
+
|
|
57
|
+
Usage
|
|
58
|
+
=====
|
|
59
|
+
|
|
60
|
+
On client nodes,
|
|
61
|
+
|
|
62
|
+
include_recipe "mysql::client"
|
|
63
|
+
|
|
64
|
+
This will install the MySQL client libraries and development headers on the system. It will also install the Ruby Gem `mysql`, so that the cookbook's LWRP (above) can be used. This is done during the compile-phase of the Chef run. On platforms that are known to have a native package (currently Debian, Ubuntu, Red hat, Centos, Fedora and SUSE), the package will be installed. Other platforms will use the RubyGem.
|
|
65
|
+
|
|
66
|
+
This creates a resource object for the package and does the installation before other recipes are parsed. You'll need to have the C compiler and such (ie, build-essential on Ubuntu) before running the recipes, but we already do that when installing Chef :-).
|
|
67
|
+
|
|
68
|
+
On server nodes,
|
|
69
|
+
|
|
70
|
+
include_recipe "mysql::server"
|
|
71
|
+
|
|
72
|
+
On Debian and Ubuntu, this will preseed the mysql-server package with the randomly generated root password from the attributes file. On other platforms, it simply installs the required packages. It will also create an SQL file, /etc/mysql/grants.sql, that will be used to set up grants for the root, repl and debian-sys-maint users.
|
|
73
|
+
|
|
74
|
+
On EC2 nodes,
|
|
75
|
+
|
|
76
|
+
include_recipe "mysql::server_ec2"
|
|
77
|
+
|
|
78
|
+
When the `ec2_path` doesn't exist we look for a mounted filesystem (eg, EBS) and move the data_dir there.
|
|
79
|
+
|
|
80
|
+
The client recipe is already included by server and 'default' recipes.
|
|
81
|
+
|
|
82
|
+
For more infromation on the compile vs execution phase of a Chef run:
|
|
83
|
+
|
|
84
|
+
* http://wiki.opscode.com/display/chef/Anatomy+of+a+Chef+Run
|
|
85
|
+
|
|
86
|
+
Changes/Roadmap
|
|
87
|
+
===============
|
|
88
|
+
|
|
89
|
+
### v1.2.2
|
|
90
|
+
|
|
91
|
+
* [COOK-826] mysql::server recipe doesn't quote password string
|
|
92
|
+
* [COOK-834] Add 'scientific' and 'amazon' platforms to mysql cookbook
|
|
93
|
+
|
|
94
|
+
### v1.2.1
|
|
95
|
+
|
|
96
|
+
* [COOK-644] Mysql client cookbook 'package missing' error message is confusing
|
|
97
|
+
* [COOK-645] RHEL6/CentOS6 - mysql cookbook contains 'skip-federated' directive which is unsupported on MySQL 5.1
|
|
98
|
+
|
|
99
|
+
### v1.2.0
|
|
100
|
+
|
|
101
|
+
* [COOK-684] remove mysql_database LWRP
|
|
102
|
+
|
|
103
|
+
### v1.0.8:
|
|
104
|
+
|
|
105
|
+
* [COOK-633] ensure "cloud" attribute is available
|
|
106
|
+
|
|
107
|
+
### v1.0.7:
|
|
108
|
+
|
|
109
|
+
* [COOK-614] expose all mysql tunable settings in config
|
|
110
|
+
* [COOK-617] bind to private IP if available
|
|
111
|
+
|
|
112
|
+
### v1.0.6:
|
|
113
|
+
|
|
114
|
+
* [COOK-605] install mysql-client package on ubuntu/debian
|
|
115
|
+
|
|
116
|
+
### v1.0.5:
|
|
117
|
+
|
|
118
|
+
* [COOK-465] allow optional remote root connections to mysql
|
|
119
|
+
* [COOK-455] improve platform version handling
|
|
120
|
+
* externalize conf_dir attribute for easier cross platform support
|
|
121
|
+
* change datadir attribute to data_dir for consistency
|
|
122
|
+
|
|
123
|
+
### v1.0.4:
|
|
124
|
+
|
|
125
|
+
* fix regressions on debian platform
|
|
126
|
+
* [COOK-578] wrap root password in quotes
|
|
127
|
+
* [COOK-562] expose all tunables in my.cnf
|
|
128
|
+
|
|
129
|
+
License and Author
|
|
130
|
+
==================
|
|
131
|
+
|
|
132
|
+
Author:: Joshua Timberman (<joshua@opscode.com>)
|
|
133
|
+
Author:: AJ Christensen (<aj@opscode.com>)
|
|
134
|
+
Author:: Seth Chisamore (<schisamo@opscode.com>)
|
|
135
|
+
|
|
136
|
+
Copyright:: 2009-2011 Opscode, Inc
|
|
137
|
+
|
|
138
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
139
|
+
you may not use this file except in compliance with the License.
|
|
140
|
+
You may obtain a copy of the License at
|
|
141
|
+
|
|
142
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
143
|
+
|
|
144
|
+
Unless required by applicable law or agreed to in writing, software
|
|
145
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
147
|
+
See the License for the specific language governing permissions and
|
|
148
|
+
limitations under the License.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Cookbook Name:: mysql
|
|
3
|
+
# Attributes:: server
|
|
4
|
+
#
|
|
5
|
+
# Copyright 2008-2009, Opscode, Inc.
|
|
6
|
+
#
|
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
# you may not use this file except in compliance with the License.
|
|
9
|
+
# You may obtain a copy of the License at
|
|
10
|
+
#
|
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
#
|
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
# See the License for the specific language governing permissions and
|
|
17
|
+
# limitations under the License.
|
|
18
|
+
#
|
|
19
|
+
|
|
20
|
+
default['mysql']['bind_address'] = attribute?('cloud') ? cloud['local_ipv4'] : ipaddress
|
|
21
|
+
default['mysql']['data_dir'] = "/var/lib/mysql"
|
|
22
|
+
|
|
23
|
+
case node["platform"]
|
|
24
|
+
when "centos", "redhat", "fedora", "suse", "scientific", "amazon"
|
|
25
|
+
set['mysql']['conf_dir'] = '/etc'
|
|
26
|
+
set['mysql']['socket'] = "/var/lib/mysql/mysql.sock"
|
|
27
|
+
set['mysql']['pid_file'] = "/var/run/mysqld/mysqld.pid"
|
|
28
|
+
set['mysql']['old_passwords'] = 1
|
|
29
|
+
else
|
|
30
|
+
set['mysql']['conf_dir'] = '/etc/mysql'
|
|
31
|
+
set['mysql']['socket'] = "/var/run/mysqld/mysqld.sock"
|
|
32
|
+
set['mysql']['pid_file'] = "/var/run/mysqld/mysqld.pid"
|
|
33
|
+
set['mysql']['old_passwords'] = 0
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
if attribute?('ec2')
|
|
37
|
+
default['mysql']['ec2_path'] = "/mnt/mysql"
|
|
38
|
+
default['mysql']['ebs_vol_dev'] = "/dev/sdi"
|
|
39
|
+
default['mysql']['ebs_vol_size'] = 50
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
default['mysql']['allow_remote_root'] = false
|
|
43
|
+
default['mysql']['tunable']['back_log'] = "128"
|
|
44
|
+
default['mysql']['tunable']['key_buffer'] = "256M"
|
|
45
|
+
default['mysql']['tunable']['max_allowed_packet'] = "16M"
|
|
46
|
+
default['mysql']['tunable']['max_connections'] = "800"
|
|
47
|
+
default['mysql']['tunable']['max_heap_table_size'] = "32M"
|
|
48
|
+
default['mysql']['tunable']['myisam_recover'] = "BACKUP"
|
|
49
|
+
default['mysql']['tunable']['net_read_timeout'] = "30"
|
|
50
|
+
default['mysql']['tunable']['net_write_timeout'] = "30"
|
|
51
|
+
default['mysql']['tunable']['table_cache'] = "128"
|
|
52
|
+
default['mysql']['tunable']['table_open_cache'] = "128"
|
|
53
|
+
default['mysql']['tunable']['thread_cache'] = "128"
|
|
54
|
+
default['mysql']['tunable']['thread_cache_size'] = 8
|
|
55
|
+
default['mysql']['tunable']['thread_concurrency'] = 10
|
|
56
|
+
default['mysql']['tunable']['thread_stack'] = "256K"
|
|
57
|
+
default['mysql']['tunable']['wait_timeout'] = "180"
|
|
58
|
+
|
|
59
|
+
default['mysql']['tunable']['query_cache_limit'] = "1M"
|
|
60
|
+
default['mysql']['tunable']['query_cache_size'] = "16M"
|
|
61
|
+
|
|
62
|
+
default['mysql']['tunable']['log_slow_queries'] = "/var/log/mysql/slow.log"
|
|
63
|
+
default['mysql']['tunable']['long_query_time'] = 2
|
|
64
|
+
|
|
65
|
+
default['mysql']['tunable']['expire_logs_days'] = 10
|
|
66
|
+
default['mysql']['tunable']['max_binlog_size'] = "100M"
|
|
67
|
+
|
|
68
|
+
default['mysql']['tunable']['innodb_buffer_pool_size'] = "256M"
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
begin
|
|
2
|
+
require 'mysql'
|
|
3
|
+
rescue LoadError
|
|
4
|
+
Chef::Log.info("Missing gem 'mysql'")
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
module Opscode
|
|
8
|
+
module Mysql
|
|
9
|
+
module Database
|
|
10
|
+
def db
|
|
11
|
+
@db ||= ::Mysql.new new_resource.host, new_resource.username, new_resource.password
|
|
12
|
+
end
|
|
13
|
+
def close
|
|
14
|
+
@db.close rescue nil
|
|
15
|
+
@db = nil
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Author:: Seth Chisamore (<schisamo@opscode.com>)
|
|
3
|
+
# Copyright:: Copyright (c) 2011 Opscode, Inc.
|
|
4
|
+
# License:: Apache License, Version 2.0
|
|
5
|
+
#
|
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
# you may not use this file except in compliance with the License.
|
|
8
|
+
# You may obtain a copy of the License at
|
|
9
|
+
#
|
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
#
|
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
# See the License for the specific language governing permissions and
|
|
16
|
+
# limitations under the License.
|
|
17
|
+
#
|
|
18
|
+
|
|
19
|
+
module Opscode
|
|
20
|
+
module Mysql
|
|
21
|
+
module Helpers
|
|
22
|
+
|
|
23
|
+
def debian_before_squeeze?
|
|
24
|
+
platform?("debian") && (node.platform_version.to_f < 6.0)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def ubuntu_before_lucid?
|
|
28
|
+
platform?("ubuntu") && (node.platform_version.to_f < 10.0)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
maintainer "Opscode, Inc."
|
|
2
|
+
maintainer_email "cookbooks@opscode.com"
|
|
3
|
+
license "Apache 2.0"
|
|
4
|
+
description "Installs and configures mysql for client or server"
|
|
5
|
+
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
|
6
|
+
version "1.2.2"
|
|
7
|
+
recipe "mysql", "Includes the client recipe to configure a client"
|
|
8
|
+
recipe "mysql::client", "Installs packages required for mysql clients using run_action magic"
|
|
9
|
+
recipe "mysql::server", "Installs packages required for mysql servers w/o manual intervention"
|
|
10
|
+
recipe "mysql::server_ec2", "Performs EC2-specific mountpoint manipulation"
|
|
11
|
+
|
|
12
|
+
%w{ debian ubuntu centos suse fedora redhat scientific amazon }.each do |os|
|
|
13
|
+
supports os
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
depends "openssl"
|
|
17
|
+
|
|
18
|
+
attribute "mysql/server_root_password",
|
|
19
|
+
:display_name => "MySQL Server Root Password",
|
|
20
|
+
:description => "Randomly generated password for the mysqld root user",
|
|
21
|
+
:default => "randomly generated"
|
|
22
|
+
|
|
23
|
+
attribute "mysql/bind_address",
|
|
24
|
+
:display_name => "MySQL Bind Address",
|
|
25
|
+
:description => "Address that mysqld should listen on",
|
|
26
|
+
:default => "ipaddress"
|
|
27
|
+
|
|
28
|
+
attribute "mysql/data_dir",
|
|
29
|
+
:display_name => "MySQL Data Directory",
|
|
30
|
+
:description => "Location of mysql databases",
|
|
31
|
+
:default => "/var/lib/mysql"
|
|
32
|
+
|
|
33
|
+
attribute "mysql/conf_dir",
|
|
34
|
+
:display_name => "MySQL Conf Directory",
|
|
35
|
+
:description => "Location of mysql conf files",
|
|
36
|
+
:default => "/etc/mysql"
|
|
37
|
+
|
|
38
|
+
attribute "mysql/ec2_path",
|
|
39
|
+
:display_name => "MySQL EC2 Path",
|
|
40
|
+
:description => "Location of mysql directory on EC2 instance EBS volumes",
|
|
41
|
+
:default => "/mnt/mysql"
|
|
42
|
+
|
|
43
|
+
attribute "mysql/tunable",
|
|
44
|
+
:display_name => "MySQL Tunables",
|
|
45
|
+
:description => "Hash of MySQL tunable attributes",
|
|
46
|
+
:type => "hash"
|
|
47
|
+
|
|
48
|
+
attribute "mysql/tunable/key_buffer",
|
|
49
|
+
:display_name => "MySQL Tuntable Key Buffer",
|
|
50
|
+
:default => "250M"
|
|
51
|
+
|
|
52
|
+
attribute "mysql/tunable/max_connections",
|
|
53
|
+
:display_name => "MySQL Tunable Max Connections",
|
|
54
|
+
:default => "800"
|
|
55
|
+
|
|
56
|
+
attribute "mysql/tunable/wait_timeout",
|
|
57
|
+
:display_name => "MySQL Tunable Wait Timeout",
|
|
58
|
+
:default => "180"
|
|
59
|
+
|
|
60
|
+
attribute "mysql/tunable/net_read_timeout",
|
|
61
|
+
:display_name => "MySQL Tunable Net Read Timeout",
|
|
62
|
+
:default => "30"
|
|
63
|
+
|
|
64
|
+
attribute "mysql/tunable/net_write_timeout",
|
|
65
|
+
:display_name => "MySQL Tunable Net Write Timeout",
|
|
66
|
+
:default => "30"
|
|
67
|
+
|
|
68
|
+
attribute "mysql/tunable/back_log",
|
|
69
|
+
:display_name => "MySQL Tunable Back Log",
|
|
70
|
+
:default => "128"
|
|
71
|
+
|
|
72
|
+
attribute "mysql/tunable/table_cache",
|
|
73
|
+
:display_name => "MySQL Tunable Table Cache for MySQL < 5.1.3",
|
|
74
|
+
:default => "128"
|
|
75
|
+
|
|
76
|
+
attribute "mysql/tunable/table_open_cache",
|
|
77
|
+
:display_name => "MySQL Tunable Table Cache for MySQL >= 5.1.3",
|
|
78
|
+
:default => "128"
|
|
79
|
+
|
|
80
|
+
attribute "mysql/tunable/max_heap_table_size",
|
|
81
|
+
:display_name => "MySQL Tunable Max Heap Table Size",
|
|
82
|
+
:default => "32M"
|
|
83
|
+
|
|
84
|
+
attribute "mysql/tunable/expire_logs_days",
|
|
85
|
+
:display_name => "MySQL Exipre Log Days",
|
|
86
|
+
:default => "10"
|
|
87
|
+
|
|
88
|
+
attribute "mysql/tunable/max_binlog_size",
|
|
89
|
+
:display_name => "MySQL Max Binlog Size",
|
|
90
|
+
:default => "100M"
|