Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

First version of the rails test box. Not working yet. Pushed for review

  • Loading branch information...
commit e1add102e900deee21b279b5ce6b19152a58d1e2 0 parents
@jeroenvandijk authored
Showing with 3,430 additions and 0 deletions.
  1. +21 −0 .gitignore
  2. +3 −0  .gitmodules
  3. +1 −0  .vagrant
  4. +44 −0 README.mdown
  5. +21 −0 Vagrantfile
  6. +9 −0 cookbooks/apt/files/default/apt-cacher
  7. +144 −0 cookbooks/apt/files/default/apt-cacher.conf
  8. +50 −0 cookbooks/apt/files/default/apt-proxy-v2.conf
  9. +37 −0 cookbooks/apt/metadata.json
  10. +11 −0 cookbooks/apt/metadata.rb
  11. +42 −0 cookbooks/apt/recipes/cacher.rb
  12. +33 −0 cookbooks/apt/recipes/default.rb
  13. +34 −0 cookbooks/apt/recipes/proxy.rb
  14. +38 −0 cookbooks/build-essential/metadata.json
  15. +9 −0 cookbooks/build-essential/metadata.rb
  16. +43 −0 cookbooks/build-essential/recipes/default.rb
  17. +1 −0  cookbooks/curl/recipes/default.rb
  18. +37 −0 cookbooks/git/README.rdoc
  19. +42 −0 cookbooks/git/metadata.json
  20. +15 −0 cookbooks/git/metadata.rb
  21. +26 −0 cookbooks/git/recipes/default.rb
  22. +28 −0 cookbooks/git/recipes/server.rb
  23. +2 −0  cookbooks/git/templates/default/sv-git-daemon-log-run.erb
  24. +3 −0  cookbooks/git/templates/default/sv-git-daemon-run.erb
  25. +29 −0 cookbooks/java/README.rdoc
  26. +11 −0 cookbooks/java/files/default/java.seed
  27. +35 −0 cookbooks/java/metadata.json
  28. +10 −0 cookbooks/java/metadata.rb
  29. +46 −0 cookbooks/java/recipes/default.rb
  30. +95 −0 cookbooks/mysql/README.rdoc
  31. +42 −0 cookbooks/mysql/attributes/server.rb
  32. +15 −0 cookbooks/mysql/libraries/database.rb
  33. +214 −0 cookbooks/mysql/metadata.json
  34. +73 −0 cookbooks/mysql/metadata.rb
  35. +13 −0 cookbooks/mysql/providers/database.rb
  36. +50 −0 cookbooks/mysql/recipes/client.rb
  37. +20 −0 cookbooks/mysql/recipes/default.rb
  38. +82 −0 cookbooks/mysql/recipes/server.rb
  39. +49 −0 cookbooks/mysql/recipes/server_ec2.rb
  40. +5 −0 cookbooks/mysql/resources/database.rb
  41. +12 −0 cookbooks/mysql/templates/centos/my.cnf.erb
  42. +11 −0 cookbooks/mysql/templates/default/debian.cnf.erb
  43. +12 −0 cookbooks/mysql/templates/default/grants.sql.erb
  44. +163 −0 cookbooks/mysql/templates/default/my.cnf.erb
  45. +10 −0 cookbooks/mysql/templates/default/mysql-server.seed.erb
  46. +3 −0  cookbooks/mysql/templates/default/port_mysql.erb
  47. +12 −0 cookbooks/mysql/templates/redhat/my.cnf.erb
  48. +156 −0 cookbooks/mysql/templates/ubuntu-8.04/my.cnf.erb
  49. +158 −0 cookbooks/mysql/templates/ubuntu-9.10/my.cnf.erb
  50. +33 −0 cookbooks/openssl/README.rdoc
  51. +37 −0 cookbooks/openssl/libraries/secure_password.rb
  52. +29 −0 cookbooks/openssl/metadata.json
  53. +6 −0 cookbooks/openssl/metadata.rb
  54. +19 −0 cookbooks/openssl/recipes/default.rb
  55. +45 −0 cookbooks/postgresql/README.rdoc
  56. +27 −0 cookbooks/postgresql/attributes/postgresql.rb
  57. +57 −0 cookbooks/postgresql/metadata.json
  58. +18 −0 cookbooks/postgresql/metadata.rb
  59. +25 −0 cookbooks/postgresql/recipes/client.rb
  60. +18 −0 cookbooks/postgresql/recipes/default.rb
  61. +22 −0 cookbooks/postgresql/recipes/dev.rb
  62. +47 −0 cookbooks/postgresql/recipes/server.rb
  63. +83 −0 cookbooks/postgresql/templates/default/pg_hba.conf.erb
  64. +493 −0 cookbooks/postgresql/templates/default/postgresql.conf.erb
  65. +3 −0  cookbooks/rails_test_suite/files/default/rails_mysql_user_grants.sql
  66. +52 −0 cookbooks/rails_test_suite/recipes/default.rb
  67. +44 −0 cookbooks/ruby/metadata.json
  68. +9 −0 cookbooks/ruby/metadata.rb
  69. +49 −0 cookbooks/ruby/recipes/default.rb
  70. +30 −0 cookbooks/rubygems/metadata.json
  71. +9 −0 cookbooks/rubygems/metadata.rb
  72. +25 −0 cookbooks/rubygems/recipes/default.rb
  73. +1 −0  cookbooks/rvm/files/default/bash_profile
  74. +42 −0 cookbooks/rvm/recipes/default.rb
  75. +35 −0 cookbooks/sqlite/metadata.json
  76. +9 −0 cookbooks/sqlite/metadata.rb
  77. +26 −0 cookbooks/sqlite/recipes/default.rb
  78. +21 −0 cookbooks/sqlite/recipes/dev.rb
  79. +14 −0 cookbooks/vagrant_main/recipes/default.rb
  80. +47 −0 cookbooks/zlib/metadata.json
  81. +9 −0 cookbooks/zlib/metadata.rb
  82. +25 −0 cookbooks/zlib/recipes/default.rb
  83. +1 −0  rails
21 .gitignore
@@ -0,0 +1,21 @@
+*.gem
+pkg
+.bundle
+debug.log
+doc/rdoc
+activemodel/doc
+activeresource/doc
+activerecord/doc
+actionpack/doc
+actionmailer/doc
+activesupport/doc
+activemodel/test/fixtures/fixture_database.sqlite3
+actionpack/test/tmp
+activesupport/test/fixtures/isolation_test
+railties/test/500.html
+railties/test/fixtures/tmp
+railties/test/initializer/root/log
+railties/doc/guides/html/images
+railties/doc/guides/html/stylesheets
+railties/guides/output
+railties/tmp
3  .gitmodules
@@ -0,0 +1,3 @@
+[submodule "rails"]
+ path = rails
+ url = git://github.com/rails/rails.git
1  .vagrant
@@ -0,0 +1 @@
+f3a7311c-4641-4734-aa7e-c7d8e85eb7b2
44 README.mdown
@@ -0,0 +1,44 @@
+Currently this repository is not working fully, do not use it yet
+It assumes you have vagrant installed from the github repository,
+
+Issues:
+
+ - rake mysql:build_databases makes the vagrant script fail
+ - When you ssh into the box and run the test it will tell you that gems have not been installed while bundler has been run
+
+
+
+
+
+Rails Test Box (Still an Idea in progress)
+==============
+
+This repositories contains everything you need to be a Rails Core contributor in no-time
+
+After you have ran through the instruction below you'll be able to run the Rails Test Suite (for the most important databases).
+
+Install VirtualBox
+
+ gem install vagrant
+
+Clone this repository
+
+ git clone
+ git submodules init
+ cd rails_test_box
+ vagrant up
+
+Wait a while until you vagrant is ready
+
+ vagrant ssh
+ cd rails
+ rake
+
+Everything should pass. Now you can start patching Rails and run the tests again.
+
+
+TODO
+----
+Add memcache support
+Find out why not all tests are succeeding
+Add commands to run test suite from the host dir
21 Vagrantfile
@@ -0,0 +1,21 @@
+Vagrant::Config.run do |config|
+ # All Vagrant configuration is done here. For a detailed explanation
+ # and listing of configuration options, please check the documentation
+ # online.
+
+ # Every Vagrant virtual environment requires a box to build off of.
+ config.vm.box = "base"
+ # config.vm.project_directory = "/home/vagrant/rails"
+ # config.ssh.username = "root"
+
+ config.vm.share_folder('rails', 'rails', 'rails')
+
+ config.vm.provisioner = :chef_solo
+ config.chef.cookbooks_path = "cookbooks"
+ config.chef.json.merge!({
+ :mysql => {
+ :server_root_password => "root"
+ }
+ })
+
+end
9 cookbooks/apt/files/default/apt-cacher
@@ -0,0 +1,9 @@
+# apt-cacher startup configuration file
+
+# IMPORTANT: check the apt-cacher.conf file before using apt-cacher as daemon.
+
+# set to 1 to start the daemon at boot time
+AUTOSTART=1
+
+# extra settings to override the ones in apt-cacher.conf
+# EXTRAOPT=" daemon_port=3142 limit=30 "
144 cookbooks/apt/files/default/apt-cacher.conf
@@ -0,0 +1,144 @@
+# This file has been modified by ./apt-proxy-to-apt-cacher
+# Some lines may have been appended at the bottom of this file
+# This file has been modified by /usr/share/apt-cacher/apt-proxy-to-apt-cacher
+# Some lines may have been appended at the bottom of this file
+#################################################################
+# This is the config file for apt-cacher. On most Debian systems
+# you can safely leave the defaults alone.
+#################################################################
+
+# cache_dir is used to set the location of the local cache. This can
+# become quite large, so make sure it is somewhere with plenty of space.
+cache_dir=/var/cache/apt-cacher
+
+# The email address of the administrator is displayed in the info page
+# and traffic reports.
+admin_email=root@localhost
+
+# For the daemon startup settings please edit the file /etc/default/apt-cacher.
+
+# Daemon port setting, only useful in stand-alone mode. You need to run the
+# daemon as root to use privileged ports (<1024).
+daemon_port = 3142
+
+# optional settings, user and group to run the daemon as. Make sure they have
+# sufficient permissions on the cache and log directories. Comment the settings
+# to run apt-cacher as the native user.
+group=www-data
+user=www-data
+
+# optional setting, binds the listening daemon to one specified IP. Use IP
+# ranges for more advanced configuration, see below.
+# daemon_addr=localhost
+
+# If your apt-cacher machine is directly exposed to the Internet and you are
+# worried about unauthorised machines fetching packages through it, you can
+# specify a list of IPv4 addresses which are allowed to use it and another
+# list of IPv4 addresses which aren't.
+# Localhost (127.0.0.1) is always allowed. Other addresses must be matched
+# by allowed_hosts and not by denied_hosts to be permitted to use the cache.
+# Setting allowed_hosts to "*" means "allow all".
+# Otherwise the format is a comma-separated list containing addresses,
+# optionally with masks (like 10.0.0.0/22), or ranges of addresses (two
+# addresses separated by a hyphen, no masks, like '192.168.0.3-192.168.0.56').
+allowed_hosts=*
+denied_hosts=
+
+# And similiarly for IPv6 with allowed_hosts_6 and denied_hosts_6.
+# Note that IPv4-mapped IPv6 addresses (::ffff:w.x.y.z) are truncated to
+# w.x.y.z and are handled as IPv4.
+allowed_hosts_6=fec0::/16
+denied_hosts_6=
+
+# This thing can be done by Apache but is much simplier here - limit access to
+# Debian mirrors based on server names in the URLs
+#allowed_locations=ftp.uni-kl.de,ftp.nerim.net,debian.tu-bs.de
+
+# Apt-cacher can generate usage reports every 24 hours if you set this
+# directive to 1. You can view the reports in a web browser by pointing
+# to your cache machine with '/apt-cacher/report' on the end, like this:
+# http://yourcache.example.com/apt-cacher/report
+# Generating reports is very fast even with many thousands of logfile
+# lines, so you can safely turn this on without creating much
+# additional system load.
+generate_reports=1
+
+# Apt-cacher can clean up its cache directory every 24 hours if you set
+# this directive to 1. Cleaning the cache can take some time to run
+# (generally in the order of a few minutes) and removes all package
+# files that are not mentioned in any existing 'Packages' lists. This
+# has the effect of deleting packages that have been superseded by an
+# updated 'Packages' list.
+clean_cache=1
+
+# The directory to use for apt-cacher access and error logs.
+# The access log records every request in the format:
+# date-time|client ip address|HIT/MISS/EXPIRED|object size|object name
+# The error log is slightly more free-form, and is also used for debug
+# messages if debug mode is turned on.
+# Note that the old 'logfile' and 'errorfile' directives are
+# deprecated: if you set them explicitly they will be honoured, but it's
+# better to just get rid of them from old config files.
+logdir=/var/log/apt-cacher
+
+# apt-cacher can use different methods to decide whether package lists need to
+# be updated,
+# A) looking at the age of the cached files
+# B) getting HTTP header from server and comparing that with cached data. This
+# method is more reliable and avoids desynchronisation of data and index files
+# but needs to transfer few bytes from the server every time somebody requests
+# the files ("apt-get update")
+# Set the following value to the maximum age (in hours) for method A or to 0
+# for method B
+expire_hours=0
+
+# Apt-cacher can pass all its requests to an external http proxy like
+# Squid, which could be very useful if you are using an ISP that blocks
+# port 80 and requires all web traffic to go through its proxy. The
+# format is 'hostname:port', eg: 'proxy.example.com:8080'.
+http_proxy=proxy.example.com:8080
+
+# Use of an external proxy can be turned on or off with this flag.
+# Value should be either 0 (off) or 1 (on).
+use_proxy=0
+
+# External http proxy sometimes need authentication to get full access. The
+# format is 'username:password'.
+http_proxy_auth=proxyuser:proxypass
+
+# Use of external proxy authentication can be turned on or off with this flag.
+# Value should be either 0 (off) or 1 (on).
+use_proxy_auth=0
+
+# Rate limiting sets the maximum bandwidth in bytes per second to use
+# for fetching packages. Syntax is fully defined in 'man wget'.
+# Use 'k' or 'm' to use kilobits or megabits / second: eg, 'limit=25k'.
+# Use 0 or a negative value for no rate limiting.
+limit=0
+
+# Debug mode makes apt-cacher spew a lot of extra debug junk to the
+# error log (whose location is defined with the 'logdir' directive).
+# Leave this off unless you need it, or your error log will get very
+# big. Acceptable values are 0 or 1.
+debug=0
+
+# Adapt the line in the usage info web page to match your server configuration
+# example_sources_line=deb&nbsp;http://<b>my.cacher.server:3142/</b>ftp.au.debian.org/debian&nbsp;unstable&nbsp;main&nbsp;contrib&nbsp;non-free
+
+# Print a 410 (Gone) HTTP message with the specified text when accessed via
+# CGI. Useful to tell users to adapt their sources.list files when the
+# apt-cacher server is beeing relocated (via apt-get's error messages while
+# running "update")
+#cgi_advise_to_use = Please use http://cacheserver:3142/ as apt-cacher access URL
+#cgi_advise_to_use = Server relocated. To change sources.list, run perl -pe "s,/apt-cacher\??,:3142," -i /etc/apt/sources.list
+
+# Server mapping - this allows to hide real server names behind virtual paths
+# that appear in the access URL. This method is known from apt-proxy. This is
+# also the only method to use FTP access to the target hosts. The syntax is simple, the part of the beginning to replace, followed by a list of mirror urls, all space separated. Multiple profile are separated by semicolons
+# path_map = debian ftp.uni-kl.de/pub/linux/debian ftp2.de.debian.org/debian ; ubuntu archive.ubuntu.com/ubuntu ; security security.debian.org/debian-security ftp2.de.debian.org/debian-security
+# Note that you need to specify all target servers in the allowed_locations
+# options if you make use of it. Also note that the paths should not overlap
+# each other. FTP access method not supported yet, maybe in the future.
+
+# extra setting from apt-proxy configuration
+path_map = ubuntu us.archive.ubuntu.com/ubuntu ; ubuntu-security security.ubuntu.com/ubuntu ; debian debian.osuosl.org/debian/ ; security security.debian.org/debian-security
50 cookbooks/apt/files/default/apt-proxy-v2.conf
@@ -0,0 +1,50 @@
+[DEFAULT]
+;; All times are in seconds, but you can add a suffix
+;; for minutes(m), hours(h) or days(d)
+
+;; commented out address so apt-proxy will listen on all IPs
+;; address = 127.0.0.1
+port = 9999
+cache_dir = /var/cache/apt-proxy
+
+;; Control files (Packages/Sources/Contents) refresh rate
+min_refresh_delay = 1s
+complete_clientless_downloads = 1
+
+;; Debugging settings.
+debug = all:4 db:0
+
+time = 30
+passive_ftp = on
+
+;;--------------------------------------------------------------
+;; Cache housekeeping
+
+cleanup_freq = 1d
+max_age = 120d
+max_versions = 3
+
+;;---------------------------------------------------------------
+;; Backend servers
+;;
+;; Place each server in its own [section]
+
+[ubuntu]
+; Ubuntu archive
+backends =
+ http://us.archive.ubuntu.com/ubuntu
+
+[ubuntu-security]
+; Ubuntu security updates
+backends = http://security.ubuntu.com/ubuntu
+
+[debian]
+;; Backend servers, in order of preference
+backends =
+ http://debian.osuosl.org/debian/
+
+[security]
+;; Debian security archive
+backends =
+ http://security.debian.org/debian-security
+ http://ftp2.de.debian.org/debian-security
37 cookbooks/apt/metadata.json
@@ -0,0 +1,37 @@
+{
+ "dependencies": {
+ },
+ "replacing": {
+ },
+ "description": "Configures apt and apt services",
+ "groupings": {
+ },
+ "platforms": {
+ "ubuntu": [
+
+ ],
+ "debian": [
+
+ ]
+ },
+ "version": "0.8.0",
+ "recommendations": {
+ },
+ "name": "apt",
+ "maintainer": "Opscode, Inc.",
+ "long_description": "",
+ "recipes": {
+ "apt::proxy": "Set up an APT proxy",
+ "apt::cacher": "Set up an APT cache"
+ },
+ "suggestions": {
+ },
+ "maintainer_email": "cookbooks@opscode.com",
+ "attributes": {
+ },
+ "conflicting": {
+ },
+ "license": "Apache 2.0",
+ "providing": {
+ }
+ }
11 cookbooks/apt/metadata.rb
@@ -0,0 +1,11 @@
+maintainer "Opscode, Inc."
+maintainer_email "cookbooks@opscode.com"
+license "Apache 2.0"
+description "Configures apt and apt services"
+version "0.8"
+recipe "apt::cacher", "Set up an APT cache"
+recipe "apt::proxy", "Set up an APT proxy"
+
+%w{ ubuntu debian }.each do |os|
+ supports os
+end
42 cookbooks/apt/recipes/cacher.rb
@@ -0,0 +1,42 @@
+#
+# Cookbook Name:: apt
+# Recipe:: cacher
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+package "apt-cacher" do
+ action :install
+end
+
+service "apt-cacher" do
+ supports :restart => true, :status => false
+ action [ :enable, :start ]
+end
+
+remote_file "/etc/apt-cacher/apt-cacher.conf" do
+ source "apt-cacher.conf"
+ owner "root"
+ group "root"
+ mode 0644
+ notifies :restart, resources(:service => "apt-cacher")
+end
+
+remote_file "/etc/default/apt-cacher" do
+ source "apt-cacher"
+ owner "root"
+ group "root"
+ mode 0644
+ notifies :restart, resources(:service => "apt-cacher")
+end
33 cookbooks/apt/recipes/default.rb
@@ -0,0 +1,33 @@
+#
+# Cookbook Name:: apt
+# Recipe:: default
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+e = execute "apt-get update" do
+ action :nothing
+end
+
+e.run_action(:run)
+
+%w{/var/cache/local /var/cache/local/preseeding}.each do |dirname|
+ directory dirname do
+ owner "root"
+ group "root"
+ mode 0755
+ action :create
+ end
+end
34 cookbooks/apt/recipes/proxy.rb
@@ -0,0 +1,34 @@
+#
+# Cookbook Name:: apt
+# Recipe:: proxy
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+package "apt-proxy" do
+ action :install
+end
+
+service "apt-proxy" do
+ supports :restart => true, :status => false
+ action [ :enable, :start ]
+end
+
+remote_file "/etc/apt-proxy/apt-proxy-v2.conf" do
+ source "apt-proxy-v2.conf"
+ owner "root"
+ group "root"
+ mode 0644
+ notifies :restart, resources(:service => "apt-proxy")
+end
38 cookbooks/build-essential/metadata.json
@@ -0,0 +1,38 @@
+{
+ "dependencies": {
+ },
+ "replacing": {
+ },
+ "description": "Installs C compiler / build tools",
+ "groupings": {
+ },
+ "platforms": {
+ "ubuntu": [
+
+ ],
+ "centos": [
+
+ ],
+ "debian": [
+
+ ]
+ },
+ "version": "0.7.0",
+ "recommendations": {
+ },
+ "name": "build-essential",
+ "maintainer": "Opscode, Inc.",
+ "long_description": "",
+ "recipes": {
+ },
+ "suggestions": {
+ },
+ "maintainer_email": "cookbooks@opscode.com",
+ "attributes": {
+ },
+ "conflicting": {
+ },
+ "license": "Apache 2.0",
+ "providing": {
+ }
+ }
9 cookbooks/build-essential/metadata.rb
@@ -0,0 +1,9 @@
+maintainer "Opscode, Inc."
+maintainer_email "cookbooks@opscode.com"
+license "Apache 2.0"
+description "Installs C compiler / build tools"
+version "0.7"
+
+%w{ centos ubuntu debian }.each do |os|
+ supports os
+end
43 cookbooks/build-essential/recipes/default.rb
@@ -0,0 +1,43 @@
+#
+# Cookbook Name:: build-essential
+# Recipe:: default
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+case node[:platform]
+when "ubuntu","debian"
+ %w{build-essential binutils-doc}.each do |pkg|
+ package pkg do
+ action :install
+ end
+ end
+when "centos"
+ package "gcc" do
+ action :install
+ end
+end
+
+package "autoconf" do
+ action :install
+end
+
+package "flex" do
+ action :install
+end
+
+package "bison" do
+ action :install
+end
1  cookbooks/curl/recipes/default.rb
@@ -0,0 +1 @@
+package "curl"
37 cookbooks/git/README.rdoc
@@ -0,0 +1,37 @@
+= DESCRIPTION:
+
+Installs git.
+
+= REQUIREMENTS:
+
+== Cookbooks:
+
+Opscode Cookbooks (http://github.com/opscode/cookbooks/tree/master)
+
+* runit
+
+= USAGE:
+
+This cookbook primarily installs git core packages. It can also be used to serve git repositories.
+
+ include_recipe "git::server"
+
+This creates the directory /srv/git and starts a git daemon, exporting all repositories found. Repositories need to be added manually, but will be available once they are created.
+
+= LICENSE and AUTHOR:
+
+Author:: Joshua Timberman (<joshua@opscode.com>)
+
+Copyright:: 2009, Opscode, Inc
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
42 cookbooks/git/metadata.json
@@ -0,0 +1,42 @@
+{
+ "dependencies": {
+ "runit": [
+
+ ],
+ "apache2": [
+
+ ]
+ },
+ "replacing": {
+ },
+ "description": "Installs git and/or sets up a Git server daemon",
+ "groupings": {
+ },
+ "platforms": {
+ "ubuntu": [
+
+ ],
+ "debian": [
+
+ ]
+ },
+ "version": "0.7.0",
+ "recommendations": {
+ },
+ "name": "git",
+ "maintainer": "Opscode, Inc.",
+ "long_description": "= DESCRIPTION:\n\nInstalls git.\n\n= REQUIREMENTS:\n\n== Cookbooks:\n\nOpscode Cookbooks (http://github.com/opscode/cookbooks/tree/master)\n\n* runit\n\n= USAGE:\n\nThis cookbook primarily installs git core packages. It can also be used to serve git repositories.\n\n include_recipe \"git::server\"\n\nThis creates the directory /srv/git and starts a git daemon, exporting all repositories found. Repositories need to be added manually, but will be available once they are created.\n\n= LICENSE and AUTHOR:\n \nAuthor:: Joshua Timberman (<joshua@opscode.com>)\n\nCopyright:: 2009, Opscode, Inc\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.",
+ "recipes": {
+ "git::server": "Sets up a runit_service for git daemon"
+ },
+ "suggestions": {
+ },
+ "maintainer_email": "cookbooks@opscode.com",
+ "attributes": {
+ },
+ "conflicting": {
+ },
+ "license": "Apache 2.0",
+ "providing": {
+ }
+ }
15 cookbooks/git/metadata.rb
@@ -0,0 +1,15 @@
+maintainer "Opscode, Inc."
+maintainer_email "cookbooks@opscode.com"
+license "Apache 2.0"
+description "Installs git and/or sets up a Git server daemon"
+long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
+version "0.7"
+recipe "git::server", "Sets up a runit_service for git daemon"
+
+%w{ ubuntu debian }.each do |os|
+ supports os
+end
+
+%w{ apache2 runit }.each do |cb|
+ depends cb
+end
26 cookbooks/git/recipes/default.rb
@@ -0,0 +1,26 @@
+#
+# Cookbook Name:: git
+# Recipe:: default
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+case node[:platform]
+when "debian", "ubuntu"
+ package "git-core"
+else
+ package "git"
+end
+
+package "git-email"
28 cookbooks/git/recipes/server.rb
@@ -0,0 +1,28 @@
+#
+# Cookbook Name:: git
+# Recipe:: server
+#
+# Copyright 2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+include_recipe "git"
+include_recipe "runit"
+
+directory "/srv/git" do
+ owner "root"
+ group "root"
+ mode 0755
+end
+
+runit_service "git-daemon"
2  cookbooks/git/templates/default/sv-git-daemon-log-run.erb
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec svlogd -tt ./main
3  cookbooks/git/templates/default/sv-git-daemon-run.erb
@@ -0,0 +1,3 @@
+#!/bin/sh
+exec 2>&1
+exec /usr/bin/git daemon --export-all --user nobody --group daemon --base-path=/srv/git /srv/git
29 cookbooks/java/README.rdoc
@@ -0,0 +1,29 @@
+= DESCRIPTION:
+
+Installs Java and Ant.
+
+= REQUIREMENTS:
+
+Platform: Ubuntu, Debian, Red Hat, CentOS, Fedora.
+
+Enable the 'multiverse' repository on Ubuntu, 'non-free' on Debian or EPEL on RH/Cent/Fedora to get the Java package, or edit the default recipe to point at the Java package for your platform.
+
+= USAGE:
+
+Simply include the recipe where you want Java installed. Note the respository requirement above to get the right package. On Debian and Ubuntu systems, the recipe will preseed the package and update java alternaties.
+
+= LICENSE and AUTHOR:
+
+Copyright 2008-2010, Opscode, Inc.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
11 cookbooks/java/files/default/java.seed
@@ -0,0 +1,11 @@
+sun-java6-bin shared/accepted-sun-dlj-v1-1 boolean true
+sun-java6-jdk shared/accepted-sun-dlj-v1-1 boolean true
+sun-java6-jre shared/accepted-sun-dlj-v1-1 boolean true
+sun-java6-jre sun-java6-jre/stopthread boolean true
+sun-java6-jre sun-java6-jre/jcepolicy note
+sun-java6-bin shared/error-sun-dlj-v1-1 error
+sun-java6-jdk shared/error-sun-dlj-v1-1 error
+sun-java6-jre shared/error-sun-dlj-v1-1 error
+sun-java6-bin shared/present-sun-dlj-v1-1 note
+sun-java6-jdk shared/present-sun-dlj-v1-1 note
+sun-java6-jre shared/present-sun-dlj-v1-1 note
35 cookbooks/java/metadata.json
@@ -0,0 +1,35 @@
+{
+ "dependencies": {
+ },
+ "replacing": {
+ },
+ "description": "Installs java",
+ "groupings": {
+ },
+ "platforms": {
+ "ubuntu": [
+
+ ],
+ "debian": [
+
+ ]
+ },
+ "version": "0.9.0",
+ "recommendations": {
+ },
+ "name": "java",
+ "maintainer": "Opscode, Inc.",
+ "long_description": "= DESCRIPTION:\n\nInstalls Java and Ant.\n\n= REQUIREMENTS:\n\nPlatform: Ubuntu, Debian, Red Hat, CentOS, Fedora.\n\nEnable the 'multiverse' repository on Ubuntu, 'non-free' on Debian or EPEL on RH/Cent/Fedora to get the Java package, or edit the default recipe to point at the Java package for your platform.\n\n= USAGE:\n\nSimply include the recipe where you want Java installed. Note the respository requirement above to get the right package. On Debian and Ubuntu systems, the recipe will preseed the package and update java alternaties.\n\n= LICENSE and AUTHOR:\n\nCopyright 2008-2010, Opscode, Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
+ "recipes": {
+ },
+ "suggestions": {
+ },
+ "maintainer_email": "cookbooks@opscode.com",
+ "attributes": {
+ },
+ "conflicting": {
+ },
+ "license": "Apache 2.0",
+ "providing": {
+ }
+ }
10 cookbooks/java/metadata.rb
@@ -0,0 +1,10 @@
+maintainer "Opscode, Inc."
+maintainer_email "cookbooks@opscode.com"
+license "Apache 2.0"
+description "Installs java"
+long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
+version "0.9"
+
+%w{ debian ubuntu }.each do |os|
+ supports os
+end
46 cookbooks/java/recipes/default.rb
@@ -0,0 +1,46 @@
+#
+# Cookbook Name:: java
+# Recipe:: default
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+java_pkg = value_for_platform(
+ [ "ubuntu", "debian" ] => {
+ "default" => "sun-java6-jdk"
+ },
+ [ "redhat", "centos", "fedora" ] => {
+ "default" => "java-1.6.0-openjdk"
+ },
+ "default" => "sun-java6-jdk"
+)
+
+execute "update-java-alternatives" do
+ command "update-java-alternatives --jre-headless -s java-6-sun"
+ only_if do platform?("ubuntu", "debian") end
+ ignore_failure true
+ returns 0
+ action :nothing
+end
+
+package java_pkg do
+ action :install
+ if platform?("ubuntu", "debian")
+ response_file "java.seed"
+ notifies :run, resources(:execute => "update-java-alternatives"), :immediately
+ end
+end
+
+package "ant"
95 cookbooks/mysql/README.rdoc
@@ -0,0 +1,95 @@
+= DESCRIPTION:
+
+Installs and configures MySQL client or server.
+
+= REQUIREMENTS:
+
+== Platform:
+
+Best tested on Ubuntu 9.04,9.10. On EC2, requires platform that supports -o bind option for the 'mount' command.
+
+== Cookbooks:
+
+Requires Opscode's openssl cookbook for secure password generation.
+
+= ATTRIBUTES:
+
+* mysql[:server_root_password] - Set the server's root password with this, default is a randomly generated password with OpenSSL::Random.random_bytes.
+* mysql[:server_repl_password] - Set the replication user 'repl' password with this, default is a randomly generated password with OpenSSL::Random.random_bytes.
+* mysql[:server_debian_password] - Set the debian-sys-maint user password with this, default is a randomly generated password with OpenSSL::Random.random_bytes.
+* mysql[:bind_address] - Listen address for MySQLd, default is node's ipaddress.
+* mysql[:datadir] - Location for mysql data directory, default is "/var/lib/mysql"
+* mysql[:ec2_path] - location of mysql datadir on EC2 nodes, default "/mnt/mysql"
+
+Performance tuning attributes, each corresponds to the same-named parameter in my.cnf; default values listed
+
+* mysql[:tunable][:key_buffer] = "250M"
+* mysql[:tunable][:max_connections] = "800"
+* mysql[:tunable][:wait_timeout] = "180"
+* mysql[:tunable][:net_write_timeout] = "30"
+* mysql[:tunable][:net_write_timeout] = "30"
+* mysql[:tunable][:back_log] = "128"
+* mysql[:tunable][:table_cache] = "128"
+* mysql[:tunable][:max_heap_table_size] = "32M"
+
+= USAGE:
+
+On client nodes,
+
+ include_recipe "mysql::client"
+
+As the common use case is on systems with Ruby, we also install the MySQL RubyGem. Because we may want to be able to use the gem within another Chef recipe, we make sure the mysql development package and gem are installed first. The key is this:
+
+ r = package ... do
+ action :nothing
+ end
+
+ r.run_action(:install)
+
+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 :-). If you want to be able to access a MySQL database via Ruby within another recipe, you could do so, like so:
+
+ Gem.clear_paths # needed for Chef to find the gem...
+ require 'mysql' # requires the mysql gem
+
+ execute "create #{node[:railsapp][:db][:database]} database" do
+ command "/usr/bin/mysqladmin -u root -p#{node[:mysql][:server_root_password]} create #{node[:railsapp][:db][:database]}"
+ not_if do
+ m = Mysql.new("localhost", "root", @node[:mysql][:server_root_password])
+ m.list_dbs.include?(@node[:railsapp][:db][:database])
+ end
+ end
+
+On server nodes,
+
+ include_recipe "mysql::server"
+
+On Debian/Ubuntu this will preseed the MySQL package with the randomly generated root password. You can of course change the password afterward, but this makes sure that there's a good password set. You can view it in the node data in the Chef Server webui. Sets a new password for debian-sys-maint user as well.
+
+Also sets up 'repl' user grants for replication slaves.
+
+On EC2 nodes,
+
+ include_recipe "mysql::server_ec2"
+
+When the ec2_path doesn't exist we look for a mounted filesystem (eg, EBS) and move the datadir there.
+
+The client recipe is already included by server and 'default' recipes.
+
+= LICENSE and AUTHOR:
+
+Author:: Joshua Timberman (<joshua@opscode.com>)
+Author:: AJ Christensen (<aj@opscode.com>)
+
+Copyright:: 2009, Opscode, Inc
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
42 cookbooks/mysql/attributes/server.rb
@@ -0,0 +1,42 @@
+#
+# Cookbook Name:: mysql
+# Attributes:: server
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+::Chef::Node.send(:include, Opscode::OpenSSL::Password)
+
+set_unless[:mysql][:server_debian_password] = secure_password
+set_unless[:mysql][:server_root_password] = secure_password
+set_unless[:mysql][:server_repl_password] = secure_password
+set_unless[:mysql][:bind_address] = ipaddress
+set_unless[:mysql][:datadir] = "/var/lib/mysql"
+
+if attribute?(:ec2)
+ set_unless[:mysql][:ec2_path] = "/mnt/mysql"
+ set_unless[:mysql][:ebs_vol_dev] = "/dev/sdi"
+ set_unless[:mysql][:ebs_vol_size] = 50
+end
+
+# Tunables
+set_unless[:mysql][:tunable][:key_buffer] = "250M"
+set_unless[:mysql][:tunable][:max_connections] = "800"
+set_unless[:mysql][:tunable][:wait_timeout] = "180"
+set_unless[:mysql][:tunable][:net_read_timeout] = "30"
+set_unless[:mysql][:tunable][:net_write_timeout] = "30"
+set_unless[:mysql][:tunable][:back_log] = "128"
+set_unless[:mysql][:tunable][:table_cache] = "128"
+set_unless[:mysql][:tunable][:max_heap_table_size] = "32M"
15 cookbooks/mysql/libraries/database.rb
@@ -0,0 +1,15 @@
+begin
+ require 'mysql'
+rescue LoadError
+ Chef::Log.warn("Missing gem 'mysql'")
+end
+
+module Opscode
+ module Mysql
+ module Database
+ def db
+ @@db ||= ::Mysql.new new_resource.host, new_resource.username, new_resource.password
+ end
+ end
+ end
+end
214 cookbooks/mysql/metadata.json
@@ -0,0 +1,214 @@
+{
+ "dependencies": {
+ "openssl": [
+
+ ]
+ },
+ "replacing": {
+ },
+ "description": "Installs and configures mysql for client or server",
+ "groupings": {
+ },
+ "platforms": {
+ "ubuntu": [
+
+ ],
+ "debian": [
+
+ ]
+ },
+ "version": "0.15.0",
+ "recommendations": {
+ },
+ "name": "mysql",
+ "maintainer": "Opscode, Inc.",
+ "long_description": "= DESCRIPTION:\n\nInstalls and configures MySQL client or server.\n\n= REQUIREMENTS:\n\n== Platform:\n\nBest tested on Ubuntu 9.04,9.10. On EC2, requires platform that supports -o bind option for the 'mount' command.\n\n== Cookbooks:\n\nRequires Opscode's openssl cookbook for secure password generation.\n\n= ATTRIBUTES: \n\n* mysql[:server_root_password] - Set the server's root password with this, default is a randomly generated password with OpenSSL::Random.random_bytes.\n* mysql[:server_repl_password] - Set the replication user 'repl' password with this, default is a randomly generated password with OpenSSL::Random.random_bytes.\n* mysql[:server_debian_password] - Set the debian-sys-maint user password with this, default is a randomly generated password with OpenSSL::Random.random_bytes.\n* mysql[:bind_address] - Listen address for MySQLd, default is node's ipaddress.\n* mysql[:datadir] - Location for mysql data directory, default is \"/var/lib/mysql\" \n* mysql[:ec2_path] - location of mysql datadir on EC2 nodes, default \"/mnt/mysql\" \n\nPerformance tuning attributes, each corresponds to the same-named parameter in my.cnf; default values listed\n\n* mysql[:tunable][:key_buffer] = \"250M\"\n* mysql[:tunable][:max_connections] = \"800\" \n* mysql[:tunable][:wait_timeout] = \"180\" \n* mysql[:tunable][:net_write_timeout] = \"30\" \n* mysql[:tunable][:net_write_timeout] = \"30\" \n* mysql[:tunable][:back_log] = \"128\" \n* mysql[:tunable][:table_cache] = \"128\" \n* mysql[:tunable][:max_heap_table_size] = \"32M\" \n\n= USAGE:\n\nOn client nodes,\n\n include_recipe \"mysql::client\"\n \nAs the common use case is on systems with Ruby, we also install the MySQL RubyGem. Because we may want to be able to use the gem within another Chef recipe, we make sure the mysql development package and gem are installed first. The key is this:\n\n r = package ... do\n action :nothing\n end\n \n r.run_action(:install)\n \nThis 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 :-). If you want to be able to access a MySQL database via Ruby within another recipe, you could do so, like so:\n\n Gem.clear_paths # needed for Chef to find the gem...\n require 'mysql' # requires the mysql gem\n\n execute \"create #{node[:railsapp][:db][:database]} database\" do\n command \"/usr/bin/mysqladmin -u root -p#{node[:mysql][:server_root_password]} create #{node[:railsapp][:db][:database]}\"\n not_if do\n m = Mysql.new(\"localhost\", \"root\", @node[:mysql][:server_root_password])\n m.list_dbs.include?(@node[:railsapp][:db][:database])\n end\n end\n\nOn server nodes, \n\n include_recipe \"mysql::server\"\n \nOn Debian/Ubuntu this will preseed the MySQL package with the randomly generated root password. You can of course change the password afterward, but this makes sure that there's a good password set. You can view it in the node data in the Chef Server webui. Sets a new password for debian-sys-maint user as well.\n\nAlso sets up 'repl' user grants for replication slaves.\n\nOn EC2 nodes,\n\n include_recipe \"mysql::server_ec2\"\n \nWhen the ec2_path doesn't exist we look for a mounted filesystem (eg, EBS) and move the datadir there.\n\nThe client recipe is already included by server and 'default' recipes.\n\n= LICENSE and AUTHOR:\n \nAuthor:: Joshua Timberman (<joshua@opscode.com>)\nAuthor:: AJ Christensen (<aj@opscode.com>)\n\nCopyright:: 2009, Opscode, Inc\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
+ "recipes": {
+ "mysql::client": "Installs packages required for mysql clients using run_action magic",
+ "mysql::server_ec2": "Performs EC2-specific mountpoint manipulation",
+ "mysql::server": "Installs packages required for mysql servers w/o manual intervention"
+ },
+ "suggestions": {
+ },
+ "maintainer_email": "cookbooks@opscode.com",
+ "attributes": {
+ "mysql/datadir": {
+ "calculated": false,
+ "default": "/var/lib/mysql",
+ "type": "string",
+ "choice": [
+
+ ],
+ "description": "Location of mysql databases",
+ "display_name": "MySQL Data Directory",
+ "recipes": [
+
+ ],
+ "required": "optional"
+ },
+ "mysql/bind_address": {
+ "calculated": false,
+ "default": "ipaddress",
+ "type": "string",
+ "choice": [
+
+ ],
+ "description": "Address that mysqld should listen on",
+ "display_name": "MySQL Bind Address",
+ "recipes": [
+
+ ],
+ "required": "optional"
+ },
+ "mysql/tunable/back_log": {
+ "calculated": false,
+ "default": "128",
+ "type": "string",
+ "choice": [
+
+ ],
+ "display_name": "MySQL Tunable Back Log",
+ "recipes": [
+
+ ],
+ "required": "optional"
+ },
+ "mysql/tunable/wait_timeout": {
+ "calculated": false,
+ "default": "180",
+ "type": "string",
+ "choice": [
+
+ ],
+ "display_name": "MySQL Tunable Wait Timeout",
+ "recipes": [
+
+ ],
+ "required": "optional"
+ },
+ "mysql/tunable/table_cache": {
+ "calculated": false,
+ "default": "128",
+ "type": "string",
+ "choice": [
+
+ ],
+ "display_name": "MySQL Tunable Table Cache",
+ "recipes": [
+
+ ],
+ "required": "optional"
+ },
+ "mysql/ec2_path": {
+ "calculated": false,
+ "default": "/mnt/mysql",
+ "type": "string",
+ "choice": [
+
+ ],
+ "description": "Location of mysql directory on EC2 instance EBS volumes",
+ "display_name": "MySQL EC2 Path",
+ "recipes": [
+
+ ],
+ "required": "optional"
+ },
+ "mysql/tunable/net_read_timeout": {
+ "calculated": false,
+ "default": "30",
+ "type": "string",
+ "choice": [
+
+ ],
+ "display_name": "MySQL Tunable Net Read Timeout",
+ "recipes": [
+
+ ],
+ "required": "optional"
+ },
+ "mysql/tunable": {
+ "calculated": false,
+ "type": "hash",
+ "choice": [
+
+ ],
+ "description": "Hash of MySQL tunable attributes",
+ "display_name": "MySQL Tunables",
+ "recipes": [
+
+ ],
+ "required": "optional"
+ },
+ "mysql/tunable/max_connections": {
+ "calculated": false,
+ "default": "800",
+ "type": "string",
+ "choice": [
+
+ ],
+ "display_name": "MySQL Tunable Max Connections",
+ "recipes": [
+
+ ],
+ "required": "optional"
+ },
+ "mysql/server_root_password": {
+ "calculated": false,
+ "default": "randomly generated",
+ "type": "string",
+ "choice": [
+
+ ],
+ "description": "Randomly generated password for the mysqld root user",
+ "display_name": "MySQL Server Root Password",
+ "recipes": [
+
+ ],
+ "required": "optional"
+ },
+ "mysql/tunable/max_heap_table_size": {
+ "calculated": false,
+ "default": "32M",
+ "type": "string",
+ "choice": [
+
+ ],
+ "display_name": "MySQL Tunable Max Heap Table Size",
+ "recipes": [
+
+ ],
+ "required": "optional"
+ },
+ "mysql/tunable/net_write_timeout": {
+ "calculated": false,
+ "default": "30",
+ "type": "string",
+ "choice": [
+
+ ],
+ "display_name": "MySQL Tunable Net Write Timeout",
+ "recipes": [
+
+ ],
+ "required": "optional"
+ },
+ "mysql/tunable/key_buffer": {
+ "calculated": false,
+ "default": "250M",
+ "type": "string",
+ "choice": [
+
+ ],
+ "display_name": "MySQL Tuntable Key Buffer",
+ "recipes": [
+
+ ],
+ "required": "optional"
+ }
+ },
+ "conflicting": {
+ },
+ "license": "Apache 2.0",
+ "providing": {
+ }
+ }
73 cookbooks/mysql/metadata.rb
@@ -0,0 +1,73 @@
+maintainer "Opscode, Inc."
+maintainer_email "cookbooks@opscode.com"
+license "Apache 2.0"
+description "Installs and configures mysql for client or server"
+long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
+version "0.15"
+recipe "mysql::client", "Installs packages required for mysql clients using run_action magic"
+recipe "mysql::server", "Installs packages required for mysql servers w/o manual intervention"
+recipe "mysql::server_ec2", "Performs EC2-specific mountpoint manipulation"
+
+%w{ debian ubuntu }.each do |os|
+ supports os
+end
+
+depends "openssl"
+
+attribute "mysql/server_root_password",
+ :display_name => "MySQL Server Root Password",
+ :description => "Randomly generated password for the mysqld root user",
+ :default => "randomly generated"
+
+attribute "mysql/bind_address",
+ :display_name => "MySQL Bind Address",
+ :description => "Address that mysqld should listen on",
+ :default => "ipaddress"
+
+attribute "mysql/datadir",
+ :display_name => "MySQL Data Directory",
+ :description => "Location of mysql databases",
+ :default => "/var/lib/mysql"
+
+attribute "mysql/ec2_path",
+ :display_name => "MySQL EC2 Path",
+ :description => "Location of mysql directory on EC2 instance EBS volumes",
+ :default => "/mnt/mysql"
+
+attribute "mysql/tunable",
+ :display_name => "MySQL Tunables",
+ :description => "Hash of MySQL tunable attributes",
+ :type => "hash"
+
+attribute "mysql/tunable/key_buffer",
+ :display_name => "MySQL Tuntable Key Buffer",
+ :default => "250M"
+
+attribute "mysql/tunable/max_connections",
+ :display_name => "MySQL Tunable Max Connections",
+ :default => "800"
+
+attribute "mysql/tunable/wait_timeout",
+ :display_name => "MySQL Tunable Wait Timeout",
+ :default => "180"
+
+attribute "mysql/tunable/net_read_timeout",
+ :display_name => "MySQL Tunable Net Read Timeout",
+ :default => "30"
+
+attribute "mysql/tunable/net_write_timeout",
+ :display_name => "MySQL Tunable Net Write Timeout",
+ :default => "30"
+
+attribute "mysql/tunable/back_log",
+ :display_name => "MySQL Tunable Back Log",
+ :default => "128"
+
+attribute "mysql/tunable/table_cache",
+ :display_name => "MySQL Tunable Table Cache",
+ :default => "128"
+
+attribute "mysql/tunable/max_heap_table_size",
+ :display_name => "MySQL Tunable Max Heap Table Size",
+ :default => "32M"
+
13 cookbooks/mysql/providers/database.rb
@@ -0,0 +1,13 @@
+include Opscode::Mysql::Database
+
+action :flush_tables_with_read_lock do
+ Chef::Log.info "mysql_database: flushing tables with read lock"
+ db.query "flush tables with read lock"
+ new_resource.updated = true
+end
+
+action :unflush_tables do
+ Chef::Log.info "mysql_database: unlocking tables"
+ db.query "unlock tables"
+ new_resource.updated = true
+end
50 cookbooks/mysql/recipes/client.rb
@@ -0,0 +1,50 @@
+#
+# Cookbook Name:: mysql
+# Recipe:: client
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+p = package "mysql-devel" do
+ package_name value_for_platform(
+ [ "centos", "redhat", "suse" ] => { "default" => "mysql-devel" },
+ "default" => 'libmysqlclient15-dev'
+ )
+ action :nothing
+end
+
+p.run_action(:install)
+
+package "mysql-client" do
+ package_name value_for_platform(
+ [ "centos", "redhat", "suse" ] => { "default" => "mysql" },
+ "default" => "mysql-client"
+ )
+ action :install
+end
+
+case node[:platform]
+when "centos","redhat", "suse"
+ package "ruby-mysql" do
+ action :install
+ end
+
+else
+ r = gem_package "mysql" do
+ action :nothing
+ end
+
+ r.run_action(:install)
+end
20 cookbooks/mysql/recipes/default.rb
@@ -0,0 +1,20 @@
+#
+# Cookbook Name:: mysql
+# Recipe:: default
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+include_recipe "mysql::client"
82 cookbooks/mysql/recipes/server.rb
@@ -0,0 +1,82 @@
+#
+# Cookbook Name:: mysql
+# Recipe:: default
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+include_recipe "mysql::client"
+
+case node[:platform]
+when "debian","ubuntu"
+
+ directory "/var/cache/local/preseeding" do
+ owner "root"
+ group "root"
+ mode 0755
+ recursive true
+ end
+
+ execute "preseed mysql-server" do
+ command "debconf-set-selections /var/cache/local/preseeding/mysql-server.seed"
+ action :nothing
+ end
+
+ template "/var/cache/local/preseeding/mysql-server.seed" do
+ source "mysql-server.seed.erb"
+ owner "root"
+ group "root"
+ mode "0600"
+ notifies :run, resources(:execute => "preseed mysql-server"), :immediately
+ end
+end
+
+package "mysql-server" do
+ action :install
+end
+
+service "mysql" do
+ service_name value_for_platform([ "centos", "redhat", "suse" ] => {"default" => "mysqld"}, "default" => "mysql")
+
+ supports :status => true, :restart => true, :reload => true
+ action :enable
+end
+
+template value_for_platform([ "centos", "redhat", "suse" ] => {"default" => "/etc/my.cnf"}, "default" => "/etc/mysql/my.cnf") do
+ source "my.cnf.erb"
+ owner "root"
+ group "root"
+ mode "0644"
+ notifies :restart, resources(:service => "mysql"), :immediately
+end
+
+begin
+ t = resources(:template => "/etc/mysql/grants.sql")
+rescue
+ Chef::Log.warn("Could not find previously defined grants.sql resource")
+ t = template "/etc/mysql/grants.sql" do
+ source "grants.sql.erb"
+ owner "root"
+ group "root"
+ mode "0600"
+ action :create
+ end
+end
+
+execute "mysql-install-privileges" do
+ command "/usr/bin/mysql -u root -p#{node[:mysql][:server_root_password]} < /etc/mysql/grants.sql"
+ action :nothing
+ subscribes :run, resources(:template => "/etc/mysql/grants.sql")
+end
49 cookbooks/mysql/recipes/server_ec2.rb
@@ -0,0 +1,49 @@
+#
+# Cookbook Name:: mysql
+# Recipe:: default
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+
+if (node[:ec2] && ! FileTest.directory?(node[:mysql][:ec2_path]))
+
+ service "mysql" do
+ action :stop
+ end
+
+ execute "install-mysql" do
+ command "mv #{node[:mysql][:datadir]} #{node[:mysql][:ec2_path]}"
+ not_if do FileTest.directory?(node[:mysql][:ec2_path]) end
+ end
+
+ directory node[:mysql][:ec2_path] do
+ owner "mysql"
+ group "mysql"
+ end
+
+ mount node[:mysql][:datadir] do
+ device node[:mysql][:ec2_path]
+ fstype "none"
+ options "bind,rw"
+ action :mount
+ end
+
+ service "mysql" do
+ action :start
+ end
+
+end
+
5 cookbooks/mysql/resources/database.rb
@@ -0,0 +1,5 @@
+actions :flush_tables_with_read_lock, :unflush_tables
+
+attribute :host, :kind_of => String
+attribute :username, :kind_of => String
+attribute :password, :kind_of => String
12 cookbooks/mysql/templates/centos/my.cnf.erb
@@ -0,0 +1,12 @@
+[mysqld]
+datadir=/var/lib/mysql
+socket=/var/lib/mysql/mysql.sock
+user=mysql
+# Default to using old password format for compatibility with mysql 3.x
+# clients (those using the mysqlclient10 compatibility package).
+old_passwords=1
+
+[mysqld_safe]
+log-error=/var/log/mysqld.log
+pid-file=/var/run/mysqld/mysqld.pid
+
11 cookbooks/mysql/templates/default/debian.cnf.erb
@@ -0,0 +1,11 @@
+[client]
+host = localhost
+user = debian-sys-maint
+password = <%= @node[:mysql][:server_debian_password] %>
+socket = /var/run/mysqld/mysqld.sock
+[mysql_upgrade]
+host = localhost
+user = debian-sys-maint
+password = <%= @node[:mysql][:server_debian_password] %>
+socket = /var/run/mysqld/mysqld.sock
+basedir = /usr
12 cookbooks/mysql/templates/default/grants.sql.erb
@@ -0,0 +1,12 @@
+# Generated by Chef for <%= @node[:fqdn] %>.
+# Local modifications will be overwritten.
+
+<% case @node[:platform] -%>
+<% when "debian","ubuntu" -%>
+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;
+<% end -%>
+# Grant replication for a slave user.
+GRANT REPLICATION SLAVE ON *.* TO 'repl'@'%' identified by '<%= @node[:mysql][:server_repl_password] %>';
+
+# Set the server root password. This should be preseeded by the package installation.
+SET PASSWORD FOR 'root'@'localhost' = PASSWORD('<%= @node[:mysql][:server_root_password] %>');
163 cookbooks/mysql/templates/default/my.cnf.erb
@@ -0,0 +1,163 @@
+#
+# Generated by Chef for <%= @node[:hostname] %>
+#
+# Local modifications will be overwritten.
+#
+# The MySQL database server configuration file.
+#
+# You can copy this to one of:
+# - "/etc/mysql/my.cnf" to set global options,
+# - "~/.my.cnf" to set user-specific options.
+#
+# One can use all long options that the program supports.
+# Run program with --help to get a list of available options and with
+# --print-defaults to see which it would actually understand and use.
+#
+# For explanations see
+# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
+
+# This will be passed to all mysql clients
+# It has been reported that passwords should be enclosed with ticks/quotes
+# escpecially if they contain "#" chars...
+# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
+[client]
+port = 3306
+socket = /var/run/mysqld/mysqld.sock
+
+# Here is entries for some specific programs
+# The following values assume you have at least 32M ram
+
+# This was formally known as [safe_mysqld]. Both versions are currently parsed.
+[mysqld_safe]
+socket = /var/run/mysqld/mysqld.sock
+nice = 0
+
+[mysqld]
+#
+# * Basic Settings
+#
+
+#
+# * IMPORTANT
+# If you make changes to these settings and your system uses apparmor, you may
+# also need to also adjust /etc/apparmor.d/usr.sbin.mysqld.
+#
+
+user = mysql
+pid-file = /var/run/mysqld/mysqld.pid
+socket = /var/run/mysqld/mysqld.sock
+port = 3306
+basedir = /usr
+datadir = <%= @node[:mysql][:datadir] %>
+tmpdir = /tmp
+skip-external-locking
+#
+# Instead of skip-networking the default is now to listen only on
+# localhost which is more compatible and is not less secure.
+bind-address = <%= @node[:mysql][:bind_address] %>
+#
+# * Fine Tuning
+#
+key_buffer = <%= @node[:mysql][:tunable][:key_buffer] %>
+max_allowed_packet = 16M
+thread_stack = 128K
+thread_cache_size = 8
+# This replaces the startup script and checks MyISAM tables if needed
+# the first time they are touched
+myisam-recover = BACKUP
+#max_connections = 100
+#table_cache = 64
+#thread_concurrency = 10
+max_connections = <%= @node[:mysql][:tunable][:max_connections] %>
+wait_timeout = <%= @node[:mysql][:tunable][:wait_timeout] %>
+net_read_timeout = <%= @node[:mysql][:tunable][:net_read_timeout] %>
+net_write_timeout = <%= @node[:mysql][:tunable][:net_write_timeout] %>
+back_log = <%= @node[:mysql][:tunable][:back_log] %>
+table_cache = <%= @node[:mysql][:tunable][:table_cache] %>
+max_heap_table_size = <%= @node[:mysql][:tunable][:max_heap_table_size] %>
+
+#
+# * Query Cache Configuration
+#
+query_cache_limit = 1M
+query_cache_size = 16M
+#
+# * Logging and Replication
+#
+# Both location gets rotated by the cronjob.
+# Be aware that this log type is a performance killer.
+#log = /var/log/mysql/mysql.log
+#
+# Error logging goes to syslog. This is a Debian improvement :)
+#
+# Here you can see queries with especially long duration
+log_slow_queries = /var/log/mysql/mysql-slow.log
+long_query_time = 2
+log-queries-not-using-indexes
+#
+# The following can be used as easy to replay backup logs or for replication.
+# note: if you are setting up a replication slave, see README.Debian about
+# other settings you may need to change.
+#server-id = 1
+#log_bin = /var/log/mysql/mysql-bin.log
+expire_logs_days = 10
+max_binlog_size = 100M
+#binlog_do_db = include_database_name
+#binlog_ignore_db = include_database_name
+#
+# * BerkeleyDB
+#
+# Using BerkeleyDB is now discouraged as its support will cease in 5.1.12.
+skip-bdb
+#
+# * InnoDB
+#
+# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
+# Read the manual for more InnoDB related options. There are many!
+# You might want to disable InnoDB to shrink the mysqld process by circa 100MB.
+#skip-innodb
+#
+# * Federated
+#
+# The FEDERATED storage engine is disabled since 5.0.67 by default in the .cnf files
+# shipped with MySQL distributions (my-huge.cnf, my-medium.cnf, and so forth).
+#
+skip-federated
+#
+# * Security Features
+#
+# Read the manual, too, if you want chroot!
+# chroot = /var/lib/mysql/
+#
+# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
+#
+# ssl-ca=/etc/mysql/cacert.pem
+# ssl-cert=/etc/mysql/server-cert.pem
+# ssl-key=/etc/mysql/server-key.pem
+
+[mysqldump]
+quick
+quote-names
+max_allowed_packet = 16M
+
+[mysql]
+#no-auto-rehash # faster start of mysql but no tab completition
+
+[isamchk]
+key_buffer = 16M
+
+#
+# * NDB Cluster
+#
+# See /usr/share/doc/mysql-server-*/README.Debian for more information.
+#
+# The following configuration is read by the NDB Data Nodes (ndbd processes)
+# not from the NDB Management Nodes (ndb_mgmd processes).
+#
+# [MYSQL_CLUSTER]
+# ndb-connectstring=127.0.0.1
+#
+# * IMPORTANT: Additional settings that can override those from this file!
+# The files must end with '.cnf', otherwise they'll be ignored.
+#
+<%= "!includedir /etc/mysql/conf.d/" unless ["centos", "redhat","suse"].include?(@node[:platform]) %>
10 cookbooks/mysql/templates/default/mysql-server.seed.erb
@@ -0,0 +1,10 @@
+mysql-server-5.0 mysql-server/root_password_again select <%= @node[:mysql][:server_root_password] %>
+mysql-server-5.0 mysql-server/root_password select <%= @node[:mysql][:server_root_password] %>
+mysql-server-5.0 mysql-server-5.0/really_downgrade boolean false
+mysql-server-5.0 mysql-server-5.0/need_sarge_compat boolean false
+mysql-server-5.0 mysql-server-5.0/start_on_boot boolean true
+mysql-server-5.0 mysql-server/error_setting_password boolean false
+mysql-server-5.0 mysql-server-5.0/nis_warning note
+mysql-server-5.0 mysql-server-5.0/postrm_remove_databases boolean false
+mysql-server-5.0 mysql-server/password_mismatch boolean false
+mysql-server-5.0 mysql-server-5.0/need_sarge_compat_done boolean true
3  cookbooks/mysql/templates/default/port_mysql.erb
@@ -0,0 +1,3 @@
+# MySQL
+-A FWR -p tcp -m tcp --dport 3306 -j ACCEPT
+-A FWR -p udp -m udp --dport 3306 -j ACCEPT
12 cookbooks/mysql/templates/redhat/my.cnf.erb
@@ -0,0 +1,12 @@
+[mysqld]
+datadir=/var/lib/mysql
+socket=/var/lib/mysql/mysql.sock
+user=mysql
+# Default to using old password format for compatibility with mysql 3.x
+# clients (those using the mysqlclient10 compatibility package).
+old_passwords=1
+
+[mysqld_safe]
+log-error=/var/log/mysqld.log
+pid-file=/var/run/mysqld/mysqld.pid
+
156 cookbooks/mysql/templates/ubuntu-8.04/my.cnf.erb
@@ -0,0 +1,156 @@
+#
+# Generated by Chef for <%= @node[:hostname] %>
+#
+# Local modifications will be overwritten.
+#
+# The MySQL database server configuration file.
+#
+# You can copy this to one of:
+# - "/etc/mysql/my.cnf" to set global options,
+# - "~/.my.cnf" to set user-specific options.
+#
+# One can use all long options that the program supports.
+# Run program with --help to get a list of available options and with
+# --print-defaults to see which it would actually understand and use.
+#
+# For explanations see
+# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
+
+# This will be passed to all mysql clients
+# It has been reported that passwords should be enclosed with ticks/quotes
+# escpecially if they contain "#" chars...
+# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
+[client]
+port = 3306
+socket = /var/run/mysqld/mysqld.sock
+
+# Here is entries for some specific programs
+# The following values assume you have at least 32M ram
+
+# This was formally known as [safe_mysqld]. Both versions are currently parsed.
+[mysqld_safe]
+socket = /var/run/mysqld/mysqld.sock
+nice = 0
+
+[mysqld]
+#
+# * Basic Settings
+#
+
+#
+# * IMPORTANT
+# If you make changes to these settings and your system uses apparmor, you may
+# also need to also adjust /etc/apparmor.d/usr.sbin.mysqld.
+#
+
+user = mysql
+pid-file = /var/run/mysqld/mysqld.pid
+socket = /var/run/mysqld/mysqld.sock
+port = 3306
+basedir = /usr
+datadir = <%= @node[:mysql][:datadir] %>
+tmpdir = /tmp
+skip-external-locking
+#
+# Instead of skip-networking the default is now to listen only on
+# localhost which is more compatible and is not less secure.
+bind-address = <%= @node[:mysql][:bind_address] %>
+#
+# * Fine Tuning
+#
+key_buffer = <%= @node[:mysql][:tunable][:key_buffer] %>
+max_allowed_packet = 16M
+thread_stack = 128K
+thread_cache_size = 8
+# This replaces the startup script and checks MyISAM tables if needed
+# the first time they are touched
+myisam-recover = BACKUP
+#max_connections = 100
+#table_cache = 64
+#thread_concurrency = 10
+max_connections = <%= @node[:mysql][:tunable][:max_connections] %>
+wait_timeout = <%= @node[:mysql][:tunable][:wait_timeout] %>
+net_read_timeout = <%= @node[:mysql][:tunable][:net_read_timeout] %>
+net_write_timeout = <%= @node[:mysql][:tunable][:net_write_timeout] %>
+back_log = <%= @node[:mysql][:tunable][:back_log] %>
+table_cache = <%= @node[:mysql][:tunable][:table_cache] %>
+max_heap_table_size = <%= @node[:mysql][:tunable][:max_heap_table_size] %>
+
+#
+# * Query Cache Configuration
+#
+query_cache_limit = 1M
+query_cache_size = 16M
+#
+# * Logging and Replication
+#
+# Both location gets rotated by the cronjob.
+# Be aware that this log type is a performance killer.
+#log = /var/log/mysql/mysql.log
+#
+# Error logging goes to syslog. This is a Debian improvement :)
+#
+# Here you can see queries with especially long duration
+log_slow_queries = /var/log/mysql/mysql-slow.log
+long_query_time = 2
+log-queries-not-using-indexes
+#
+# The following can be used as easy to replay backup logs or for replication.
+# note: if you are setting up a replication slave, see README.Debian about
+# other settings you may need to change.
+#server-id = 1
+#log_bin = /var/log/mysql/mysql-bin.log
+expire_logs_days = 10
+max_binlog_size = 100M
+#binlog_do_db = include_database_name
+#binlog_ignore_db = include_database_name
+#
+# * BerkeleyDB
+#
+# Using BerkeleyDB is now discouraged as its support will cease in 5.1.12.
+skip-bdb
+#
+# * InnoDB
+#
+# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
+# Read the manual for more InnoDB related options. There are many!
+# You might want to disable InnoDB to shrink the mysqld process by circa 100MB.
+#skip-innodb
+#
+# * Security Features
+#
+# Read the manual, too, if you want chroot!
+# chroot = /var/lib/mysql/
+#
+# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
+#
+# ssl-ca=/etc/mysql/cacert.pem
+# ssl-cert=/etc/mysql/server-cert.pem
+# ssl-key=/etc/mysql/server-key.pem
+
+[mysqldump]
+quick
+quote-names
+max_allowed_packet = 16M
+
+[mysql]
+#no-auto-rehash # faster start of mysql but no tab completition
+
+[isamchk]
+key_buffer = 16M
+
+#
+# * NDB Cluster
+#
+# See /usr/share/doc/mysql-server-*/README.Debian for more information.
+#
+# The following configuration is read by the NDB Data Nodes (ndbd processes)
+# not from the NDB Management Nodes (ndb_mgmd processes).
+#
+# [MYSQL_CLUSTER]
+# ndb-connectstring=127.0.0.1
+#
+# * IMPORTANT: Additional settings that can override those from this file!
+# The files must end with '.cnf', otherwise they'll be ignored.
+#
+<%= "!includedir /etc/mysql/conf.d/" unless ["centos", "redhat","suse"].include?(@node[:platform]) %>
158 cookbooks/mysql/templates/ubuntu-9.10/my.cnf.erb
@@ -0,0 +1,158 @@
+#
+# Generated by Chef for <%= @node[:hostname] %>
+#
+# Local modifications will be overwritten.
+#
+# The MySQL database server configuration file.
+#
+# You can copy this to one of:
+# - "/etc/mysql/my.cnf" to set global options,
+# - "~/.my.cnf" to set user-specific options.
+#
+# One can use all long options that the program supports.
+# Run program with --help to get a list of available options and with
+# --print-defaults to see which it would actually understand and use.
+#
+# For explanations see
+# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
+
+# This will be passed to all mysql clients
+# It has been reported that passwords should be enclosed with ticks/quotes
+# escpecially if they contain "#" chars...
+# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
+[client]
+port = 3306
+socket = /var/run/mysqld/mysqld.sock
+
+# Here is entries for some specific programs
+# The following values assume you have at least 32M ram
+
+# This was formally known as [safe_mysqld]. Both versions are currently parsed.
+[mysqld_safe]
+socket = /var/run/mysqld/mysqld.sock
+nice = 0
+
+[mysqld]
+#
+# * Basic Settings
+#
+
+#
+# * IMPORTANT
+# If you make changes to these settings and your system uses apparmor, you may
+# also need to also adjust /etc/apparmor.d/usr.sbin.mysqld.
+#
+
+user = mysql
+pid-file = /var/run/mysqld/mysqld.pid
+socket = /var/run/mysqld/mysqld.sock
+port = 3306
+basedir = /usr
+datadir = <%= @node[:mysql][:datadir] %>
+tmpdir = /tmp
+skip-external-locking
+#
+# Instead of skip-networking the default is now to listen only on
+# localhost which is more compatible and is not less secure.
+bind-address = <%= @node[:mysql][:bind_address] %>
+#
+# * Fine Tuning
+#
+key_buffer = <%= @node[:mysql][:tunable][:key_buffer] %>
+max_allowed_packet = 16M
+thread_stack = 192K
+thread_cache_size = 8
+# This replaces the startup script and checks MyISAM tables if needed
+# the first time they are touched
+myisam-recover = BACKUP
+#max_connections = 100
+#table_cache = 64
+#thread_concurrency = 10
+max_connections = <%= @node[:mysql][:tunable][:max_connections] %>
+wait_timeout = <%= @node[:mysql][:tunable][:wait_timeout] %>
+net_read_timeout = <%= @node[:mysql][:tunable][:net_read_timeout] %>
+net_write_timeout = <%= @node[:mysql][:tunable][:net_write_timeout] %>
+back_log = <%= @node[:mysql][:tunable][:back_log] %>
+table_cache = <%= @node[:mysql][:tunable][:table_cache] %>
+max_heap_table_size = <%= @node[:mysql][:tunable][:max_heap_table_size] %>
+
+#
+# * Query Cache Configuration
+#
+query_cache_limit = 1M
+query_cache_size = 16M
+#
+# * Logging and Replication
+#
+# Both location gets rotated by the cronjob.
+# Be aware that this log type is a performance killer.
+#log = /var/log/mysql/mysql.log
+#
+# Error logging goes to syslog. This is a Debian improvement :)
+#
+# Here you can see queries with especially long duration
+log_slow_queries = /var/log/mysql/mysql-slow.log
+long_query_time = 2
+log-queries-not-using-indexes
+#
+# The following can be used as easy to replay backup logs or for replication.
+# note: if you are setting up a replication slave, see README.Debian about
+# other settings you may need to change.
+#server-id = 1
+#log_bin = /var/log/mysql/mysql-bin.log
+expire_logs_days = 10
+max_binlog_size = 100M
+#binlog_do_db = include_database_name
+#binlog_ignore_db = include_database_name
+#
+# * InnoDB
+#
+# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
+# Read the manual for more InnoDB related options. There are many!
+# You might want to disable InnoDB to shrink the mysqld process by circa 100MB.
+#skip-innodb
+#
+# * Federated
+#
+# The FEDERATED storage engine is disabled since 5.0.67 by default in the .cnf files
+# shipped with MySQL distributions (my-huge.cnf, my-medium.cnf, and so forth).
+#
+skip-federated
+#
+# * Security Features
+#
+# Read the manual, too, if you want chroot!
+# chroot = /var/lib/mysql/
+#
+# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
+#
+# ssl-ca=/etc/mysql/cacert.pem
+# ssl-cert=/etc/mysql/server-cert.pem
+# ssl-key=/etc/mysql/server-key.pem
+
+[mysqldump]
+quick
+quote-names
+max_allowed_packet = 16M
+
+[mysql]
+#no-auto-rehash # faster start of mysql but no tab completition
+
+[isamchk]
+key_buffer = 16M
+
+#
+# * NDB Cluster
+#
+# See /usr/share/doc/mysql-server-*/README.Debian for more information.
+#
+# The following configuration is read by the NDB Data Nodes (ndbd processes)
+# not from the NDB Management Nodes (ndb_mgmd processes).
+#
+# [MYSQL_CLUSTER]
+# ndb-connectstring=127.0.0.1
+#
+# * IMPORTANT: Additional settings that can override those from this file!
+# The files must end with '.cnf', otherwise they'll be ignored.
+#
+<%= "!includedir /etc/mysql/conf.d/" unless ["centos", "redhat","suse"].include?(@node[:platform]) %>
33 cookbooks/openssl/README.rdoc
@@ -0,0 +1,33 @@
+= DESCRIPTION:
+
+Library provides a method to generate secure passwords for use in recipes.
+
+= REQUIREMENTS:
+
+OpenSSL Ruby bindings must be installed, which are a requirement for Chef anyway.
+
+= USAGE:
+
+Most often this will be used to generate a secure password for an attribute.
+
+ include Opscode::OpenSSL::Password
+
+ set_unless[:my_password] = secure_password
+
+= LICENSE and AUTHOR:
+
+Author:: Joshua Timberman (<joshua@opscode.com>)
+
+Copyright:: 2009, Opscode, Inc
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
37 cookbooks/openssl/libraries/secure_password.rb
@@ -0,0 +1,37 @@
+#
+# Cookbook Name:: openssl
+# Library:: secure_password
+# Author:: Joshua Timberman <joshua@opscode.com>
+#
+# Copyright 2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+require 'openssl'
+
+module Opscode
+ module OpenSSL
+ module Password
+ def secure_password
+ pw = String.new
+
+ while pw.length < 20
+ pw << ::OpenSSL::Random.random_bytes(1).gsub(/\W/, '')
+ end
+
+ pw
+ end
+ end
+ end
+end
29 cookbooks/openssl/metadata.json
@@ -0,0 +1,29 @@
+{
+ "dependencies": {
+ },
+ "replacing": {
+ },
+ "description": "Installs/Configures openssl",
+ "groupings": {
+ },
+ "platforms": {
+ },
+ "version": "0.1.0",
+ "recommendations": {
+ },
+ "name": "openssl",
+ "maintainer": "Opscode, Inc.",
+ "long_description": "= DESCRIPTION:\n\nLibrary provides a method to generate secure passwords for use in recipes.\n\n= REQUIREMENTS:\n\nOpenSSL Ruby bindings must be installed, which are a requirement for Chef anyway.\n\n= USAGE:\n\nMost often this will be used to generate a secure password for an attribute.\n\n include Opscode::OpenSSL::Password\n\n set_unless[:my_password] = secure_password\n\n= LICENSE and AUTHOR:\n\nAuthor:: Joshua Timberman (<joshua@opscode.com>)\n\nCopyright:: 2009, Opscode, Inc\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
+ "recipes": {
+ },
+ "suggestions": {
+ },
+ "maintainer_email": "cookbooks@opscode.com",
+ "attributes": {
+ },
+ "conflicting": {
+ },
+ "license": "Apache 2.0",
+ "providing": {
+ }
+ }
6 cookbooks/openssl/metadata.rb
@@ -0,0 +1,6 @@
+maintainer "Opscode, Inc."
+maintainer_email "cookbooks@opscode.com"
+license "Apache 2.0"
+description "Installs/Configures openssl"
+long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
+version "0.1"
19 cookbooks/openssl/recipes/default.rb
@@ -0,0 +1,19 @@
+#
+# Cookbook Name:: openssl
+# Recipe:: default
+#
+# Copyright 2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
45 cookbooks/postgresql/README.rdoc
@@ -0,0 +1,45 @@
+= DESCRIPTION:
+
+Installs and configures postgresql client or server.
+
+= REQUIREMENTS:
+
+== Platform:
+
+Tested on Ubuntu 8.10, but adapted from Red Hat Enterprise 5.0 based recipes.
+
+== Cookbooks:
+
+= ATTRIBUTES:
+
+* postgresql[:dir] - configuration file location.
+
+= USAGE:
+
+For clients:
+
+ include_recipe "postgresql::client"
+
+For server:
+
+ include_recipe "postgresql::server"
+
+(client is already included by server)
+
+= LICENSE and AUTHOR:
+
+Author:: Joshua Timberman (<joshua@opscode.com>)
+
+Copyright:: 2009, Opscode, Inc
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
27 cookbooks/postgresql/attributes/postgresql.rb
@@ -0,0 +1,27 @@
+#
+# Cookbook Name:: postgresql
+# Attributes:: postgresql
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+case platform
+when "redhat","centos","fedora","suse"
+ set[:postgresql][:dir] = "/var/lib/pgsql/data"
+when "debian","ubuntu"
+ set[:postgresql][:dir] = "/etc/postgresql/8.3/main"
+else
+ set[:postgresql][:dir] = "/etc/postgresql/8.3/main"
+end
57 cookbooks/postgresql/metadata.json
@@ -0,0 +1,57 @@
+{
+ "dependencies": {
+ },
+ "replacing": {
+ },
+ "description": "Installs and configures postgresql for clients or servers",
+ "groupings": {
+ },
+ "platforms": {
+ "ubuntu": [
+
+ ],
+ "rhel": [
+
+ ],
+ "centos": [
+
+ ],
+ "debian": [
+
+ ]
+ },
+ "version": "0.7.0",
+ "recommendations": {
+ },
+ "name": "postgresql",
+ "maintainer": "Opscode, Inc.",
+ "long_description": "= DESCRIPTION:\n\nInstalls and configures postgresql client or server.\n\n= REQUIREMENTS:\n\n== Platform:\n\nTested on Ubuntu 8.10, but adapted from Red Hat Enterprise 5.0 based recipes.\n\n== Cookbooks:\n\n= ATTRIBUTES: \n\n* postgresql[:dir] - configuration file location.\n\n= USAGE:\n\nFor clients:\n\n include_recipe \"postgresql::client\"\n \nFor server: \n\n include_recipe \"postgresql::server\"\n \n(client is already included by server)\n\n= LICENSE and AUTHOR:\n \nAuthor:: Joshua Timberman (<joshua@opscode.com>)\n\nCopyright:: 2009, Opscode, Inc\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
+ "recipes": {
+ "postgresql::server": "Installs postgresql server packages, templates",
+ "postgresql::client": "Installs postgresql client package(s)"
+ },
+ "suggestions": {
+ },
+ "maintainer_email": "cookbooks@opscode.com",
+ "attributes": {
+ "postgresql/dir": {
+ "calculated": false,
+ "default": "/etc/postgresql/8.3/main",
+ "type": "string",
+ "choice": [
+
+ ],
+ "description": "Location of the PostgreSQL databases",
+ "display_name": "PostgreSQL Directory",
+ "recipes": [
+
+ ],
+ "required": "optional"
+ }
+ },
+ "conflicting": {
+ },
+ "license": "Apache 2.0",
+ "providing": {
+ }
+ }
18 cookbooks/postgresql/metadata.rb
@@ -0,0 +1,18 @@
+maintainer "Opscode, Inc."
+maintainer_email "cookbooks@opscode.com"
+license "Apache 2.0"
+description "Installs and configures postgresql for clients or servers"
+long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
+version "0.7"
+recipe "postgresql::client", "Installs postgresql client package(s)"
+recipe "postgresql::server", "Installs postgresql server packages, templates"
+
+%w{rhel centos ubuntu debian}.each do |os|
+ supports os
+end
+
+attribute "postgresql/dir",
+ :display_name => "PostgreSQL Directory",
+ :description => "Location of the PostgreSQL databases",
+ :default => "/etc/postgresql/8.3/main"
+
25 cookbooks/postgresql/recipes/client.rb
@@ -0,0 +1,25 @@
+#
+# Cookbook Name:: postgresql
+# Recipe:: client
+#
+# Copyright 2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+case node[:platform]
+when "ubuntu","debian"
+ package "postgresql-client"
+when "redhat","centos","fedora"
+ package "postgresql-devel"
+end
18 cookbooks/postgresql/recipes/default.rb
@@ -0,0 +1,18 @@
+#
+# Cookbook Name:: postgresql
+# Recipe:: default
+#
+# Copyright 2009, Opscode, Inc.