A Chef recipe for configuring a shell for a Wordpress installation.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
attributes
recipes
templates/default
test/.chef
.gitignore
.travis.yml
CHANGELOG.md
Gemfile
LICENSE
README.md
metadata.rb

README.md

wp-shell Cookbook Build Status

I don't usually use WordPress, but when I do, I configure it with Chef.

This application cookbook provides a recipe for configuring the shell for a WordPress installation. By 'shell', I mean the necessary Apache, PHP, and MySQL configuration needed to develop on a WordPress site. The recipe will also bootstrap the database with a MySQL dump and run phpMyAdmin on port 8888.

The intended use is with Vagrant, so the PHP code can live on the host machine, while the Vagrant-controlled VM will house the web server and database. See Usage below for more information.

Requirements

For the dependencies of this cookbook, have a look at the metadata. It's more than is absolutely required, but the extras are low overhead.

Platform

  • Ubuntu

Tested on:

  • Ubuntu 12.04

Attributes

wp-shell::default

Key Type Default Value
['wp-shell']['docroot'] String '/opt/wp-shell'
['wp-shell']['server_name'] String 'wp_database'
['wp-shell']['db_name'] String 'wp_database'
['wp-shell']['db_user'] String 'root'
['wp-shell']['db_password'] String node['mysql']['server_root_password']
['wp-shell']['host-folder'] String '/home/vagrant/host'
['wp-shell']['db-dump-name'] String 'dump.sql'

Usage

wp-shell::default

This recipe was designed to be invoked from within Vagrant. Here's some of the Vagrant config:

config.vm.synced_folder "<path_on_host_machine_to_database_dump>", "/home/vagrant/host"
config.vm.synced_folder "<path_on_host_machine_to_wp_src>", "/opt/wordpress"

config.vm.provision :chef_solo do |chef|
  chef.cookbooks_path = "cookbooks"
  chef.add_recipe 'wp-shell::default'

  chef.json = {
    'mysql' => {
      'server_root_password' => 'rootpass'
    },
    'wp-shell' => {
      'server_name' => 'wordpress.dev',
      'docroot' => '/opt/wordpress',
      'db_name' => 'wp_db_name'
    }
  }
end

A couple things to note:

  • The ./cookbooks directory will need to contain the this cookbook.
  • You'll need to add a hosts file entry on the host machine for the server_name you choose.

Testing


This cookbook is tested by Travis-CI, but you may want to test it locally as well. To do so, use the following commands:

BUNDLE_GEMFILE=test/support/Gemfile bundle exec foodcritic ./
BUNDLE_GEMFILE=test/support/Gemfile bundle exec knife cookbook test wp-shell -c test/.chef/knife.rb

TODO

  • Write a unit test or two
  • Add test-kitchen and officially support more distros

CHANGELOG

changelog is here

License and Authors

Copyright 2013, Michael Lanyon

Apache License, Version 2.0