elzar 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- 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,51 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook Name:: mysql
|
3
|
+
# Recipe:: client
|
4
|
+
#
|
5
|
+
# Copyright 2008-2011, 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
|
+
::Chef::Resource::Package.send(:include, Opscode::Mysql::Helpers)
|
21
|
+
|
22
|
+
package "mysql-client" do
|
23
|
+
package_name value_for_platform(
|
24
|
+
[ "centos", "redhat", "suse", "fedora", "scientific", "amazon"] => { "default" => "mysql" },
|
25
|
+
"default" => "mysql-client"
|
26
|
+
)
|
27
|
+
action :install
|
28
|
+
end
|
29
|
+
|
30
|
+
package "mysql-devel" do
|
31
|
+
package_name begin
|
32
|
+
if platform?(%w{ centos redhat suse fedora scientific amazon })
|
33
|
+
"mysql-devel"
|
34
|
+
elsif debian_before_squeeze? || ubuntu_before_lucid?
|
35
|
+
"libmysqlclient15-dev"
|
36
|
+
else
|
37
|
+
"libmysqlclient-dev"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
action :install
|
41
|
+
end
|
42
|
+
|
43
|
+
if platform?(%w{ redhat centos fedora suse scientific amazon })
|
44
|
+
package 'ruby-mysql'
|
45
|
+
elsif platform?(%w{ debian ubuntu })
|
46
|
+
package "libmysql-ruby"
|
47
|
+
else
|
48
|
+
gem_package "mysql" do
|
49
|
+
action :install
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook Name:: mysql
|
3
|
+
# Recipe:: default
|
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
|
+
include_recipe "mysql::client"
|
@@ -0,0 +1,133 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook Name:: mysql
|
3
|
+
# Recipe:: default
|
4
|
+
#
|
5
|
+
# Copyright 2008-2011, 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
|
+
::Chef::Recipe.send(:include, Opscode::OpenSSL::Password)
|
21
|
+
|
22
|
+
include_recipe "mysql::client"
|
23
|
+
|
24
|
+
# generate all passwords
|
25
|
+
node.set_unless['mysql']['server_debian_password'] = secure_password
|
26
|
+
node.set_unless['mysql']['server_root_password'] = secure_password
|
27
|
+
node.set_unless['mysql']['server_repl_password'] = secure_password
|
28
|
+
|
29
|
+
if platform?(%w{debian ubuntu})
|
30
|
+
|
31
|
+
directory "/var/cache/local/preseeding" do
|
32
|
+
owner "root"
|
33
|
+
group "root"
|
34
|
+
mode 0755
|
35
|
+
recursive true
|
36
|
+
end
|
37
|
+
|
38
|
+
execute "preseed mysql-server" do
|
39
|
+
command "debconf-set-selections /var/cache/local/preseeding/mysql-server.seed"
|
40
|
+
action :nothing
|
41
|
+
end
|
42
|
+
|
43
|
+
template "/var/cache/local/preseeding/mysql-server.seed" do
|
44
|
+
source "mysql-server.seed.erb"
|
45
|
+
owner "root"
|
46
|
+
group "root"
|
47
|
+
mode "0600"
|
48
|
+
notifies :run, resources(:execute => "preseed mysql-server"), :immediately
|
49
|
+
end
|
50
|
+
|
51
|
+
template "#{node['mysql']['conf_dir']}/debian.cnf" do
|
52
|
+
source "debian.cnf.erb"
|
53
|
+
owner "root"
|
54
|
+
group "root"
|
55
|
+
mode "0600"
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
package "mysql-server" do
|
61
|
+
action :install
|
62
|
+
end
|
63
|
+
|
64
|
+
service "mysql" do
|
65
|
+
service_name value_for_platform([ "centos", "redhat", "suse", "fedora", "scientific", "amazon" ] => {"default" => "mysqld"}, "default" => "mysql")
|
66
|
+
if (platform?("ubuntu") && node.platform_version.to_f >= 10.04)
|
67
|
+
restart_command "restart mysql"
|
68
|
+
stop_command "stop mysql"
|
69
|
+
start_command "start mysql"
|
70
|
+
end
|
71
|
+
supports :status => true, :restart => true, :reload => true
|
72
|
+
action :nothing
|
73
|
+
end
|
74
|
+
|
75
|
+
skip_federated = case node['platform']
|
76
|
+
when 'fedora', 'ubuntu', 'amazon'
|
77
|
+
true
|
78
|
+
when 'centos', 'redhat', 'scientific'
|
79
|
+
node['platform_version'].to_f < 6.0
|
80
|
+
else
|
81
|
+
false
|
82
|
+
end
|
83
|
+
|
84
|
+
template "#{node['mysql']['conf_dir']}/my.cnf" do
|
85
|
+
source "my.cnf.erb"
|
86
|
+
owner "root"
|
87
|
+
group "root"
|
88
|
+
mode "0644"
|
89
|
+
notifies :restart, resources(:service => "mysql"), :immediately
|
90
|
+
variables :skip_federated => skip_federated
|
91
|
+
end
|
92
|
+
|
93
|
+
unless Chef::Config[:solo]
|
94
|
+
ruby_block "save node data" do
|
95
|
+
block do
|
96
|
+
node.save
|
97
|
+
end
|
98
|
+
action :create
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
# set the root password on platforms
|
103
|
+
# that don't support pre-seeding
|
104
|
+
unless platform?(%w{debian ubuntu})
|
105
|
+
|
106
|
+
execute "assign-root-password" do
|
107
|
+
command "/usr/bin/mysqladmin -u root password \"#{node['mysql']['server_root_password']}\""
|
108
|
+
action :run
|
109
|
+
only_if "/usr/bin/mysql -u root -e 'show databases;'"
|
110
|
+
end
|
111
|
+
|
112
|
+
end
|
113
|
+
|
114
|
+
grants_path = "#{node['mysql']['conf_dir']}/mysql_grants.sql"
|
115
|
+
|
116
|
+
begin
|
117
|
+
t = resources("template[#{grants_path}]")
|
118
|
+
rescue
|
119
|
+
Chef::Log.info("Could not find previously defined grants.sql resource")
|
120
|
+
t = template grants_path do
|
121
|
+
source "grants.sql.erb"
|
122
|
+
owner "root"
|
123
|
+
group "root"
|
124
|
+
mode "0600"
|
125
|
+
action :create
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
execute "mysql-install-privileges" do
|
130
|
+
command "/usr/bin/mysql -u root #{node['mysql']['server_root_password'].empty? ? '' : '-p' }\"#{node['mysql']['server_root_password']}\" < #{grants_path}"
|
131
|
+
action :nothing
|
132
|
+
subscribes :run, resources("template[#{grants_path}]"), :immediately
|
133
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook Name:: mysql
|
3
|
+
# Recipe:: default
|
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
|
+
|
21
|
+
if (node.attribute?('ec2') && ! FileTest.directory?(node['mysql']['ec2_path']))
|
22
|
+
|
23
|
+
service "mysql" do
|
24
|
+
action :stop
|
25
|
+
end
|
26
|
+
|
27
|
+
execute "install-mysql" do
|
28
|
+
command "mv #{node['mysql']['data_dir']} #{node['mysql']['ec2_path']}"
|
29
|
+
not_if do FileTest.directory?(node['mysql']['ec2_path']) end
|
30
|
+
end
|
31
|
+
|
32
|
+
directory node['mysql']['ec2_path'] do
|
33
|
+
owner "mysql"
|
34
|
+
group "mysql"
|
35
|
+
end
|
36
|
+
|
37
|
+
mount node['mysql']['data_dir'] do
|
38
|
+
device node['mysql']['ec2_path']
|
39
|
+
fstype "none"
|
40
|
+
options "bind,rw"
|
41
|
+
action :mount
|
42
|
+
end
|
43
|
+
|
44
|
+
service "mysql" do
|
45
|
+
action :start
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
@@ -0,0 +1,12 @@
|
|
1
|
+
[client]
|
2
|
+
host = localhost
|
3
|
+
user = debian-sys-maint
|
4
|
+
password = <%= node['mysql']['server_debian_password'] %>
|
5
|
+
socket = <%= node['mysql']['socket'] %>
|
6
|
+
|
7
|
+
[mysql_upgrade]
|
8
|
+
host = localhost
|
9
|
+
user = debian-sys-maint
|
10
|
+
password = <%= node['mysql']['server_debian_password'] %>
|
11
|
+
socket = <%= node['mysql']['socket'] %>
|
12
|
+
basedir = /usr
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# Generated by Chef for <%= node['hostname'] %>.
|
2
|
+
# Local modifications will be overwritten.
|
3
|
+
|
4
|
+
<% case node['platform'] -%>
|
5
|
+
<% when "debian","ubuntu" -%>
|
6
|
+
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY '<%= node[:mysql][:server_debian_password] %>' WITH GRANT OPTION;
|
7
|
+
<% end -%>
|
8
|
+
# Grant replication for a slave user.
|
9
|
+
GRANT REPLICATION SLAVE ON *.* TO 'repl'@'%' identified by '<%= node['mysql']['server_repl_password'] %>';
|
10
|
+
|
11
|
+
# Set the server root password. This should be preseeded by the package installation.
|
12
|
+
<% if node['mysql']['allow_remote_root'] -%>
|
13
|
+
GRANT ALL ON *.* TO 'root'@'%' IDENTIFIED BY '<%= node['mysql']['server_root_password'] %>' WITH GRANT OPTION;
|
14
|
+
<% end -%>
|
15
|
+
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('<%= node['mysql']['server_root_password'] %>');
|
@@ -0,0 +1,176 @@
|
|
1
|
+
#
|
2
|
+
# Generated by Chef for <%= node['hostname'] %>
|
3
|
+
#
|
4
|
+
# Local modifications will be overwritten.
|
5
|
+
#
|
6
|
+
# The MySQL database server configuration file.
|
7
|
+
#
|
8
|
+
# You can copy this to one of:
|
9
|
+
# - "/etc/mysql/my.cnf" to set global options,
|
10
|
+
# - "~/.my.cnf" to set user-specific options.
|
11
|
+
#
|
12
|
+
# One can use all long options that the program supports.
|
13
|
+
# Run program with --help to get a list of available options and with
|
14
|
+
# --print-defaults to see which it would actually understand and use.
|
15
|
+
#
|
16
|
+
# For explanations see
|
17
|
+
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
|
18
|
+
|
19
|
+
# This will be passed to all mysql clients
|
20
|
+
# It has been reported that passwords should be enclosed with ticks/quotes
|
21
|
+
# escpecially if they contain "#" chars...
|
22
|
+
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
|
23
|
+
[client]
|
24
|
+
port = 3306
|
25
|
+
socket = <%= node['mysql']['socket'] %>
|
26
|
+
|
27
|
+
# Here is entries for some specific programs
|
28
|
+
# The following values assume you have at least 32M ram
|
29
|
+
|
30
|
+
# This was formally known as [safe_mysqld]. Both versions are currently parsed.
|
31
|
+
[mysqld_safe]
|
32
|
+
socket = <%= node['mysql']['socket'] %>
|
33
|
+
nice = 0
|
34
|
+
|
35
|
+
[mysqld]
|
36
|
+
#
|
37
|
+
# * Basic Settings
|
38
|
+
#
|
39
|
+
|
40
|
+
#
|
41
|
+
# * IMPORTANT
|
42
|
+
# If you make changes to these settings and your system uses apparmor, you may
|
43
|
+
# also need to also adjust /etc/apparmor.d/usr.sbin.mysqld.
|
44
|
+
#
|
45
|
+
|
46
|
+
user = mysql
|
47
|
+
pid-file = <%= node['mysql']['pid_file'] %>
|
48
|
+
socket = <%= node['mysql']['socket'] %>
|
49
|
+
port = 3306
|
50
|
+
basedir = /usr
|
51
|
+
datadir = <%= node['mysql']['data_dir'] %>
|
52
|
+
tmpdir = /tmp
|
53
|
+
skip-external-locking
|
54
|
+
#
|
55
|
+
# Instead of skip-networking the default is now to listen only on
|
56
|
+
# localhost which is more compatible and is not less secure.
|
57
|
+
bind-address = <%= node['mysql']['bind_address'] %>
|
58
|
+
#
|
59
|
+
# * Fine Tuning
|
60
|
+
#
|
61
|
+
key_buffer = <%= node['mysql']['tunable']['key_buffer'] %>
|
62
|
+
max_allowed_packet = <%= node['mysql']['tunable']['max_allowed_packet'] %>
|
63
|
+
thread_stack = <%= node['mysql']['tunable']['thread_stack'] %>
|
64
|
+
thread_cache_size = <%= node['mysql']['tunable']['thread_cache_size'] %>
|
65
|
+
# This replaces the startup script and checks MyISAM tables if needed
|
66
|
+
# the first time they are touched
|
67
|
+
myisam-recover = BACKUP
|
68
|
+
#max_connections = 100
|
69
|
+
#table_cache = 64
|
70
|
+
#thread_concurrency = 10
|
71
|
+
max_connections = <%= node['mysql']['tunable']['max_connections'] %>
|
72
|
+
wait_timeout = <%= node['mysql']['tunable']['wait_timeout'] %>
|
73
|
+
net_read_timeout = <%= node['mysql']['tunable']['net_read_timeout'] %>
|
74
|
+
net_write_timeout = <%= node['mysql']['tunable']['net_write_timeout'] %>
|
75
|
+
back_log = <%= node['mysql']['tunable']['back_log'] %>
|
76
|
+
table_cache = <%= node['mysql']['tunable']['table_cache'] %>
|
77
|
+
max_heap_table_size = <%= node['mysql']['tunable']['max_heap_table_size'] %>
|
78
|
+
|
79
|
+
#
|
80
|
+
# * Query Cache Configuration
|
81
|
+
#
|
82
|
+
query_cache_limit = <%= node['mysql']['tunable']['query_cache_limit'] %>
|
83
|
+
query_cache_size = <%= node['mysql']['tunable']['query_cache_size'] %>
|
84
|
+
#
|
85
|
+
# * Logging and Replication
|
86
|
+
#
|
87
|
+
# Both location gets rotated by the cronjob.
|
88
|
+
# Be aware that this log type is a performance killer.
|
89
|
+
#log = /var/log/mysql/mysql.log
|
90
|
+
#
|
91
|
+
# Error logging goes to syslog. This is a Debian improvement :)
|
92
|
+
#
|
93
|
+
# Here you can see queries with especially long duration
|
94
|
+
log_slow_queries = <%= node['mysql']['tunable']['log_slow_queries'] %>
|
95
|
+
long_query_time = <%= node['mysql']['tunable']['long_query_time'] %>
|
96
|
+
log-queries-not-using-indexes
|
97
|
+
#
|
98
|
+
# The following can be used as easy to replay backup logs or for replication.
|
99
|
+
# note: if you are setting up a replication slave, see README.Debian about
|
100
|
+
# other settings you may need to change.
|
101
|
+
#server-id = 1
|
102
|
+
#log_bin = /var/log/mysql/mysql-bin.log
|
103
|
+
expire_logs_days = <%= node['mysql']['tunable']['expire_logs_days'] %>
|
104
|
+
max_binlog_size = <%= node['mysql']['tunable']['max_binlog_size'] %>
|
105
|
+
#binlog_do_db = include_database_name
|
106
|
+
#binlog_ignore_db = include_database_name
|
107
|
+
#
|
108
|
+
# * InnoDB
|
109
|
+
#
|
110
|
+
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
|
111
|
+
# Read the manual for more InnoDB related options. There are many!
|
112
|
+
# You might want to disable InnoDB to shrink the mysqld process by circa 100MB.
|
113
|
+
#skip-innodb
|
114
|
+
innodb_buffer_pool_size = <%= node['mysql']['tunable']['innodb_buffer_pool_size'] %>
|
115
|
+
|
116
|
+
<% if @skip_federated %>
|
117
|
+
#
|
118
|
+
# * Federated
|
119
|
+
#
|
120
|
+
# The FEDERATED storage engine is disabled since 5.0.67 by default in the .cnf files
|
121
|
+
# shipped with MySQL distributions (my-huge.cnf, my-medium.cnf, and so forth).
|
122
|
+
#
|
123
|
+
skip-federated
|
124
|
+
<% end %>
|
125
|
+
#
|
126
|
+
# * Security Features
|
127
|
+
#
|
128
|
+
# Read the manual, too, if you want chroot!
|
129
|
+
# chroot = /var/lib/mysql/
|
130
|
+
#
|
131
|
+
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
|
132
|
+
#
|
133
|
+
# ssl-ca=/etc/mysql/cacert.pem
|
134
|
+
# ssl-cert=/etc/mysql/server-cert.pem
|
135
|
+
# ssl-key=/etc/mysql/server-key.pem
|
136
|
+
|
137
|
+
[mysqldump]
|
138
|
+
quick
|
139
|
+
quote-names
|
140
|
+
max_allowed_packet = <%= node['mysql']['tunable']['max_allowed_packet'] %>
|
141
|
+
|
142
|
+
[mysql]
|
143
|
+
#no-auto-rehash # faster start of mysql but no tab completition
|
144
|
+
|
145
|
+
[isamchk]
|
146
|
+
key_buffer = <%= node['mysql']['tunable']['max_allowed_packet'] %>
|
147
|
+
|
148
|
+
#
|
149
|
+
# * NDB Cluster
|
150
|
+
#
|
151
|
+
# See /usr/share/doc/mysql-server-*/README.Debian for more information.
|
152
|
+
#
|
153
|
+
# The following configuration is read by the NDB Data Nodes (ndbd processes)
|
154
|
+
# not from the NDB Management Nodes (ndb_mgmd processes).
|
155
|
+
#
|
156
|
+
# [MYSQL_CLUSTER]
|
157
|
+
# ndb-connectstring=127.0.0.1
|
158
|
+
|
159
|
+
<% case node['platform'] -%>
|
160
|
+
<% when "centos", "redhat", "fedora", "suse", "scientific", "amazon"-%>
|
161
|
+
#
|
162
|
+
# * BerkeleyDB
|
163
|
+
#
|
164
|
+
# Using BerkeleyDB is now discouraged as its support will cease in 5.1.12.
|
165
|
+
skip-bdb
|
166
|
+
# Default to using old password format for compatibility with mysql 3.x
|
167
|
+
# clients (those using the mysqlclient10 compatibility package).
|
168
|
+
old_passwords = <%= node['mysql']['old_passwords'] %>
|
169
|
+
|
170
|
+
<% else -%>
|
171
|
+
#
|
172
|
+
# * IMPORTANT: Additional settings that can override those from this file!
|
173
|
+
# The files must end with '.cnf', otherwise they'll be ignored.
|
174
|
+
#
|
175
|
+
!includedir /etc/mysql/conf.d/
|
176
|
+
<% end -%>
|