This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

release v1.3.0

  • Loading branch information...
jtimberman committed Aug 16, 2012
1 parent 5886c41 commit 3a77f2e53dddb57486a85da9f825d6ab036b76d8
Showing with 149 additions and 44 deletions.
  1. +8 −0 CHANGELOG.md
  2. +122 −44 README.md
  3. +19 −0 recipes/mysql.rb
View
@@ -1,3 +1,11 @@
+## v1.3.0:
+
+* [COOK-932] - Add mysql recipe to conveniently include mysql::ruby
+* [COOK-1228] - database resource should be able to execute scripts on disk
+* [COOK-1291] - make the snapshot retention policy less confusing
+* [COOK-1401] - Allow to specify the collation of new databases
+* [COOK-1534] - Add postgresql recipe to conveniently include postgresql::ruby
+
## v1.2.0:
* [COOK-970] - workaround for disk [re]naming on ubuntu 11.04+
View
166 README.md
@@ -1,14 +1,23 @@
Database Cookbook
=================
-The main highlight of this cookbook is the `database` and `database_user` resources for managing databases and database users in a RDBMS. Providers for MySQL, PostgreSQL and SQL Server are also provided, see usage documentation below.
-
-This cookbook also contains recipes to configure mysql database masters and slaves and uses EBS for storage, integrating together with the application cookbook utilizing data bags for application related information. These recipes are written primarily to use MySQL and the Opscode mysql cookbook. Other RDBMS may be supported at a later date. This cookbook does not automatically restore database dumps, but does install tools to help with that.
+The main highlight of this cookbook is the `database` and
+`database_user` resources for managing databases and database users in
+a RDBMS. Providers for MySQL, PostgreSQL and SQL Server are also
+provided, see usage documentation below.
+
+This cookbook also contains recipes to configure mysql database
+masters and slaves and uses EBS for storage, integrating together with
+the application cookbook utilizing data bags for application related
+information. These recipes are written primarily to use MySQL and the
+Opscode mysql cookbook. Other RDBMS may be supported at a later date.
+This cookbook does not automatically restore database dumps, but does
+install tools to help with that.
Requirements
============
-Chef 0.10.0 or higher required (for Chef environment use).
+Chef version 0.10.10+.
Platform
--------
@@ -29,16 +38,31 @@ The following Opscode cookbooks are dependencies:
Resources/Providers
===================
-These resources aim to expose an abstraction layer for interacting with different RDBMS in a general way. Currently the cookbook ships with providers for MySQL, PostgreSQL and SQL Server. Please see specific usage in the __Example__ sections below. The providers use specific Ruby gems to execute commands and carry out actions. These gems will need to be installed before the providers can operate correctly. Specific notes for each RDBS flavor:
-
-- MySQL: leverages the `mysql` gem which is installed as part of the `mysql::client` recipe.
-- PostgreSQL: leverages the `pg` gem which is installed as part of the `postgresql::client` recipe.
-- SQL Server: leverages the `tiny_tds` gem which is installed as part of the `sql_server::client` recipe.
+These resources aim to expose an abstraction layer for interacting
+with different RDBMS in a general way. Currently the cookbook ships
+with providers for MySQL, PostgreSQL and SQL Server. Please see
+specific usage in the __Example__ sections below. The providers use
+specific Ruby gems installed under Chef's Ruby environment to execute
+commands and carry out actions. These gems will need to be installed
+before the providers can operate correctly. Specific notes for each
+RDBS flavor:
+
+- MySQL: leverages the `mysql` gem which is installed as part of the
+ `mysql::ruby` recipe. You can use `database::mysql` to include this,
+ too.
+- PostgreSQL: leverages the `pg` gem which is installed as part of the
+ `postgresql::ruby` recipe. You can use `database::postgresql` to
+ include this, too.
+ Currently does not work in Chef "omnibus" full stack installs, see COOK-1406.
+- SQL Server: leverages the `tiny_tds` gem which is installed as part
+ of the `sql_server::client` recipe.
`database`
----------
-Manage databases in a RDBMS. Use the proper shortcut resource depending on your RDBMS: `mysql_database`, `postgresql_database` or `sql_server_database`.
+Manage databases in a RDBMS. Use the proper shortcut resource
+depending on your RDBMS: `mysql_database`, `postgresql_database` or
+`sql_server_database`.
### Actions
@@ -49,8 +73,11 @@ Manage databases in a RDBMS. Use the proper shortcut resource depending on your
### Attribute Parameters
- database_name: name attribute. Name of the database to interact with
-- connection: hash of connection info. valid keys include :host, :port, :username, :password
-- sql: string of sql or a block that executes to a string of sql, which will be executed against the database. used by :query action only
+- connection: hash of connection info. valid keys include :host,
+ :port, :username, :password
+- sql: string of sql or a block that executes to a string of sql,
+ which will be executed against the database. used by :query action
+ only
### Providers
@@ -156,7 +183,9 @@ Manage databases in a RDBMS. Use the proper shortcut resource depending on your
`database_user`
---------------
-Manage users and user privileges in a RDBMS. Use the proper shortcut resource depending on your RDBMS: `mysql_database_user` or `sql_server_database_user`.
+Manage users and user privileges in a RDBMS. Use the proper shortcut
+resource depending on your RDBMS: `mysql_database_user` or
+`sql_server_database_user`.
### Actions
@@ -169,15 +198,21 @@ Manage users and user privileges in a RDBMS. Use the proper shortcut resource de
- username: name attribute. Name of the database user
- password: password for the user account
- database_name: Name of the database to interact with
-- connection: hash of connection info. valid keys include :host, :port, :username, :password
-- privileges: array of database privileges to grant user. used by the :grant action. default is :all
-- host: host where user connections are allowed from. used by MySQL provider only. default is 'localhost'
-- table: table to grant privileges on. used by :grant action and MySQL provider only. default is '*' (all tables)
+- connection: hash of connection info. valid keys include :host,
+ :port, :username, :password
+- privileges: array of database privileges to grant user. used by the
+ :grant action. default is :all
+- host: host where user connections are allowed from. used by MySQL
+ provider only. default is 'localhost'
+- table: table to grant privileges on. used by :grant action and MySQL
+ provider only. default is '*' (all tables)
### Providers
-- **Chef::Provider::Database::MysqlUser**: shortcut resource `mysql_database_user`
-- **Chef::Provider::Database::SqlServerUser**: shortcut resource `sql_server_database_user`
+- **Chef::Provider::Database::MysqlUser**: shortcut resource
+ `mysql_database_user`
+- **Chef::Provider::Database::SqlServerUser**: shortcut resource
+ `sql_server_database_user`
### Examples
@@ -253,58 +288,89 @@ Recipes
ebs\_volume
-----------
-*Note*: This recipe does not currently work on RHEL platforms due to the xfs cookbook not supporting RHEL yet.
+*Note*: This recipe does not currently work on RHEL platforms due to
+ the xfs cookbook not supporting RHEL yet.
-Loads the aws information from the data bag. Searches the applications data bag for the database master or slave role and checks that role is applied to the node. Loads the EBS information and the master information from data bags. Uses the aws cookbook LWRP, `aws_ebs_volume` to manage the volume.
+Loads the aws information from the data bag. Searches the applications
+data bag for the database master or slave role and checks that role is
+applied to the node. Loads the EBS information and the master
+information from data bags. Uses the aws cookbook LWRP,
+`aws_ebs_volume` to manage the volume.
On a master node:
* if we have an ebs volume already as stored in a data bag, attach it.
-* if we don't have the ebs information then create a new one and attach it.
+* if we don't have the ebs information then create a new one and
+ attach it.
* store the volume information in a data bag via a ruby block.
On a slave node:
* use the master volume information to generate a snapshot.
* create the new volume from the snapshot and attach it.
-Also on a master node, generate some configuration for running a snapshot via `chef-solo` from cron.
+Also on a master node, generate some configuration for running a
+snapshot via `chef-solo` from cron.
-On a new filesystem volume, create as XFS, then mount it in /mnt, and also bind-mount it to the mysql data directory (default /var/lib/mysql).
+On a new filesystem volume, create as XFS, then mount it in /mnt, and
+also bind-mount it to the mysql data directory (default
+/var/lib/mysql).
master
------
-This recipe no longer loads AWS specific information, and the database position for replication is no longer stored in a databag because the client might not have permission to write to the databag item. This may be handled in a different way at a future date.
+This recipe no longer loads AWS specific information, and the database
+position for replication is no longer stored in a databag because the
+client might not have permission to write to the databag item. This
+may be handled in a different way at a future date.
-Searches the apps databag for applications, and for each one it will check that the specified database master role is set in both the databag and applied to the node's run list. Then, retrieves the passwords for `root`, `repl` and `debian` users and saves them to the node attributes. If the passwords are not found in the databag, it prints a message that they'll be generated by the mysql cookbook.
+Searches the apps databag for applications, and for each one it will
+check that the specified database master role is set in both the
+databag and applied to the node's run list. Then, retrieves the
+passwords for `root`, `repl` and `debian` users and saves them to the
+node attributes. If the passwords are not found in the databag, it
+prints a message that they'll be generated by the mysql cookbook.
-Then it adds the application databag database settings to a hash, to use later.
+Then it adds the application databag database settings to a hash, to
+use later.
-Then it will iterate over the databases and create them with the `mysql_database` resource while adding privileges for application specific database users using the `mysql_database_user` resource.
+Then it will iterate over the databases and create them with the
+`mysql_database` resource while adding privileges for application
+specific database users using the `mysql_database_user` resource.
slave
-----
-_TODO_: Retrieve the master status from a data bag, then start replication using a ruby block. The replication status needs to be handled in some other way for now since the master recipe above doesn't actually set it in the databag anymore.
+_TODO_: Retrieve the master status from a data bag, then start
+replication using a ruby block. The replication status needs to be
+handled in some other way for now since the master recipe above
+doesn't actually set it in the databag anymore.
snapshot
--------
-Run via Chef Solo. Retrieves the db snapshot configuration from the specified JSON file. Uses the `mysql_database` resource to lock and unlock tables, and does a filesystem freeze and EBS snapshot.
+Run via Chef Solo. Retrieves the db snapshot configuration from the
+specified JSON file. Uses the `mysql_database` resource to lock and
+unlock tables, and does a filesystem freeze and EBS snapshot.
Deprecated Recipes
==================
-The following recipe is considered deprecated. It is kept for reference purposes.
+The following recipe is considered deprecated. It is kept for
+reference purposes.
ebs\_backup
-----------
-Older style of doing mysql snapshot and replication using Adam Jacob's [ec2_mysql](http://github.com/adamhjk/ec2_mysql) script and library.
+Older style of doing mysql snapshot and replication using Adam Jacob's
+[ec2_mysql](http://github.com/adamhjk/ec2_mysql) script and library.
Data Bags
=========
-This cookbook uses the apps data bag item for the specified application; see the `application` cookbook's README.md. It also creates data bag items in a bag named 'aws' for storing volume information. In order to interact with EC2, it expects aws to have a main item:
+This cookbook uses the apps data bag item for the specified
+application; see the `application` cookbook's README.md. It also
+creates data bag items in a bag named 'aws' for storing volume
+information. In order to interact with EC2, it expects aws to have a
+main item:
{
"id": "main",
@@ -315,7 +381,10 @@ This cookbook uses the apps data bag item for the specified application; see the
"aws_access_key_id": ""
}
-Note: with the Open Source Chef Server, the server using the database recipes must be an admin client or it will not be able to create data bag items. You can modify whether the client is admin by editing it with knife.
+Note: with the Open Source Chef Server, the server using the database
+recipes must be an admin client or it will not be able to create data
+bag items. You can modify whether the client is admin by editing it
+with knife.
knife client edit <client_name>
{
@@ -324,12 +393,16 @@ Note: with the Open Source Chef Server, the server using the database recipes mu
...
}
-This is not required if the Chef Server is the Opscode Platform, instead use the ACL feature to modify access for the node to be able to update the data bag.
+This is not required if the Chef Server is Opscode Hosted Chef,
+instead use the ACL feature to modify access for the node to be able
+to update the data bag.
Usage
=====
-Aside from the application data bag (see the README in the application cookbook), create a role for the database master. Use a role.rb in your chef-repo, or create the role directly with knife.
+Aside from the application data bag (see the README in the application
+cookbook), create a role for the database master. Use a role.rb in
+your chef-repo, or create the role directly with knife.
% knife role show my_app_database_master -Fj
{
@@ -347,7 +420,8 @@ Aside from the application data bag (see the README in the application cookbook)
}
}
-Create a `production` environment. This is also used in the `application` cookbook.
+Create a `production` environment. This is also used in the
+`application` cookbook.
% knife environment show production -Fj
{
@@ -364,18 +438,22 @@ Create a `production` environment. This is also used in the `application` cookbo
}
-The cookbook `my_app_database` is recommended to set up any application specific database resources such as configuration templates, trending monitors, etc. It is not required, but you would need to create it separately in `site-cookbooks`. Add it to the `my_app_database_master` role.
+The cookbook `my_app_database` is recommended to set up any
+application specific database resources such as configuration
+templates, trending monitors, etc. It is not required, but you would
+need to create it separately in `site-cookbooks`. Add it to the
+`my_app_database_master` role.
License and Author
==================
-Author:: Adam Jacob (<adam@opscode.com>)
-Author:: Joshua Timberman (<joshua@opscode.com>)
-Author:: AJ Christensen (<aj@opscode.com>)
-Author:: Seth Chisamore (<schisamo@opscode.com>)
-Author:: Lamont Granquist (<lamont@opscode.com>)
+- Author:: Adam Jacob (<adam@opscode.com>)
+- Author:: Joshua Timberman (<joshua@opscode.com>)
+- Author:: AJ Christensen (<aj@opscode.com>)
+- Author:: Seth Chisamore (<schisamo@opscode.com>)
+- Author:: Lamont Granquist (<lamont@opscode.com>)
-Copyright 2009-2011, Opscode, Inc.
+Copyright 2009-2012, Opscode, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
View
@@ -1 +1,20 @@
+#
+# Author:: Jesse Howarth (<him@jessehowarth.com>)
+#
+# Copyright:: Copyright (c) 2012, Opscode, Inc. (<legal@opscode.com>)
+# License:: Apache License, Version 2.0
+#
+# 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::ruby"

0 comments on commit 3a77f2e

Please sign in to comment.