diff --git a/.kitchen.yml b/.kitchen.yml index a73a5ef..6bd283a 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -1,38 +1,23 @@ ---- driver_plugin: vagrant driver_config: require_chef_omnibus: true platforms: -- name: ubuntu-12.04 - driver_config: - box: opscode-ubuntu-12.04 - box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04_provisionerless.box - run_list: - - recipe[apt] -- name: ubuntu-10.04 - driver_config: - box: opscode-ubuntu-10.04 - box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_ubuntu-10.04_provisionerless.box - run_list: - - recipe[apt] - -- name: centos-6.4 - driver_config: - box: opscode-centos-6.4 - box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_centos-6.4_provisionerless.box - -- name: centos-5.9 - driver_config: - box: opscode-centos-5.9 - box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_centos-5.9_provisionerless.box + - name: ubuntu-10.04 + run_list: + - recipe[apt] + - name: ubuntu-12.10 + run_list: + - recipe[apt] + - name: centos-6.4 + - name: centos-5.9 suites: -- name: default - run_list: - - recipe[wordpress] - attributes: - mysql: - server_root_password: "Please-Dont-Use-In-Production" - server_debian_password: "Please-Dont-Use-In-Production" - server_repl_password: "Please-Dont-Use-In-Production" \ No newline at end of file + - name: default + run_list: + - recipe[wordpress] + attributes: + mysql: + server_root_password: "Please-Dont-Use-In-Production" + server_debian_password: "Please-Dont-Use-In-Production" + server_repl_password: "Please-Dont-Use-In-Production" diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..32ffbca --- /dev/null +++ b/.travis.yml @@ -0,0 +1,7 @@ +rvm: + - 1.9.3 + - 2.0.0 +before_script: + - bundle exec berks install +bundler_args: --without integration +script: bundle exec strainer test --except kitchen diff --git a/Berksfile b/Berksfile index 34a3b2d..3b5ff95 100644 --- a/Berksfile +++ b/Berksfile @@ -1,8 +1,6 @@ site :opscode - metadata group :integration do - cookbook "apt" - cookbook "yum" + cookbook 'apt', '~> 2.0' end diff --git a/CHANGELOG.md b/CHANGELOG.md index abafe87..c102aa5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,45 +1,42 @@ -## v1.1.0 +CHANGELOG +========= -This version updates support for test kitchen to version 1.0. See -TESTING.md +v1.1.0 +------ +- Added Test Kitchen 1.0 -### Bug - -- [COOK-1393]: wordpress recipe should use mysql::ruby to ensure ruby - extension is installed +Bug Fixes: +- [COOK-1393]: wordpress recipe should use mysql::ruby to ensure ruby extension is installed - [COOK-2984]: wordpress cookbook has foodcritic failures -### Improvement - +Improvements: - [COOK-2661]: Allow downloads from other repos for wordpress install -## v1.0.0: - -* [COOK-1127] - update defaults to latest version -* [COOK-1222] - support installing "latest" version -* [COOK-1271] - Wordpress cookbook generates new password on every - chef run - -## v0.8.8: - -* [COOK-826] - recipe doesn't quote password string - -## v0.8.6: - -* [COOK-534] - allow server_aliases to overridden by an attribute -* [COOK-799] - fixed disables .htaccess breaking permalink feature -* [COOK-820] - guard node.save with check for chef-solo in our cookbooks - -## v0.8.4: - -* [COOK-406] - wp-config.php.erb has wrong CRLF encoding -* Dropping explicit support for Red Hat platforms due to issues in php - and mysql cookbooks (COOK-603, COOK-672, COOK-816, COOK-679) - -## v0.8.2: - -* [COOK-435] Don't set the mysql root user password in wordpress cookbook -* [COOK-535] - recursively create the directory -* RHEL/CentOS/Fedora support (yeah!) -* cleaned up node attribute keys -* cleaned up README.md +v1.0.0: +------- +- [COOK-1127] - update defaults to latest version +- [COOK-1222] - support installing "latest" version +- [COOK-1271] - Wordpress cookbook generates new password on every chef run + +v0.8.8 +------ +- [COOK-826] - recipe doesn't quote password string + +v0.8.6 +------ +- [COOK-534] - allow server_aliases to overridden by an attribute +- [COOK-799] - fixed disables .htaccess breaking permalink feature +- [COOK-820] - guard node.save with check for chef-solo in our cookbooks + +v0.8.4 +------ +- [COOK-406] - wp-config.php.erb has wrong CRLF encoding +- Dropping explicit support for Red Hat platforms due to issues in php and mysql cookbooks (COOK-603, COOK-672, COOK-816, COOK-679) + +v0.8.2 +------ +- [COOK-435] Don't set the mysql root user password in wordpress cookbook +- [COOK-535] - recursively create the directory +- RHEL/CentOS/Fedora support (yeah!) +- cleaned up node attribute keys +- cleaned up README.md diff --git a/CONTRIBUTING b/CONTRIBUTING deleted file mode 100644 index 89ac873..0000000 --- a/CONTRIBUTING +++ /dev/null @@ -1,29 +0,0 @@ -If you would like to contribute, please open a ticket in JIRA: - -* http://tickets.opscode.com - -Create the ticket in the COOK project and use the cookbook name as the -component. - -For all code contributions, we ask that contributors sign a -contributor license agreement (CLA). Instructions may be found here: - -* http://wiki.opscode.com/display/chef/How+to+Contribute - -When contributing changes to individual cookbooks, please do not -modify the version number in the metadata.rb. Also please do not -update the CHANGELOG.md for a new version. Not all changes to a -cookbook may be merged and released in the same versions. Opscode will -handle the version updates during the release process. You are welcome -to correct typos or otherwise make updates to documentation in the -README. - -If a contribution adds new platforms or platform versions, indicate -such in the body of the commit message(s), and update the relevant -COOK ticket. When writing commit messages, it is helpful for others if -you indicate the COOK ticket. For example: - - git commit -m '[COOK-1041] Updated pool resource to correctly delete.' - -In the ticket itself, it is also helpful if you include log output of -a successful Chef run, but this is not absolutely required. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..5224c33 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,20 @@ +Contribution Guidelines +======================= + +If you would like to contribute to the Chef Wordpress cookbook, +you must open a ticket in [JIRA](http://tickets.opscode.com). + +1. Create the ticket in the [COOK] (use "wordpress" for the component) +2. [Sign a CLA](http://wiki.opscode.com/display/chef/How+to+Contribute) + +- Please do NOT modify the version number +- Please do NOT update the CHANGELOG + +We will update the version number and CHANGELOG when we release a new version. + +If a contribution adds new platforms or platform versions, indicate +such in the body of the commit message(s), and update the relevant +COOK ticket. When writing commit messages, it is helpful for others if +you indicate the COOK ticket. For example: + + $ git commit -m '[COOK-1041] Updated pool resource to correctly delete.' diff --git a/Gemfile b/Gemfile index f04cf4b..ff2d454 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,14 @@ -source :rubygems +source 'https://rubygems.org' -group :kitchen do - gem 'test-kitchen', '< 1.0' +gem 'chef', '~> 11.6' +gem 'berkshelf', '~> 2.0' + +group :test do + gem 'foodcritic', '~> 2.2' + gem 'strainer', '~> 3.1' +end + +group :integration do + gem 'test-kitchen', '~> 1.0.0.beta' + gem 'kitchen-vagrant', '~> 0.11' end diff --git a/README.md b/README.md index bba0994..7f05d99 100644 --- a/README.md +++ b/README.md @@ -1,38 +1,110 @@ -Description -=========== +Chef Wordpress Cookbook +======================= +The Chef Wordpress cookbook installs and configures Wordpress according to the instructions at http://codex.wordpress.org/Installing_WordPress. -Installs and configures Wordpress according to the instructions at http://codex.wordpress.org/Installing_WordPress. Does not set up a wordpress blog. You will need to do this manually by going to http://hostname/wp-admin/install.php (this URL may be different if you change the attribute values). +This cookbook does not set up the WordPress blog. You will need to do this manually by going to http://hostname/wp-admin/install.php (this URL may be different if you change the attribute values). -Requirements -============ -Platform --------- +Installation +------------ +Install the cookbook using knife: -* Debian, Ubuntu + $ knife cookbook site install wordpress -Tested on: +Or, if you are using Berkshelf, add the cookbook to your Berksfile: -* Ubuntu 9.04, 9.10, 10.04 +```ruby +cookbook 'wordpress' +``` -Cookbooks ---------- -* mysql -* php -* apache2 -* opensssl (uses library to generate secure passwords) +Usage +----- +Add the cookbook to your `run_list` in a node or role: + +```json +{ + "run_list": [ + "recipe[wordpress::default]" + ] +} +``` + +Or include it in a recipe: + +```ruby +# other_cookbook/metadata.rb +# ... +depends 'wordpress' +``` + +```ruby +# other_cookbook/recipes/default.rb +# ... +include_recipe 'wordpress::default' +``` + +If a different version than the default is desired, download that version and get the SHA256 checksum (sha256sum on Linux systems), and set the version and checksum attributes. + Attributes -========== +---------- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AttributeDescriptionExampleDefault
versionversion of the wordpress to install1.2.3'latest'
checksumsha256sum of the tarballabcd1234''
dirlocation for wordpress files/nfs/wp/var/www
databasename of the database to usebob-wordpresswordpressdb
userthe user to connect to MySQLuserwordpressuser
passwordthe password to connect to MySQLP@s$w0rD(randomly generated)
server_aliasesserver aliases for Apache['foo.com'][(node's FQDN)]
-* `node['wordpress']['version']` - Set the version to download. Using 'latest' (the default) will install the most current version. -* `node['wordpress']['checksum']` - sha256sum of the tarball, make sure this matches for the version! (Not used for 'latest' version.) -* `node['wordpress']['dir']` - Set the location to place wordpress files. Default is /var/www. -* `node['wordpress']['db']['database']` - Wordpress will use this MySQL database to store its data. -* `node['wordpress']['db']['user']` - Wordpress will connect to MySQL using this user. -* `node['wordpress']['db']['password']` - Password for the Wordpress MySQL user. The default is a randomly generated string. -* `node['wordpress']['server_aliases']` - Array of ServerAliases used in apache vhost. Default is `node['fqdn']`. Attributes will probably never need to change (these all default to randomly generated strings): @@ -41,29 +113,28 @@ Attributes will probably never need to change (these all default to randomly gen * `node['wordpress']['keys']['logged_in']` * `node['wordpress']['keys']['nonce']` -The random generation is handled with the secure_password method in the openssl cookbook which is a cryptographically secure random generator and not predictable like the random method in the ruby standard library. - -Usage -===== - -If a different version than the default is desired, download that version and get the SHA256 checksum (sha256sum on Linux systems), and set the version and checksum attributes. - -Add the "wordpress" recipe to your node's run list or role, or include the recipe in another cookbook. - -Chef will install and configure mysql, php, and apache2 according to the instructions at http://codex.wordpress.org/Installing_WordPress. Does not set up a wordpress blog. You will need to do this manually by going to http://hostname/wp-admin/install.php (this URL may be different if you change the attribute values). -The mysql::server recipe needs to come first, and contain an execute resource to install mysql privileges from the grants.sql template in this cookbook. +Development +----------- +This cookbook uses Test Kitchen (1.0). To run the tests, clone the repository, install the gems, and run test kitchen: -## Note about MySQL + $ git clone git://github.com/opscode-cookbooks/wordpress.git + $ cd wordpress + $ bundle install + $ bundle exec strainer test -This cookbook will decouple the mysql::server and be smart about detecting whether to use a local database or find a database server in the environment in a later version. +1. Fork the cookbook on GitHub +2. Make changes +3. Write appropriate tests +4. Submit a Pull Request back to the project +5. Open a [JIRA ticket](https://tickets.opscode.com), linking back to the Pull Request -License and Author -================== -Author:: Barry Steinglass (barry@opscode.com) -Author:: Joshua Timberman (joshua@opscode.com) -Author:: Seth Chisamore (schisamo@opscode.com) +License & Authors +----------------- +- Author:: Barry Steinglass (barry@opscode.com) +- Author:: Joshua Timberman (joshua@opscode.com) +- Author:: Seth Chisamore (schisamo@opscode.com) Copyright:: 2010-2011, Opscode, Inc diff --git a/Strainerfile b/Strainerfile new file mode 100644 index 0000000..39fe6f0 --- /dev/null +++ b/Strainerfile @@ -0,0 +1,3 @@ +knife: bundle exec knife cookbook test $COOKBOOK +foodcritic: bundle exec foodcritic -f any $SANDBOX/$COOKBOOK --tags ~FC023 --tags ~FC037 +kitchen: bundle exec kitchen test diff --git a/TESTING.md b/TESTING.md deleted file mode 100644 index e29ff7c..0000000 --- a/TESTING.md +++ /dev/null @@ -1,25 +0,0 @@ -This cookbook includes support for running tests via Test Kitchen (1.0). This has some requirements. - -1. You must be using the Git repository, rather than the downloaded cookbook from the Chef Community Site. -2. You must have Vagrant 1.1 installed. -3. You must have a "sane" Ruby 1.9.3 environment. - -Once the above requirements are met, install the additional requirements: - -Install the berkshelf plugin for vagrant, and berkshelf to your local Ruby environment. - - vagrant plugin install vagrant-berkshelf - gem install berkshelf - -Install Test Kitchen 1.0 (unreleased yet, use the alpha / prerelease version). - - gem install test-kitchen --pre - -Install the Vagrant driver for Test Kitchen. - - gem install kitchen-vagrant - -Once the above are installed, you should be able to run Test Kitchen: - - kitchen list - kitchen test diff --git a/test/kitchen/Kitchenfile b/test/kitchen/Kitchenfile deleted file mode 100644 index 81a9b32..0000000 --- a/test/kitchen/Kitchenfile +++ /dev/null @@ -1,3 +0,0 @@ -cookbook "wordpress" do - runtimes [] -end