Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

wordpress cookbook use strings for keys

  • Loading branch information...
commit beea8f6e153ec6f53274718516088a3573dc3117 1 parent 8f8a42a
Joshua Timberman jtimberman authored
28 wordpress/README.rdoc → wordpress/README.md
View
@@ -1,14 +1,16 @@
-= DESCRIPTION:
+Description
+====
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).
-= REQUIREMENTS:
+Requirements
+====
-== Platform:
+## Platform
Tested on Ubuntu 9.04, 9.10.
-== Cookbooks:
+## Cookbooks
Opscode cookbooks, http://github.com/opscode/cookbooks/tree/master:
@@ -17,11 +19,12 @@ Opscode cookbooks, http://github.com/opscode/cookbooks/tree/master:
* apache2
* opensssl
-== Libraries:
+## Libraries
The openssl library is required from the openssl cookbook to generate secure passwords.
-= ATTRIBUTES:
+Attributes
+====
* wordpress[:version] - Set the version to download.
* wordpress[:checksum] - sha256sum of the tarball, make sure this matches for the version!
@@ -39,7 +42,8 @@ Attributes will probably never need to change (these all default to randomly gen
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:
+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.
@@ -49,15 +53,17 @@ Chef will install and configure mysql, php, and apache2 according to the instruc
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.
-== Note about MySQL:
+## Note about MySQL
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.
-= LICENSE and AUTHOR:
+License and Author
+====
-Author:: Barry Steinglass (barry@opscode.com>)
+Author:: Barry Steinglass (barry@opscode.com)
+Author:: Joshua Timberman (joshua@opscode.com)
-Copyright:: 2010, Opscode, Inc
+Copyright:: 2010-2011, Opscode, Inc
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
10 wordpress/attributes/default.rb
View
@@ -19,8 +19,8 @@
#
# General settings
-default[:wordpress][:version] = "3.1.2"
-default[:wordpress][:checksum] = "1006a1bb97b42381ad82490d00d9b7fb9f7a1c9d83ee2ed36935a9eb99c81064"
-default[:wordpress][:dir] = "/var/www/wordpress"
-default[:wordpress][:db][:database] = "wordpressdb"
-default[:wordpress][:db][:user] = "wordpressuser"
+default['wordpress']['version'] = "3.1.2"
+default['wordpress']['checksum'] = "1006a1bb97b42381ad82490d00d9b7fb9f7a1c9d83ee2ed36935a9eb99c81064"
+default['wordpress']['dir'] = "/var/www/wordpress"
+default['wordpress']['db']['database'] = "wordpressdb"
+default['wordpress']['db']['user'] = "wordpressuser"
4 wordpress/metadata.rb
View
@@ -2,8 +2,8 @@
maintainer_email "cookbooks@opscode.com"
license "Apache 2.0"
description "Installs/Configures wordpress"
-long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
-version "0.8.0"
+long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
+version "0.8.1"
recipe "wordpress", "Installs and configures wordpress LAMP stack on a single system"
64 wordpress/recipes/default.rb
View
@@ -29,19 +29,19 @@
server_fqdn = node.fqdn
end
-node.set[:wordpress][:db][:password] = secure_password
-node.set[:wordpress][:keys][:auth] = secure_password
-node.set[:wordpress][:keys][:secure_auth] = secure_password
-node.set[:wordpress][:keys][:logged_in] = secure_password
-node.set[:wordpress][:keys][:nonce] = secure_password
+node.set['wordpress']['db']['password'] = secure_password
+node.set['wordpress']['keys']['auth'] = secure_password
+node.set['wordpress']['keys']['secure_auth'] = secure_password
+node.set['wordpress']['keys']['logged_in'] = secure_password
+node.set['wordpress']['keys']['nonce'] = secure_password
-remote_file "#{Chef::Config[:file_cache_path]}/wordpress-#{node[:wordpress][:version]}.tar.gz" do
- checksum node[:wordpress][:checksum]
- source "http://wordpress.org/wordpress-#{node[:wordpress][:version]}.tar.gz"
+remote_file "#{Chef::Config[:file_cache_path]}/wordpress-#{node['wordpress']['version']}.tar.gz" do
+ checksum node['wordpress']['checksum']
+ source "http://wordpress.org/wordpress-#{node['wordpress']['version']}.tar.gz"
mode "0644"
end
-directory "#{node[:wordpress][:dir]}" do
+directory "#{node['wordpress']['dir']}" do
owner "root"
group "root"
mode "0755"
@@ -49,13 +49,13 @@
end
execute "untar-wordpress" do
- cwd node[:wordpress][:dir]
- command "tar --strip-components 1 -xzf #{Chef::Config[:file_cache_path]}/wordpress-#{node[:wordpress][:version]}.tar.gz"
- creates "#{node[:wordpress][:dir]}/wp-settings.php"
+ cwd node['wordpress']['dir']
+ command "tar --strip-components 1 -xzf #{Chef::Config[:file_cache_path]}/wordpress-#{node['wordpress']['version']}.tar.gz"
+ creates "#{node['wordpress']['dir']}/wp-settings.php"
end
execute "mysql-install-wp-privileges" do
- command "/usr/bin/mysql -u root -p#{node[:mysql][:server_root_password]} < /etc/mysql/wp-grants.sql"
+ command "/usr/bin/mysql -u root -p#{node['mysql']['server_root_password']} < /etc/mysql/wp-grants.sql"
action :nothing
end
@@ -66,19 +66,19 @@
group "root"
mode "0600"
variables(
- :user => node[:wordpress][:db][:user],
- :password => node[:wordpress][:db][:password],
- :database => node[:wordpress][:db][:database]
+ :user => node['wordpress']['db']['user'],
+ :password => node['wordpress']['db']['password'],
+ :database => node['wordpress']['db']['database']
)
- notifies :run, resources(:execute => "mysql-install-wp-privileges"), :immediately
+ notifies :run, "execute[mysql-install-wp-privileges]", :immediately
end
-execute "create #{node[:wordpress][:db][:database]} database" do
- command "/usr/bin/mysqladmin -u root -p#{node[:mysql][:server_root_password]} create #{node[:wordpress][:db][:database]}"
+execute "create #{node['wordpress']['db']['database']} database" do
+ command "/usr/bin/mysqladmin -u root -p#{node['mysql']['server_root_password']} create #{node['wordpress']['db']['database']}"
not_if do
require 'mysql'
- m = Mysql.new("localhost", "root", node[:mysql][:server_root_password])
- m.list_dbs.include?(node[:wordpress][:db][:database])
+ m = Mysql.new("localhost", "root", node['mysql']['server_root_password'])
+ m.list_dbs.include?(node['wordpress']['db']['database'])
end
notifies :create, "ruby_block[save node data]", :immediately
end
@@ -95,26 +95,30 @@
action :nothing
end
-template "#{node[:wordpress][:dir]}/wp-config.php" do
+template "#{node['wordpress']['dir']}/wp-config.php" do
source "wp-config.php.erb"
owner "root"
group "root"
mode "0644"
variables(
- :database => node[:wordpress][:db][:database],
- :user => node[:wordpress][:db][:user],
- :password => node[:wordpress][:db][:password],
- :auth_key => node[:wordpress][:keys][:auth],
- :secure_auth_key => node[:wordpress][:keys][:secure_auth],
- :logged_in_key => node[:wordpress][:keys][:logged_in],
- :nonce_key => node[:wordpress][:keys][:nonce]
+ :database => node['wordpress']['db']['database'],
+ :user => node['wordpress']['db']['user'],
+ :password => node['wordpress']['db']['password'],
+ :auth_key => node['wordpress']['keys']['auth'],
+ :secure_auth_key => node['wordpress']['keys']['secure_auth'],
+ :logged_in_key => node['wordpress']['keys']['logged_in'],
+ :nonce_key => node['wordpress']['keys']['nonce']
)
notifies :write, "log[Navigate to 'http://#{server_fqdn}/wp-admin/install.php' to complete wordpress installation]"
end
+apache_site "000-default" do
+ enable false
+end
+
web_app "wordpress" do
template "wordpress.conf.erb"
- docroot "#{node[:wordpress][:dir]}"
+ docroot "#{node['wordpress']['dir']}"
server_name server_fqdn
server_aliases node.fqdn
end
Please sign in to comment.
Something went wrong with that request. Please try again.