Adoptable Cookbooks List

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

mysqld Cookbook

Manage your mysqld servers with this cookbook.
Unlike the official opscode mysql cookbook,
it doesn't mess with the default mysql configuration. If you do not specify anything explicitly, the
defaults of your distribution will be used.
(At least if I do not mess up - Check the
default attributes,
if unsure (and file a pull request if you need to correct anything))

Features

Defaults to OS settings unless explicitly specified otherwise

Supports all my.cnf settings

Currently tested on Ubuntu, should work on RHEL and Debian as well.
Contributions to support other systems are very
welcome!

Requirements

You need to add the following line to your metadata.rb

depends 'mysqld'

Attributes

Configuration

Everything in your my.cnf can be maintained using attributes.
Consider using the provides LWRPs (see below)

If you do not specify anything, the defaults of your os will be used.

This recipe supports every setting in the my.cnf. All your settings will be merged with the
systems default, and then written to the my.cnf config file. The packages to install, the path to
my.cnf as well as the name of the service are set automatically, and can be overwritten using the
following attributes:

node['mysqld']['my.cnf_path']
node['mysqld']['service_name']
node['mysqld']['mysql_packages'] # When using mysql_install recipe
node['mysqld']['mariadb_packages'] # When using mariadb_install recipe
node['mysqld']['mariadb_galera_packages'] # When using mariadb_galera_install recipe

The configuration is stored in the node['mysqld']['my.cnf'] hash, and can be adapted like so

mariadb_install

mysql_install

configure

Configure mysql according to attributes. Sets the databases root account (resp. debian-sys-maint on
Debian/Ubuntu systems) to use the password in node['mysqld']['root_password'], if the attribute is
set.

mariadb_galera_init

Run mariadb\_repository and mariadb\_galera\_install recipes, then configure as the configure
recipe would do, but start mariadb with --wsrep-new-cluster --wsrep\_cluster\_address=gcomm:// to
initialize a new Galera cluster.

Use this if you want to setup a new Galera cluster, and run it on your first node once:

$ sudo chef-client --once -o 'recipe[mysqld::mariadb_galera_init]'

Once you connected the other nodes using the regular recipes, re-run chef-client as you did on the
other servers.

Note: If you use a wrapper cookbook to configure your instances, attributes might not be available
when running the recipe with -o recipe[]. Create a mariadb_galera_init recipe in your wrapper
cookbook, calling this recipe if you have trouble.

Providers

mysqld

You can configure your database also using the mysqld provider:

include_recipe 'mysqld::mariadb_galera_install'
# Name attribute will be ignored. Choose something that makes sense for you
mysqld 'galera' do
my_cnf { 'bind-address' => '0.0.0.0' }
end

password

You can set passwords (incl. root and debian-sys-maint accounts) using this provider.
By default, the provider uses the created root/debian-sys-maint accounts depending on the system you
are on.

0.3.0

0.2.0

Fixes an issue with the template when the LWRP was called from another cookbook

Use deep_merge to merge my.cnf hashes

0.1.0

Initial release of mysqld

Foodcritic Metric

1.0.2 failed this metric

FC021: Resource condition in provider may not behave as expected: /tmp/cook/54a8518d936e2ac20ec93c99/mysqld/providers/default.rb:48FC021: Resource condition in provider may not behave as expected: /tmp/cook/54a8518d936e2ac20ec93c99/mysqld/providers/password.rb:31