broadinstitute/mysql

Name: mysql

Owner: Broad Institute

Description: Development repository for Opscode Cookbook mysql

Created: 2014-03-17 17:25:40.0

Updated: 2015-01-13 20:16:16.0

Pushed: 2014-03-17 17:25:59.0

Homepage: http://community.opscode.com/cookbooks/mysql

Size: 674

Language: Ruby

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

mysql Cookbook

Build Status

Installs and configures MySQL client or server.

Requirements

Chef 0.10.10+.

Platform

Tested on:

See TESTING.md for information about running tests in Opscode's Test Kitchen.

Cookbooks

Requires Opscode's openssl cookbook for secure password generation. See Attributes and Usage for more information.

The RubyGem installation in the mysql::ruby recipe requires a C compiler and Ruby development headers to be installed in order to build the mysql gem.

Requires homebrew cookbook on Mac OS X.

Resources and Providers

The LWRP that used to ship as part of this cookbook has been refactored into the database cookbook. Please see the README for details on updated usage.

Attributes

See the attributes/server.rb or attributes/client.rb for default values. Several attributes have values that vary based on the node's platform and version.

Performance and other “tunable” attributes are under the node['mysql']['tunable'] attribute, corresponding to the same-named parameter in my.cnf, and the default values are used. See attributes/server.rb.

By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment.

Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network.

By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. This will also drop any user privileges to the test database and any DB named test_% .

The following attributes are randomly generated passwords handled in the mysql::server recipe, using the OpenSSL cookbook's secure_password helper method. These are set using the set_unless node attribute method, which allows them to be easily overridden e.g. in a role.

Windows Specific

The following attributes are specific to Windows platforms.

Security Options

Further information is already available at Symantec and Deutsche Telekom (German)

Usage

On client nodes, use the client (or default) recipe:

un_list": ["recipe[mysql::client]"] }

This will install the MySQL client libraries and development headers on the system.

On nodes which may use the database cookbook's mysql resources, also use the ruby recipe. This installs the mysql RubyGem in the Ruby environment Chef is using via chef_gem.

un_list": ["recipe[mysql::client]", "recipe[mysql::ruby]"] }

If you need to install the mysql Ruby library as a package for your system, override the client packages attribute in your node or role. For example, on an Ubuntu system:


ysql": {
"client": {
  "packages": ["mysql-client", "libmysqlclient-dev","ruby-mysql"]
}


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 :-).

On server nodes, use the server recipe:

un_list": ["recipe[mysql::server]"] }

On Debian and Ubuntu, this will preseed the mysql-server package with the randomly generated root password in the recipe file. On other platforms, it simply installs the required packages. It will also create an SQL file, /etc/mysql/grants.sql, that will be used to set up grants for the root, repl and debian-sys-maint users.

The recipe will perform a node.save unless it is run under chef-solo after the password attributes are used to ensure that in the event of a failed run, the saved attributes would be used.

On EC2 nodes, use the server_ec2 recipe and the mysql data dir will be set up in the ephmeral storage.

un_list": ["recipe[mysql::server_ec2]"] }

When the ec2_path doesn't exist we look for a mounted filesystem (eg, EBS) and move the data_dir there.

The client recipe is already included by server and 'default' recipes.

For more infromation on the compile vs execution phase of a Chef run:

Chef Solo Note

These node attributes are stored on the Chef server when using chef-client. Because chef-solo does not connect to a server or save the node object at all, to have the same passwords persist across chef-solo runs, you must specify them in the json_attribs file used. For example:


ysql": {
"server_root_password": "iloverandompasswordsbutthiswilldo",
"server_repl_password": "iloverandompasswordsbutthiswilldo",
"server_debian_password": "iloverandompasswordsbutthiswilldo"

un_list":["recipe[mysql::server]"]

License & Authors
right:: 2009-2013 Opscode, Inc

nsed under the Apache License, Version 2.0 (the "License");
may not use this file except in compliance with the License.
may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

ss required by applicable law or agreed to in writing, software
ributed under the License is distributed on an "AS IS" BASIS,
OUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
the License for the specific language governing permissions and
tations under the License.

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.