fast_food 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (236) hide show
  1. data/.gitignore +17 -0
  2. data/Gemfile +4 -0
  3. data/LICENSE.txt +22 -0
  4. data/README.md +73 -0
  5. data/Rakefile +8 -0
  6. data/chef/.chef/bootstrap/chef-solo.erb +27 -0
  7. data/chef/.chef/knife.rb +8 -0
  8. data/chef/.gitignore +1 -0
  9. data/chef/README +3 -0
  10. data/chef/cookbooks/README +1 -0
  11. data/chef/cookbooks/apache2/.gitignore +1 -0
  12. data/chef/cookbooks/apache2/CHANGELOG.md +81 -0
  13. data/chef/cookbooks/apache2/CONTRIBUTING +29 -0
  14. data/chef/cookbooks/apache2/Gemfile +10 -0
  15. data/chef/cookbooks/apache2/LICENSE +201 -0
  16. data/chef/cookbooks/apache2/README.md +373 -0
  17. data/chef/cookbooks/apache2/attributes/default.rb +149 -0
  18. data/chef/cookbooks/apache2/attributes/mod_auth_openid.rb +32 -0
  19. data/chef/cookbooks/apache2/definitions/apache_conf.rb +26 -0
  20. data/chef/cookbooks/apache2/definitions/apache_module.rb +53 -0
  21. data/chef/cookbooks/apache2/definitions/apache_site.rb +43 -0
  22. data/chef/cookbooks/apache2/definitions/web_app.rb +49 -0
  23. data/chef/cookbooks/apache2/files/default/apache2_module_conf_generate.pl +41 -0
  24. data/chef/cookbooks/apache2/files/default/tests/minitest/default_test.rb +64 -0
  25. data/chef/cookbooks/apache2/files/default/tests/minitest/helpers.rb +36 -0
  26. data/chef/cookbooks/apache2/files/default/tests/minitest/mod_auth_openid_test.rb +25 -0
  27. data/chef/cookbooks/apache2/files/default/tests/minitest/mod_dav_svn_test.rb +16 -0
  28. data/chef/cookbooks/apache2/files/default/tests/minitest/mod_perl_test.rb +22 -0
  29. data/chef/cookbooks/apache2/files/default/tests/minitest/mod_php5_test.rb +19 -0
  30. data/chef/cookbooks/apache2/files/default/tests/minitest/mod_python_test.rb +14 -0
  31. data/chef/cookbooks/apache2/files/default/tests/minitest/mod_ssl_test.rb +19 -0
  32. data/chef/cookbooks/apache2/files/default/tests/minitest/mod_wsgi_test.rb +14 -0
  33. data/chef/cookbooks/apache2/files/default/tests/minitest/mod_xsendfile_test.rb +14 -0
  34. data/chef/cookbooks/apache2/files/default/tests/minitest/modules_test.rb +19 -0
  35. data/chef/cookbooks/apache2/metadata.json +511 -0
  36. data/chef/cookbooks/apache2/metadata.rb +205 -0
  37. data/chef/cookbooks/apache2/recipes/default.rb +221 -0
  38. data/chef/cookbooks/apache2/recipes/god_monitor.rb +33 -0
  39. data/chef/cookbooks/apache2/recipes/mod_alias.rb +22 -0
  40. data/chef/cookbooks/apache2/recipes/mod_apreq2.rb +45 -0
  41. data/chef/cookbooks/apache2/recipes/mod_auth_basic.rb +20 -0
  42. data/chef/cookbooks/apache2/recipes/mod_auth_digest.rb +20 -0
  43. data/chef/cookbooks/apache2/recipes/mod_auth_openid.rb +113 -0
  44. data/chef/cookbooks/apache2/recipes/mod_authn_file.rb +20 -0
  45. data/chef/cookbooks/apache2/recipes/mod_authnz_ldap.rb +20 -0
  46. data/chef/cookbooks/apache2/recipes/mod_authz_default.rb +20 -0
  47. data/chef/cookbooks/apache2/recipes/mod_authz_groupfile.rb +20 -0
  48. data/chef/cookbooks/apache2/recipes/mod_authz_host.rb +20 -0
  49. data/chef/cookbooks/apache2/recipes/mod_authz_user.rb +20 -0
  50. data/chef/cookbooks/apache2/recipes/mod_autoindex.rb +22 -0
  51. data/chef/cookbooks/apache2/recipes/mod_cgi.rb +20 -0
  52. data/chef/cookbooks/apache2/recipes/mod_dav.rb +20 -0
  53. data/chef/cookbooks/apache2/recipes/mod_dav_fs.rb +20 -0
  54. data/chef/cookbooks/apache2/recipes/mod_dav_svn.rb +29 -0
  55. data/chef/cookbooks/apache2/recipes/mod_deflate.rb +22 -0
  56. data/chef/cookbooks/apache2/recipes/mod_dir.rb +22 -0
  57. data/chef/cookbooks/apache2/recipes/mod_env.rb +20 -0
  58. data/chef/cookbooks/apache2/recipes/mod_expires.rb +20 -0
  59. data/chef/cookbooks/apache2/recipes/mod_fastcgi.rb +26 -0
  60. data/chef/cookbooks/apache2/recipes/mod_fcgid.rb +53 -0
  61. data/chef/cookbooks/apache2/recipes/mod_headers.rb +20 -0
  62. data/chef/cookbooks/apache2/recipes/mod_ldap.rb +20 -0
  63. data/chef/cookbooks/apache2/recipes/mod_log_config.rb +24 -0
  64. data/chef/cookbooks/apache2/recipes/mod_logio.rb +24 -0
  65. data/chef/cookbooks/apache2/recipes/mod_mime.rb +22 -0
  66. data/chef/cookbooks/apache2/recipes/mod_negotiation.rb +22 -0
  67. data/chef/cookbooks/apache2/recipes/mod_perl.rb +39 -0
  68. data/chef/cookbooks/apache2/recipes/mod_php5.rb +99 -0
  69. data/chef/cookbooks/apache2/recipes/mod_proxy.rb +22 -0
  70. data/chef/cookbooks/apache2/recipes/mod_proxy_ajp.rb +21 -0
  71. data/chef/cookbooks/apache2/recipes/mod_proxy_balancer.rb +20 -0
  72. data/chef/cookbooks/apache2/recipes/mod_proxy_connect.rb +20 -0
  73. data/chef/cookbooks/apache2/recipes/mod_proxy_http.rb +20 -0
  74. data/chef/cookbooks/apache2/recipes/mod_python.rb +32 -0
  75. data/chef/cookbooks/apache2/recipes/mod_rewrite.rb +20 -0
  76. data/chef/cookbooks/apache2/recipes/mod_setenvif.rb +22 -0
  77. data/chef/cookbooks/apache2/recipes/mod_ssl.rb +43 -0
  78. data/chef/cookbooks/apache2/recipes/mod_status.rb +22 -0
  79. data/chef/cookbooks/apache2/recipes/mod_wsgi.rb +27 -0
  80. data/chef/cookbooks/apache2/recipes/mod_xsendfile.rb +27 -0
  81. data/chef/cookbooks/apache2/templates/default/a2dismod.erb +22 -0
  82. data/chef/cookbooks/apache2/templates/default/a2dissite.erb +29 -0
  83. data/chef/cookbooks/apache2/templates/default/a2enmod.erb +37 -0
  84. data/chef/cookbooks/apache2/templates/default/a2ensite.erb +38 -0
  85. data/chef/cookbooks/apache2/templates/default/apache2.conf.erb +237 -0
  86. data/chef/cookbooks/apache2/templates/default/apache2.god.erb +19 -0
  87. data/chef/cookbooks/apache2/templates/default/charset.erb +6 -0
  88. data/chef/cookbooks/apache2/templates/default/default-site.erb +57 -0
  89. data/chef/cookbooks/apache2/templates/default/mods/README +2 -0
  90. data/chef/cookbooks/apache2/templates/default/mods/alias.conf.erb +24 -0
  91. data/chef/cookbooks/apache2/templates/default/mods/authopenid.load.erb +1 -0
  92. data/chef/cookbooks/apache2/templates/default/mods/autoindex.conf.erb +101 -0
  93. data/chef/cookbooks/apache2/templates/default/mods/deflate.conf.erb +16 -0
  94. data/chef/cookbooks/apache2/templates/default/mods/dir.conf.erb +5 -0
  95. data/chef/cookbooks/apache2/templates/default/mods/fastcgi.conf.erb +5 -0
  96. data/chef/cookbooks/apache2/templates/default/mods/fcgid.conf.erb +10 -0
  97. data/chef/cookbooks/apache2/templates/default/mods/mime.conf.erb +198 -0
  98. data/chef/cookbooks/apache2/templates/default/mods/negotiation.conf.erb +18 -0
  99. data/chef/cookbooks/apache2/templates/default/mods/php5.conf.erb +16 -0
  100. data/chef/cookbooks/apache2/templates/default/mods/proxy.conf.erb +19 -0
  101. data/chef/cookbooks/apache2/templates/default/mods/setenvif.conf.erb +28 -0
  102. data/chef/cookbooks/apache2/templates/default/mods/ssl.conf.erb +76 -0
  103. data/chef/cookbooks/apache2/templates/default/mods/status.conf.erb +26 -0
  104. data/chef/cookbooks/apache2/templates/default/port_apache.erb +2 -0
  105. data/chef/cookbooks/apache2/templates/default/ports.conf.erb +6 -0
  106. data/chef/cookbooks/apache2/templates/default/security.erb +50 -0
  107. data/chef/cookbooks/apache2/templates/default/web_app.conf.erb +43 -0
  108. data/chef/cookbooks/build-essential/.gitignore +4 -0
  109. data/chef/cookbooks/build-essential/CHANGELOG.md +31 -0
  110. data/chef/cookbooks/build-essential/CONTRIBUTING +29 -0
  111. data/chef/cookbooks/build-essential/Gemfile +3 -0
  112. data/chef/cookbooks/build-essential/LICENSE +201 -0
  113. data/chef/cookbooks/build-essential/README.md +129 -0
  114. data/chef/cookbooks/build-essential/attributes/default.rb +33 -0
  115. data/chef/cookbooks/build-essential/metadata.json +41 -0
  116. data/chef/cookbooks/build-essential/metadata.rb +14 -0
  117. data/chef/cookbooks/build-essential/recipes/default.rb +92 -0
  118. data/chef/cookbooks/database/.gitignore +1 -0
  119. data/chef/cookbooks/database/CHANGELOG.md +46 -0
  120. data/chef/cookbooks/database/CONTRIBUTING +29 -0
  121. data/chef/cookbooks/database/LICENSE +201 -0
  122. data/chef/cookbooks/database/README.md +468 -0
  123. data/chef/cookbooks/database/libraries/provider_database_mysql.rb +103 -0
  124. data/chef/cookbooks/database/libraries/provider_database_mysql_user.rb +76 -0
  125. data/chef/cookbooks/database/libraries/provider_database_postgresql.rb +131 -0
  126. data/chef/cookbooks/database/libraries/provider_database_postgresql_user.rb +83 -0
  127. data/chef/cookbooks/database/libraries/provider_database_sql_server.rb +109 -0
  128. data/chef/cookbooks/database/libraries/provider_database_sql_server_user.rb +106 -0
  129. data/chef/cookbooks/database/libraries/resource_database.rb +119 -0
  130. data/chef/cookbooks/database/libraries/resource_database_user.rb +90 -0
  131. data/chef/cookbooks/database/libraries/resource_mysql_database.rb +34 -0
  132. data/chef/cookbooks/database/libraries/resource_mysql_database_user.rb +34 -0
  133. data/chef/cookbooks/database/libraries/resource_postgresql_database.rb +35 -0
  134. data/chef/cookbooks/database/libraries/resource_postgresql_database_user.rb +35 -0
  135. data/chef/cookbooks/database/libraries/resource_sql_server_database.rb +34 -0
  136. data/chef/cookbooks/database/libraries/resource_sql_server_database_user.rb +34 -0
  137. data/chef/cookbooks/database/metadata.json +45 -0
  138. data/chef/cookbooks/database/metadata.rb +22 -0
  139. data/chef/cookbooks/database/recipes/default.rb +20 -0
  140. data/chef/cookbooks/database/recipes/ebs_backup.rb +89 -0
  141. data/chef/cookbooks/database/recipes/ebs_volume.rb +204 -0
  142. data/chef/cookbooks/database/recipes/master.rb +78 -0
  143. data/chef/cookbooks/database/recipes/mysql.rb +20 -0
  144. data/chef/cookbooks/database/recipes/postgresql.rb +20 -0
  145. data/chef/cookbooks/database/recipes/snapshot.rb +62 -0
  146. data/chef/cookbooks/database/templates/default/app_grants.sql.erb +8 -0
  147. data/chef/cookbooks/database/templates/default/aws_config.erb +3 -0
  148. data/chef/cookbooks/database/templates/default/chef-solo-database-snapshot.cron.erb +6 -0
  149. data/chef/cookbooks/database/templates/default/chef-solo-database-snapshot.json.erb +1 -0
  150. data/chef/cookbooks/database/templates/default/chef-solo-database-snapshot.rb.erb +6 -0
  151. data/chef/cookbooks/database/templates/default/ebs-backup-cron.erb +2 -0
  152. data/chef/cookbooks/database/templates/default/ebs-db-backup.sh.erb +8 -0
  153. data/chef/cookbooks/database/templates/default/ebs-db-restore.sh.erb +10 -0
  154. data/chef/cookbooks/database/templates/default/s3cfg.erb +27 -0
  155. data/chef/cookbooks/fast_food/recipes/default.rb +24 -0
  156. data/chef/cookbooks/fast_food/recipes/site.rb +7 -0
  157. data/chef/cookbooks/fast_food/templates/default/web_app.conf.erb +43 -0
  158. data/chef/cookbooks/git/CHANGELOG.md +49 -0
  159. data/chef/cookbooks/git/CONTRIBUTING +29 -0
  160. data/chef/cookbooks/git/LICENSE +201 -0
  161. data/chef/cookbooks/git/README.md +115 -0
  162. data/chef/cookbooks/git/attributes/default.rb +37 -0
  163. data/chef/cookbooks/git/metadata.json +48 -0
  164. data/chef/cookbooks/git/metadata.rb +20 -0
  165. data/chef/cookbooks/git/recipes/default.rb +46 -0
  166. data/chef/cookbooks/git/recipes/server.rb +38 -0
  167. data/chef/cookbooks/git/recipes/source.rb +48 -0
  168. data/chef/cookbooks/git/recipes/windows.rb +32 -0
  169. data/chef/cookbooks/git/templates/default/sv-git-daemon-log-run.erb +2 -0
  170. data/chef/cookbooks/git/templates/default/sv-git-daemon-run.erb +3 -0
  171. data/chef/cookbooks/imagemagick/README.md +57 -0
  172. data/chef/cookbooks/imagemagick/metadata.json +37 -0
  173. data/chef/cookbooks/imagemagick/metadata.rb +14 -0
  174. data/chef/cookbooks/imagemagick/recipes/default.rb +25 -0
  175. data/chef/cookbooks/imagemagick/recipes/devel.rb +32 -0
  176. data/chef/cookbooks/imagemagick/recipes/rmagick.rb +22 -0
  177. data/chef/cookbooks/mysql/.gitignore +5 -0
  178. data/chef/cookbooks/mysql/CHANGELOG.md +125 -0
  179. data/chef/cookbooks/mysql/CONTRIBUTING +29 -0
  180. data/chef/cookbooks/mysql/Gemfile +8 -0
  181. data/chef/cookbooks/mysql/LICENSE +201 -0
  182. data/chef/cookbooks/mysql/README.md +227 -0
  183. data/chef/cookbooks/mysql/attributes/client.rb +50 -0
  184. data/chef/cookbooks/mysql/attributes/server.rb +240 -0
  185. data/chef/cookbooks/mysql/files/default/tests/minitest/server_test.rb +36 -0
  186. data/chef/cookbooks/mysql/files/default/tests/minitest/support/helpers.rb +11 -0
  187. data/chef/cookbooks/mysql/libraries/helpers.rb +33 -0
  188. data/chef/cookbooks/mysql/metadata.json +418 -0
  189. data/chef/cookbooks/mysql/metadata.rb +140 -0
  190. data/chef/cookbooks/mysql/recipes/client.rb +59 -0
  191. data/chef/cookbooks/mysql/recipes/default.rb +20 -0
  192. data/chef/cookbooks/mysql/recipes/ruby.rb +36 -0
  193. data/chef/cookbooks/mysql/recipes/server.rb +221 -0
  194. data/chef/cookbooks/mysql/recipes/server_ec2.rb +51 -0
  195. data/chef/cookbooks/mysql/templates/default/debian.cnf.erb +12 -0
  196. data/chef/cookbooks/mysql/templates/default/grants.sql.erb +15 -0
  197. data/chef/cookbooks/mysql/templates/default/my.cnf.erb +312 -0
  198. data/chef/cookbooks/mysql/templates/default/mysql-server.seed.erb +10 -0
  199. data/chef/cookbooks/mysql/templates/default/port_mysql.erb +3 -0
  200. data/chef/cookbooks/mysql/templates/windows/my.cnf.erb +61 -0
  201. data/chef/cookbooks/openssl/README.md +37 -0
  202. data/chef/cookbooks/openssl/libraries/secure_password.rb +37 -0
  203. data/chef/cookbooks/openssl/metadata.json +30 -0
  204. data/chef/cookbooks/openssl/metadata.rb +8 -0
  205. data/chef/cookbooks/openssl/recipes/default.rb +19 -0
  206. data/chef/cookbooks/passenger_apache2/.gitignore +4 -0
  207. data/chef/cookbooks/passenger_apache2/CHANGELOG.md +29 -0
  208. data/chef/cookbooks/passenger_apache2/CONTRIBUTING +29 -0
  209. data/chef/cookbooks/passenger_apache2/Gemfile +3 -0
  210. data/chef/cookbooks/passenger_apache2/LICENSE +201 -0
  211. data/chef/cookbooks/passenger_apache2/README.md +77 -0
  212. data/chef/cookbooks/passenger_apache2/attributes/default.rb +5 -0
  213. data/chef/cookbooks/passenger_apache2/metadata.json +38 -0
  214. data/chef/cookbooks/passenger_apache2/metadata.rb +17 -0
  215. data/chef/cookbooks/passenger_apache2/recipes/default.rb +60 -0
  216. data/chef/cookbooks/passenger_apache2/recipes/mod_rails.rb +47 -0
  217. data/chef/cookbooks/passenger_apache2/templates/default/passenger.conf.erb +3 -0
  218. data/chef/cookbooks/passenger_apache2/templates/default/passenger.load.erb +1 -0
  219. data/chef/cookbooks/passenger_apache2/templates/default/passenger_web_app.conf.erb +32 -0
  220. data/chef/cookbooks/passenger_apache2/templates/default/web_app.conf.erb +32 -0
  221. data/chef/roles/apache2.rb +12 -0
  222. data/chef/roles/mysql.rb +18 -0
  223. data/chef/solo.rb +5 -0
  224. data/config/deploy/centos.sh +17 -0
  225. data/config/deploy/production.rb +3 -0
  226. data/config/deploy/ubuntu.sh +10 -0
  227. data/config/deploy.rb +99 -0
  228. data/config/deployment.yml +6 -0
  229. data/fast_food.gemspec +26 -0
  230. data/lib/fast_food/railtie.rb +9 -0
  231. data/lib/fast_food/version.rb +3 -0
  232. data/lib/fast_food.rb +5 -0
  233. data/lib/tasks/fast_food.rake +100 -0
  234. data/spec/lib/fast_food_spec.rb +0 -0
  235. data/spec/spec_helper.rb +1 -0
  236. metadata +349 -0
@@ -0,0 +1,221 @@
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
+ if Chef::Config[:solo]
25
+ missing_attrs = %w{
26
+ server_debian_password server_root_password server_repl_password
27
+ }.select do |attr|
28
+ node["mysql"][attr].nil?
29
+ end.map { |attr| "node['mysql']['#{attr}']" }
30
+
31
+ if !missing_attrs.empty?
32
+ Chef::Application.fatal!([
33
+ "You must set #{missing_attrs.join(', ')} in chef-solo mode.",
34
+ "For more information, see https://github.com/opscode-cookbooks/mysql#chef-solo-note"
35
+ ].join(' '))
36
+ end
37
+ else
38
+ # generate all passwords
39
+ node.set_unless['mysql']['server_debian_password'] = secure_password
40
+ node.set_unless['mysql']['server_root_password'] = secure_password
41
+ node.set_unless['mysql']['server_repl_password'] = secure_password
42
+ node.save
43
+ end
44
+
45
+ if platform_family?(%w{debian})
46
+
47
+ directory "/var/cache/local/preseeding" do
48
+ owner "root"
49
+ group node['mysql']['root_group']
50
+ mode 0755
51
+ recursive true
52
+ end
53
+
54
+ execute "preseed mysql-server" do
55
+ command "debconf-set-selections /var/cache/local/preseeding/mysql-server.seed"
56
+ action :nothing
57
+ end
58
+
59
+ template "/var/cache/local/preseeding/mysql-server.seed" do
60
+ source "mysql-server.seed.erb"
61
+ owner "root"
62
+ group node['mysql']['root_group']
63
+ mode "0600"
64
+ notifies :run, "execute[preseed mysql-server]", :immediately
65
+ end
66
+
67
+ template "#{node['mysql']['conf_dir']}/debian.cnf" do
68
+ source "debian.cnf.erb"
69
+ owner "root"
70
+ group node['mysql']['root_group']
71
+ mode "0600"
72
+ end
73
+
74
+ end
75
+
76
+ if platform_family?('windows')
77
+ package_file = node['mysql']['package_file']
78
+
79
+ remote_file "#{Chef::Config[:file_cache_path]}/#{package_file}" do
80
+ source node['mysql']['url']
81
+ not_if { File.exists? "#{Chef::Config[:file_cache_path]}/#{package_file}" }
82
+ end
83
+
84
+ windows_package node['mysql']['server']['packages'].first do
85
+ source "#{Chef::Config[:file_cache_path]}/#{package_file}"
86
+ end
87
+
88
+ def package(*args, &blk)
89
+ windows_package(*args, &blk)
90
+ end
91
+ end
92
+
93
+ node['mysql']['server']['packages'].each do |package_name|
94
+ package package_name do
95
+ action :install
96
+ notifies :start, "service[mysql]", :immediately
97
+ end
98
+ end
99
+
100
+ unless platform_family?(%w{mac_os_x})
101
+
102
+ [File.dirname(node['mysql']['pid_file']),
103
+ File.dirname(node['mysql']['tunable']['slow_query_log']),
104
+ node['mysql']['confd_dir'],
105
+ node['mysql']['confd_dir'],
106
+ node['mysql']['log_dir'],
107
+ node['mysql']['data_dir']].each do |directory_path|
108
+ directory directory_path do
109
+ owner "mysql" unless platform? 'windows'
110
+ group "mysql" unless platform? 'windows'
111
+ action :create
112
+ recursive true
113
+ end
114
+ end
115
+
116
+ if platform_family? 'windows'
117
+ require 'win32/service'
118
+
119
+ windows_path node['mysql']['bin_dir'] do
120
+ action :add
121
+ end
122
+
123
+ windows_batch "install mysql service" do
124
+ command "\"#{node['mysql']['bin_dir']}\\mysqld.exe\" --install #{node['mysql']['service_name']}"
125
+ not_if { Win32::Service.exists?(node['mysql']['service_name']) }
126
+ end
127
+ end
128
+
129
+ skip_federated = case node['platform']
130
+ when 'fedora', 'ubuntu', 'amazon'
131
+ true
132
+ when 'centos', 'redhat', 'scientific'
133
+ node['platform_version'].to_f < 6.0
134
+ else
135
+ false
136
+ end
137
+ end
138
+
139
+ # Homebrew has its own way to do databases
140
+ if platform_family?(%w{mac_os_x})
141
+ execute "mysql-install-db" do
142
+ command "mysql_install_db --verbose --user=`whoami` --basedir=\"$(brew --prefix mysql)\" --datadir=#{node['mysql']['data_dir']} --tmpdir=/tmp"
143
+ environment('TMPDIR' => nil)
144
+ action :run
145
+ creates "#{node['mysql']['data_dir']}/mysql"
146
+ end
147
+ else
148
+ execute 'mysql-install-db' do
149
+ command "mysql_install_db"
150
+ action :run
151
+ not_if { File.exists?(node['mysql']['data_dir'] + '/mysql/user.frm') }
152
+ end
153
+
154
+ service "mysql" do
155
+ service_name node['mysql']['service_name']
156
+ if node['mysql']['use_upstart']
157
+ provider Chef::Provider::Service::Upstart
158
+ end
159
+ supports :status => true, :restart => true, :reload => true
160
+ action :enable
161
+ end
162
+ end
163
+
164
+ # set the root password for situations that don't support pre-seeding.
165
+ # (eg. platforms other than debian/ubuntu & drop-in mysql replacements)
166
+ execute "assign-root-password" do
167
+ command "\"#{node['mysql']['mysqladmin_bin']}\" -u root password \"#{node['mysql']['server_root_password']}\""
168
+ action :run
169
+ only_if "\"#{node['mysql']['mysql_bin']}\" -u root -e 'show databases;'"
170
+ end
171
+
172
+ unless platform_family?(%w{mac_os_x})
173
+ grants_path = node['mysql']['grants_path']
174
+
175
+ begin
176
+ t = resources("template[#{grants_path}]")
177
+ rescue
178
+ Chef::Log.info("Could not find previously defined grants.sql resource")
179
+ t = template grants_path do
180
+ source "grants.sql.erb"
181
+ owner "root" unless platform_family? 'windows'
182
+ group node['mysql']['root_group'] unless platform_family? 'windows'
183
+ mode "0600"
184
+ action :create
185
+ end
186
+ end
187
+
188
+ if platform_family? 'windows'
189
+ windows_batch "mysql-install-privileges" do
190
+ command "\"#{node['mysql']['mysql_bin']}\" -u root #{node['mysql']['server_root_password'].empty? ? '' : '-p' }\"#{node['mysql']['server_root_password']}\" < \"#{grants_path}\""
191
+ action :nothing
192
+ subscribes :run, resources("template[#{grants_path}]"), :immediately
193
+ end
194
+ else
195
+ execute "mysql-install-privileges" do
196
+ command %Q["#{node['mysql']['mysql_bin']}" -u root #{node['mysql']['server_root_password'].empty? ? '' : '-p' }"#{node['mysql']['server_root_password']}" < "#{grants_path}"]
197
+ action :nothing
198
+ subscribes :run, resources("template[#{grants_path}]"), :immediately
199
+ end
200
+ end
201
+
202
+ template "#{node['mysql']['conf_dir']}/my.cnf" do
203
+ source "my.cnf.erb"
204
+ owner "root" unless platform? 'windows'
205
+ group node['mysql']['root_group'] unless platform? 'windows'
206
+ mode "0644"
207
+ case node['mysql']['reload_action']
208
+ when 'restart'
209
+ notifies :restart, "service[mysql]", :immediately
210
+ when 'reload'
211
+ notifies :reload, "service[mysql]", :immediately
212
+ else
213
+ Chef::Log.info "my.cnf updated but mysql.reload_action is #{node['mysql']['reload_action']}. No action taken."
214
+ end
215
+ variables :skip_federated => skip_federated
216
+ end
217
+
218
+ service "mysql" do
219
+ action :start
220
+ end
221
+ end
@@ -0,0 +1,51 @@
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
+ [node['mysql']['ec2_path'], node['mysql']['data_dir']].each do |dir|
33
+ directory dir do
34
+ owner "mysql"
35
+ group "mysql"
36
+ end
37
+ end
38
+
39
+ mount node['mysql']['data_dir'] do
40
+ device node['mysql']['ec2_path']
41
+ fstype "none"
42
+ options "bind,rw"
43
+ action [:mount, :enable]
44
+ end
45
+
46
+ service "mysql" do
47
+ action :start
48
+ end
49
+
50
+ end
51
+
@@ -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_family'] -%>
5
+ <% when "debian" -%>
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,312 @@
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 = <%= node['mysql']['port'] %>
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 = <%= node['mysql']['nice'] %>
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 = <%= node['mysql']['port'] %>
50
+ basedir = <%= node['mysql']['basedir'] %>
51
+ datadir = <%= node['mysql']['data_dir'] %>
52
+ tmpdir = <%= node['mysql']['tmpdir'].join(':') %>
53
+ skip-external-locking
54
+ <%- if node['mysql']['tunable']['skip-name-resolve'] %>
55
+ skip-name-resolve
56
+ <%- end %>
57
+
58
+ # Charset and Collation
59
+ character-set-server = <%= node['mysql']['tunable']['character-set-server'] %>
60
+ collation-server = <%= node['mysql']['tunable']['collation-server'] %>
61
+ <%- if node['mysql']['tunable']['event_scheduler'] %>
62
+ event_scheduler = <%= node['mysql']['tunable']['event_scheduler'] %>
63
+ <%- end %>
64
+ <%- if node['mysql']['tunable']['skip-character-set-client-handshake'] %>
65
+ skip-character-set-client-handshake
66
+ <%- end %>
67
+
68
+ #
69
+ # Instead of skip-networking the default is now to listen only on
70
+ # localhost which is more compatible and is not less secure.
71
+ bind-address = <%= node['mysql']['bind_address'] %>
72
+ #
73
+ # * Fine Tuning
74
+ #
75
+ key_buffer = <%= node['mysql']['tunable']['key_buffer'] %>
76
+ max_allowed_packet = <%= node['mysql']['tunable']['max_allowed_packet'] %>
77
+ thread_stack = <%= node['mysql']['tunable']['thread_stack'] %>
78
+ thread_cache_size = <%= node['mysql']['tunable']['thread_cache_size'] %>
79
+ sort_buffer_size = <%= node['mysql']['tunable']['sort_buffer_size'] %>
80
+ read_buffer_size = <%= node['mysql']['tunable']['read_buffer_size'] %>
81
+ read_rnd_buffer_size = <%= node['mysql']['tunable']['read_rnd_buffer_size'] %>
82
+ join_buffer_size = <%= node['mysql']['tunable']['join_buffer_size'] %>
83
+
84
+ auto-increment-increment = <%= node['mysql']['auto-increment-increment'] %>
85
+ auto-increment-offset = <%= node['mysql']['auto-increment-offset'] %>
86
+
87
+ # This replaces the startup script and checks MyISAM tables if needed
88
+ # the first time they are touched
89
+ myisam-recover = BACKUP
90
+ max_connections = <%= node['mysql']['tunable']['max_connections'] %>
91
+ max_connect_errors = <%= node['mysql']['tunable']['max_connect_errors'] %>
92
+ concurrent_insert = <%= node['mysql']['tunable']['concurrent_insert'] %>
93
+ connect_timeout = <%= node['mysql']['tunable']['connect_timeout'] %>
94
+ wait_timeout = <%= node['mysql']['tunable']['wait_timeout'] %>
95
+ net_read_timeout = <%= node['mysql']['tunable']['net_read_timeout'] %>
96
+ net_write_timeout = <%= node['mysql']['tunable']['net_write_timeout'] %>
97
+ back_log = <%= node['mysql']['tunable']['back_log'] %>
98
+ table_cache = <%= node['mysql']['tunable']['table_cache'] %>
99
+ <%- if node['mysql']['tunable']['table_open_cache'] %>
100
+ table_open_cache = <%= node['mysql']['tunable']['table_open_cache'] %>
101
+ <%- end %>
102
+ tmp_table_size = <%= node['mysql']['tunable']['tmp_table_size'] %>
103
+ max_heap_table_size = <%= node['mysql']['tunable']['max_heap_table_size'] %>
104
+ bulk_insert_buffer_size = <%= node['mysql']['tunable']['bulk_insert_buffer_size'] %>
105
+ open-files-limit = <%= node['mysql']['tunable']['open-files-limit'] %>
106
+ open-files = <%= node['mysql']['tunable']['open-files'] %>
107
+
108
+ # Default Table Settings
109
+ <%- if node['mysql']['tunable']['sql_mode'] %>
110
+ sql_mode = "<%= node['mysql']['tunable']['sql_mode'] %>"
111
+ <%- end %>
112
+
113
+ #
114
+ # * Query Cache Configuration
115
+ #
116
+ query_cache_limit = <%= node['mysql']['tunable']['query_cache_limit'] %>
117
+ query_cache_size = <%= node['mysql']['tunable']['query_cache_size'] %>
118
+ #
119
+ # * Logging
120
+ #
121
+ # Both location gets rotated by the cronjob.
122
+ # Be aware that this log type is a performance killer.
123
+ #log = /var/log/mysql/mysql.log
124
+ #
125
+ # Error logging goes to syslog. This is a Debian improvement :)
126
+ <%- if node['mysql']['tunable']['log_error'] %>
127
+ log_error = <%= node['mysql']['tunable']['log_error'] %>
128
+ <%- end %>
129
+ <%- if node['mysql']['tunable']['log_warnings'] %>
130
+ log_warnings
131
+ <%- end %>
132
+ #
133
+ # * Replication
134
+ #
135
+ read_only = <%= node['mysql']['read_only'] %>
136
+
137
+
138
+ #
139
+ # Here you can see queries with especially long duration
140
+ <%- if node['mysql']['version'].to_f >= 5.5 %>
141
+ slow_query_log = <%= node['mysql']['tunable']['slow_query_log'] %>
142
+ <% else %>
143
+ log_slow_queries = <%= node['mysql']['tunable']['slow_query_log'] %>
144
+ <% end %>
145
+
146
+ long_query_time = <%= node['mysql']['tunable']['long_query_time'] %>
147
+ <%- if node['mysql']['tunable']['log_queries_not_using_index'] and node['mysql']['slow_query_log'] %>
148
+ log-queries-not-using-indexes
149
+ <%- end %>
150
+ #
151
+ # The following can be used as easy to replay backup logs or for replication.
152
+ # note: if you are setting up a replication slave, see README.Debian about
153
+ # other settings you may need to change.
154
+ <%- if node['mysql']['tunable']['server_id'] %>
155
+ server-id = <%= node['mysql']['tunable']['server_id'] %>
156
+ <% end %>
157
+ <%- if node['mysql']['tunable']['binlog_format'] %>
158
+
159
+ binlog_format = <%= node['mysql']['tunable']['binlog_format'] %>
160
+
161
+ <%- end %>
162
+ <%- if node['mysql']['tunable']['log_bin'] %>
163
+ log_bin = <%= node['mysql']['tunable']['log_bin'] %>
164
+ <%- if node['mysql']['tunable']['log_bin'] %>
165
+ binlog_format = <%= node['mysql']['tunable']['binlog_format'] %>
166
+ <%- end %>
167
+ log_slave_updates = <%= node['mysql']['tunable']['log_slave_updates'] %>
168
+ <%- end %>
169
+ <%- if node['mysql']['tunable']['log_bin_trust_function_creators'] %>
170
+ log_bin_trust_function_creators
171
+ <%- end %>
172
+ expire_logs_days = <%= node['mysql']['tunable']['expire_logs_days'] %>
173
+ max_binlog_size = <%= node['mysql']['tunable']['max_binlog_size'] %>
174
+ binlog_cache_size = <%= node['mysql']['tunable']['binlog_cache_size'] %>
175
+ #binlog_do_db = include_database_name
176
+ #binlog_ignore_db = include_database_name
177
+ <%- if node['mysql']['tunable']['relay_log'] %>
178
+ relay_log = <%= node['mysql']['tunable']['relay_log'] %>
179
+ <%- end %>
180
+ <%- if node['mysql']['tunable']['relay_log_index'] %>
181
+ relay_log_index = <%= node['mysql']['tunable']['relay_log_index'] %>
182
+ <%- end %>
183
+
184
+ sync_binlog = <%= node['mysql']['tunable']['sync_binlog'] %>
185
+ <%- if node['mysql']['tunable']['skip_slave_start'] %>
186
+ skip_slave_start
187
+ <%- end %>
188
+ <%- if node['mysql']['tunable']['read_only'] %>
189
+ read_only = 1
190
+ <%- end %>
191
+
192
+ <%- if node['mysql']['tunable']['transaction-isolation'] %>
193
+ transaction-isolation = <%= node['mysql']['tunable']['transaction-isolation'] %>
194
+ <%- end %>
195
+
196
+ #
197
+ # * InnoDB
198
+ #
199
+ # InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
200
+ # Read the manual for more InnoDB related options. There are many!
201
+ # You might want to disable InnoDB to shrink the mysqld process by circa 100MB.
202
+ #skip-innodb
203
+
204
+ <%- if node["mysql"]["version"].to_f >= 5.5 %>
205
+ innodb_write_io_threads = <%= node['mysql']['tunable']['innodb_write_io_threads'] %>
206
+ innodb_io_capacity = <%= node['mysql']['tunable']['innodb_io_capacity'] %>
207
+ innodb_read_io_threads = <%= node['mysql']['tunable']['innodb_read_io_threads'] %>
208
+ innodb_buffer_pool_instances = <%= node['mysql']['tunable']['innodb_buffer_pool_instances'] %>
209
+ <%- end %>
210
+
211
+ ## InnoDB Plugin Independent Settings
212
+ innodb_data_home_dir = <%= node['mysql']['data_dir'] %>
213
+ innodb_log_group_home_dir = <%= node['mysql']['log_dir'] %>
214
+ <%- if node['mysql']['log_files_in_group'] %>
215
+ innodb_log_files_in_group = <%= node['mysql']['log_files_in_group'] %>
216
+ <%- end %>
217
+
218
+ <%- if node['mysql']['innodb_status_file'] %>
219
+ innodb_status_file
220
+ <%- end %>
221
+ <%- if node['mysql']['tunable']['innodb_file_per_table'] %>
222
+ innodb_file_per_table
223
+ <%- end %>
224
+ innodb_table_locks = <%= node['mysql']['tunable']['innodb_table_locks'] %>
225
+ innodb_lock_wait_timeout = <%= node['mysql']['tunable']['innodb_lock_wait_timeout'] %>
226
+ innodb_thread_concurrency = <%= node['mysql']['tunable']['innodb_thread_concurrency'] %>
227
+ innodb_commit_concurrency = <%= node['mysql']['tunable']['innodb_commit_concurrency'] %>
228
+ innodb_support_xa = <%= node['mysql']['tunable']['innodb_support_xa'] %>
229
+ <%- if node['mysql']['tunable']['skip-innodb-doublewrite'] %>
230
+ skip-innodb-doublewrite
231
+ <%- end %>
232
+
233
+ innodb_buffer_pool_size = <%= node['mysql']['tunable']['innodb_buffer_pool_size'] %>
234
+ innodb_log_file_size = <%= node['mysql']['tunable']['innodb_log_file_size'] %>
235
+ innodb_additional_mem_pool_size = <%= node['mysql']['tunable']['innodb_additional_mem_pool_size'] %>
236
+ innodb_data_file_path = <%= node['mysql']['tunable']['innodb_data_file_path'] %>
237
+ innodb_file_per_table
238
+ innodb_flush_log_at_trx_commit = <%= node['mysql']['tunable']['innodb_flush_log_at_trx_commit'] %>
239
+ <%- if node['mysql']['tunable']['innodb_flush_method'] %>
240
+ innodb_flush_method = <%= node['mysql']['tunable']['innodb_flush_method'] %>
241
+ <%- end %>
242
+ innodb_log_buffer_size = <%= node['mysql']['tunable']['innodb_log_buffer_size'] %>
243
+ <%- if node['mysql']['tunable']['innodb_adaptive_flushing'] %>
244
+ innodb_adaptive_flushing = <%= node['mysql']['tunable']['innodb_adaptive_flushing'] %>
245
+ <%- end %>
246
+
247
+ <% if @skip_federated %>
248
+ #
249
+ # * Federated
250
+ #
251
+ # The FEDERATED storage engine is disabled since 5.0.67 by default in the .cnf files
252
+ # shipped with MySQL distributions (my-huge.cnf, my-medium.cnf, and so forth).
253
+ #
254
+ skip-federated
255
+ <% end %>
256
+ #
257
+ # * Security Features
258
+ #
259
+ # Read the manual, too, if you want chroot!
260
+ # chroot = /var/lib/mysql/
261
+ #
262
+ # For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
263
+ #
264
+ # ssl-ca=/etc/mysql/cacert.pem
265
+ # ssl-cert=/etc/mysql/server-cert.pem
266
+ # ssl-key=/etc/mysql/server-key.pem
267
+
268
+ [mysqldump]
269
+ quick
270
+ quote-names
271
+ max_allowed_packet = <%= node['mysql']['tunable']['max_allowed_packet'] %>
272
+
273
+ [mysql]
274
+ #no-auto-rehash # faster start of mysql but no tab completition
275
+
276
+ [isamchk]
277
+ key_buffer = <%= node['mysql']['tunable']['max_allowed_packet'] %>
278
+
279
+ myisam_sort_buffer_size = <%= node['mysql']['tunable']['myisam_sort_buffer_size'] %>
280
+ myisam_max_sort_file_size = <%= node['mysql']['tunable']['myisam_max_sort_file_size'] %>
281
+ myisam_repair_threads = <%= node['mysql']['tunable']['myisam_repair_threads'] %>
282
+ myisam_recover = <%= node['mysql']['tunable']['myisam_recover'] %>
283
+
284
+ #
285
+ # * NDB Cluster
286
+ #
287
+ # See /usr/share/doc/mysql-server-*/README.Debian for more information.
288
+ #
289
+ # The following configuration is read by the NDB Data Nodes (ndbd processes)
290
+ # not from the NDB Management Nodes (ndb_mgmd processes).
291
+ #
292
+ # [MYSQL_CLUSTER]
293
+ # ndb-connectstring=127.0.0.1
294
+
295
+ <% case node['platform_family'] -%>
296
+ <% when "rhel", "fedora", "suse" -%>
297
+ #
298
+ # * BerkeleyDB
299
+ #
300
+ # Using BerkeleyDB is now discouraged as its support will cease in 5.1.12.
301
+ skip-bdb
302
+ # Default to using old password format for compatibility with mysql 3.x
303
+ # clients (those using the mysqlclient10 compatibility package).
304
+ old_passwords = <%= node['mysql']['old_passwords'] %>
305
+
306
+ <% else -%>
307
+ #
308
+ # * IMPORTANT: Additional settings that can override those from this file!
309
+ # The files must end with '.cnf', otherwise they'll be ignored.
310
+ #
311
+ !includedir <%= node['mysql']['confd_dir'] %>/
312
+ <% end -%>
@@ -0,0 +1,10 @@
1
+ mysql-server-5.0 mysql-server/root_password_again select <%= node['mysql']['server_root_password'] %>
2
+ mysql-server-5.0 mysql-server/root_password select <%= node['mysql']['server_root_password'] %>
3
+ mysql-server-5.0 mysql-server-5.0/really_downgrade boolean false
4
+ mysql-server-5.0 mysql-server-5.0/need_sarge_compat boolean false
5
+ mysql-server-5.0 mysql-server-5.0/start_on_boot boolean true
6
+ mysql-server-5.0 mysql-server/error_setting_password boolean false
7
+ mysql-server-5.0 mysql-server-5.0/nis_warning note
8
+ mysql-server-5.0 mysql-server-5.0/postrm_remove_databases boolean false
9
+ mysql-server-5.0 mysql-server/password_mismatch boolean false
10
+ mysql-server-5.0 mysql-server-5.0/need_sarge_compat_done boolean true
@@ -0,0 +1,3 @@
1
+ # MySQL
2
+ -A FWR -p tcp -m tcp --dport 3306 -j ACCEPT
3
+ -A FWR -p udp -m udp --dport 3306 -j ACCEPT