Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

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.

Select Badges

Select Supported Platforms

Select Status

RSS

mysqld (11) Versions 2.1.0

Installs/Configures mysqld

Policyfile
Berkshelf
Knife
cookbook 'mysqld', '= 2.1.0', :supermarket
cookbook 'mysqld', '= 2.1.0'
knife supermarket install mysqld
knife supermarket download mysqld
README
Dependencies
Changelog
Quality 43%

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

Compatibility

This cookbook is currently tested on Ubuntu 16.04. It should work on other Ubuntu/ Debian systems as well, as long as a compatible database version is used (e.g. >= mysql-5.7.6 or >= mariadb-10.1).

For older database versions, it might be required to adapt some of the my.cnf attributes. Furthermore, the mysqld_password provider only works with the mentioned compatible databases. In case you need to use mysqld_password with older versions (e.g. < mysql-5.7.6), you need to version-lock this cookbook to 1.0.5. This can be achieved by putting the following in your Berksfile:

cookbook 'mysqld', '~> 1.0'

Note: The support for RHEL was dropped with version v2.2.0, pull-requests are welcome!

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 node['mysqld']['use_mariadb'] == false
node['mysqld']['mariadb_packages']
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

# node['mysqld']['my.conf'][<category>][<key>] = <value>
node['mysqld']['my.cnf']['mysqld']['bind-address'] = '0.0.0.0'

This will expand to the following in your config file (leaving all other settings untouched)

[mysqld]
bind-address = 0.0.0.0

To remove a default option, you can pass false or nil as the value

# Remove deprecated innodb option
default['mysqld']['my.cnf']['mysqld']['innodb_additional_mem_pool_size'] = false

As the configuration file is constructed from the config hash, every my.cnf configuration option is
supported.

node['mysqld']['root_password'] = 'yourpass'

Recipes

default

  • Setup official MariaDB repository
  • Install MariaDB server
  • Configure MariaDB server according to the attributes. If no attributes are given, stick with the systems default

mariadb_repository

Sets up official MariaDB repository to install packages from.
Configure it using the following attributes

node['mysqld']['repository']['version'] # Defaults to '10.1'
node['mysqld']['repository']['mirror']  # Defaults to HostEurope mirror

install

Install mariadb/ mysql packages (according to attributes, defaults to mariadb-server)

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.

mysqld_password 'root' do
  password 'get_from_data_bag_maybe?'

  # If required, you can specify your own auth-scheme here
  # auth '-u specialuser -pmypass'
end

Contributing

Contributions are very welcome!

  1. Fork the repository on Github
  2. Create a named feature branch (like add_component_x)
  3. Write you change
  4. Write tests for your change (if applicable)
  5. Run the tests, ensuring they all pass
  6. Submit a Pull Request using Github

License and Authors

Authors: Chris Aumann me@chr4.org

License: GPLv3

mysqld CHANGELOG

This file is used to list changes made in each version of the mysqld cookbook.

2.1.0

  • Fix repository keys for older Ubuntu releases

2.0.0

  • Drop support for RHEL, pull-requests apprechiated! In case you are using RHEL, make sure to version-lock this cookbook to ~> 1.0.5 e.g. in your Berksfile
  • Drop support for mysql-server-5.6 (Ubuntu 14.04). Migrate to MariaDB, or version-lock this cookbook to ~> 1.0.5 e.g. in your Berksfile
  • Bump default mariadb version to 10.1
  • Adapt default attributes for mysql-5.7 and mariadb-10.1
  • Remove workaround for deprecated Ubuntu 13.10
  • Add node['mysqld']['use_mariadb'] attribute, default to true
  • Replace mysqld::install_mariadb and mysqld::install_mysql recipes with mysqld::install`
  • Rename mysqld::mariadb_apt_repository to mysqld::mariadb_repository
  • Use authentication_string table when changing passwords

1.0.5

  • Update mariadb repository key

1.0.4

  • Fix attribute typo in mysqld::mariadb_install recipe

1.0.3

  • Use Upstart provider only on Ubuntu 13.10

1.0.2

  • Restart service immediately when my.cnf is updated

1.0.1

  • Do not force presence of password attribute

1.0.0

  • Add support for mariadb
  • Add support for mariadb-galera
  • Automatically set admin passwords if attribute is given (incl. modifying /etc/mysql/debian.cnf accordingly, if required)

Compatibility changes:

  • Rename node['mysqld']['packages'] attribute to node['mysqld']['mysql_packages']

0.3.0

  • Add support to remove configuration options set by default attributes

0.2.0

  • Do not manage service_name, when service_name is empty
  • 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

Collaborator Number Metric
            

2.1.0 failed this metric

Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.

Contributing File Metric
            

2.1.0 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file

Foodcritic Metric
            

2.1.0 failed this metric

FC021: Resource condition in provider may not behave as expected: mysqld/providers/default.rb:48
FC021: Resource condition in provider may not behave as expected: mysqld/providers/password.rb:31
FC059: LWRP provider does not declare use_inline_resources: mysqld/providers/default.rb:1
FC059: LWRP provider does not declare use_inline_resources: mysqld/providers/password.rb:1
FC064: Ensure issues_url is set in metadata: mysqld/metadata.rb:1
FC065: Ensure source_url is set in metadata: mysqld/metadata.rb:1
FC066: Ensure chef_version is set in metadata: mysqld/metadata.rb:1
FC067: Ensure at least one platform supported in metadata: mysqld/metadata.rb:1
FC069: Ensure standardized license defined in metadata: mysqld/metadata.rb:1
Run with Foodcritic Version 11.1.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any

License Metric
            

2.1.0 passed this metric

No Binaries Metric
            

2.1.0 passed this metric

Testing File Metric
            

2.1.0 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file

Version Tag Metric
            

2.1.0 passed this metric