Setup ChefΒΆ

Create a directory to store the cookbooks needed for this tutorial and change to that directory.

~$ mkdir cookbooks
~$ cd cookbooks

Create a subdirectory named .chef.

~/cookbooks$ mkdir .chef

Put your Chef credentials into the .chef subdirectory. Here is what that subdirectory contains after I stored my Chef credentials there.

~/cookbooks$ ls .chef
DCM-validator.pem   gforghetti.pem      knife.rb
~/cookbooks$ cat .chef/knife.rb
current_dir = File.dirname(__FILE__)
log_level                :info
log_location             STDOUT
node_name                "gforghetti"
client_key               "#{current_dir}/gforghetti.pem"
validation_client_name   "DCM-validator"
validation_key           "#{current_dir}/DCM-validator.pem"
chef_server_url          "https://api.opscode.com/organizations/gaf"
cache_type               'BasicFile'
cache_options( :path => "#{ENV['HOME']}/.chef/checksums" )
cookbook_path            ["#{current_dir}/../"]      

Test the Chef connection.

~/cookbooks$ knife environment list
_default

Download the Wildbook Chef custom cookbooks (three) at this link Tomcat with Wildbook into the cookbooks directory.

~/cookbooks$ ls -la tomcat_wildbook_example.tar.gz
-rw-r--r--  1 gforghetti  staff  4784 Jul 10 10:15 tomcat_wildbook_example.tar.gz

Run the following command to download the additional cookbooks required for this tutorial from the Chef Supermarket.

for package in apt build-essential chef-client chef_handler chef-sugar compat_resource cpu cron haproxy homebrew java logrotate mingw 'mysql 7.2.0' openssl rbac seven_zip smf "tomcat 1.3.0" windows yum yum-epel yum-mysql-community; do knife cookbook site download $package; done
Downloading apt from Supermarket at version 4.0.0 to /Users/gforghetti/Cookbooks/apt-4.0.0.tar.gz
Cookbook saved: /Users/gforghetti/Cookbooks/apt-4.0.0.tar.gz
Downloading build-essential from Supermarket at version 6.0.0 to /Users/gforghetti/Cookbooks/build-essential-6.0.0.tar.gz
Cookbook saved: /Users/gforghetti/Cookbooks/build-essential-6.0.0.tar.gz
Downloading chef-client from Supermarket at version 4.6.0 to /Users/gforghetti/Cookbooks/chef-client-4.6.0.tar.gz
Cookbook saved: /Users/gforghetti/Cookbooks/chef-client-4.6.0.tar.gz
Downloading chef_handler from Supermarket at version 1.4.0 to /Users/gforghetti/Cookbooks/chef_handler-1.4.0.tar.gz
Cookbook saved: /Users/gforghetti/Cookbooks/chef_handler-1.4.0.tar.gz
Downloading chef-sugar from Supermarket at version 3.3.0 to /Users/gforghetti/Cookbooks/chef-sugar-3.3.0.tar.gz
Cookbook saved: /Users/gforghetti/Cookbooks/chef-sugar-3.3.0.tar.gz
Downloading compat_resource from Supermarket at version 12.10.5 to /Users/gforghetti/Cookbooks/compat_resource-12.10.5.tar.gz
Cookbook saved: /Users/gforghetti/Cookbooks/compat_resource-12.10.5.tar.gz
Downloading cpu from Supermarket at version 0.2.0 to /Users/gforghetti/Cookbooks/cpu-0.2.0.tar.gz
Cookbook saved: /Users/gforghetti/Cookbooks/cpu-0.2.0.tar.gz
Downloading cron from Supermarket at version 1.7.6 to /Users/gforghetti/Cookbooks/cron-1.7.6.tar.gz
Cookbook saved: /Users/gforghetti/Cookbooks/cron-1.7.6.tar.gz
Downloading haproxy from Supermarket at version 1.6.7 to /Users/gforghetti/Cookbooks/haproxy-1.6.7.tar.gz
Cookbook saved: /Users/gforghetti/Cookbooks/haproxy-1.6.7.tar.gz
Downloading homebrew from Supermarket at version 2.1.0 to /Users/gforghetti/Cookbooks/homebrew-2.1.0.tar.gz
Downloading java from Supermarket at version 1.39.0 to /Users/gforghetti/Cookbooks/java-1.40.3.tar.gz
Cookbook saved: /Users/gforghetti/Cookbooks/java-1.40.3.tar.gz
Downloading logrotate from Supermarket at version 1.9.2 to /Users/gforghetti/Cookbooks/logrotate-1.9.2.tar.gz
Cookbook saved: /Users/gforghetti/Cookbooks/logrotate-1.9.2.tar.gz
Downloading mingw from Supermarket at version 1.1.0 to /Users/gforghetti/Cookbooks/mingw-1.1.0.tar.gz
Cookbook saved: /Users/gforghetti/Cookbooks/mingw-1.1.0.tar.gz
Downloading mysql from Supermarket at version 7.2.0 to /Users/gforghetti/Cookbooks/mysql-7.2.0.tar.gz
Cookbook saved: /Users/gforghetti/Cookbooks/mysql-7.2.0.tar.gz
Downloading openssl from Supermarket at version 4.4.0 to /Users/gforghetti/Cookbooks/openssl-4.4.0.tar.gz
Cookbook saved: /Users/gforghetti/Cookbooks/openssl-4.4.0.tar.gz
Downloading rbac from Supermarket at version 1.0.3 to /Users/gforghetti/Cookbooks/rbac-1.0.3.tar.gz
Cookbook saved: /Users/gforghetti/Cookbooks/rbac-1.0.3.tar.gz
Downloading seven_zip from Supermarket at version 2.0.1 to /Users/gforghetti/Cookbooks/seven_zip-2.0.1.tar.gz
Cookbook saved: /Users/gforghetti/Cookbooks/seven_zip-2.0.1.tar.gz
Downloading smf from Supermarket at version 2.2.8 to /Users/gforghetti/Cookbooks/smf-2.2.8.tar.gz
Cookbook saved: /Users/gforghetti/Cookbooks/smf-2.2.8.tar.gz
Downloading tomcat from Supermarket at version 1.3.0 to /Users/gforghetti/Cookbooks/tomcat-1.3.0.tar.gz
Cookbook saved: /Users/gforghetti/Cookbooks/tomcat-1.3.0.tar.gz
Downloading windows from Supermarket at version 1.43.0 to /Users/gforghetti/Cookbooks/windows-1.43.0.tar.gz
Cookbook saved: /Users/gforghetti/Cookbooks/windows-1.43.0.tar.gz
Downloading yum from Supermarket at version 3.11.0 to /Users/gforghetti/Cookbooks/yum-3.11.0.tar.gz
Cookbook saved: /Users/gforghetti/Cookbooks/yum-3.11.0.tar.gz
Downloading yum-epel from Supermarket at version 0.7.0 to /Users/gforghetti/Cookbooks/yum-epel-0.7.0.tar.gz
Cookbook saved: /Users/gforghetti/Cookbooks/yum-epel-0.7.0.tar.gz
Downloading yum-mysql-community from Supermarket at version 0.2.0 to /Users/gforghetti/Cookbooks/yum-mysql-community-0.2.0.tar.gz
Cookbook saved: /Users/gforghetti/Cookbooks/yum-mysql-community-0.2.0.tar.gz

Run the following command to extract the cookbooks from their archive files.

for cookbook in `ls -1 *.tar.gz`; do tar -zxf $cookbook && echo "Chef cookbook ${cookbook} extracted."; done
Chef cookbook apt-4.0.0.tar.gz extracted.
Chef cookbook build-essential-6.0.0.tar.gz extracted.
Chef cookbook chef-client-4.6.0.tar.gz extracted.
Chef cookbook chef-sugar-3.3.0.tar.gz extracted.
Chef cookbook chef_handler-1.4.0.tar.gz extracted.
Chef cookbook compat_resource-12.10.5.tar.gz extracted.
Chef cookbook cpu-0.2.0.tar.gz extracted.
Chef cookbook cron-1.7.6.tar.gz extracted.
Chef cookbook haproxy-1.6.7.tar.gz extracted.
Chef cookbook homebrew-2.1.0.tar.gz extracted.
Chef cookbook java-1.39.0.tar.gz extracted.
Chef cookbook logrotate-1.9.2.tar.gz extracted.
Chef cookbook mingw-1.1.0.tar.gz extracted.
Chef cookbook mysql-7.2.0.tar.gz extracted.
Chef cookbook openssl-4.4.0.tar.gz extracted.
Chef cookbook rbac-1.0.3.tar.gz extracted.
Chef cookbook seven_zip-2.0.1.tar.gz extracted.
Chef cookbook smf-2.2.8.tar.gz extracted.
Chef cookbook tomcat-1.3.0.tar.gz extracted.
Chef cookbook windows-1.43.0.tar.gz extracted.
Chef cookbook yum-3.11.0.tar.gz extracted.
Chef cookbook yum-epel-0.7.0.tar.gz extracted.
Chef cookbook yum-mysql-community-0.2.0.tar.gz extracted.

Run the following command to upload the cookbooks to your Chef server.

knife cookbook upload --all
Uploading apt          [4.0.0]
Uploading build-essential [6.0.0]
Uploading chef-client  [4.6.0]
Uploading chef-sugar   [3.3.0]
Uploading chef_handler [1.4.0]
Uploading compat_resource [12.10.5]
Uploading cpu          [0.2.0]
Uploading cron         [1.7.6]
Uploading haproxy      [1.6.7]
Uploading homebrew     [2.1.0]
Uploading java         [1.40.3]
Uploading logrotate    [1.9.2]
Uploading mingw        [1.1.0]
Uploading mysql        [7.2.0]
Uploading openssl      [4.4.0]
Uploading rbac         [1.0.3]
Uploading seven_zip    [2.0.1]
Uploading smf          [2.2.8]
Uploading tomcat       [1.3.0]
Uploading windows      [1.43.0]
Uploading yum          [3.11.0]
Uploading yum-epel     [0.7.0]
Uploading yum-mysql-community [0.2.0]

Create the haproxy-wildbook Chef role.

~/cookbooks$ knife role from file mtd-lb-wildbook/roles/haproxy-wildbook.rb
Updated Role haproxy-wildbook!

Create the mysql-wildbook Chef role.

~/cookbooks$ knife role from file mtd-db-wildbook/roles/mysql-wildbook.rb
Updated Role mysql-wildbook!

Create the tomcat-wildbook Chef role.

~/cookbooks$ knife role from file mtd-web-wildbook/roles/tomcat-wildbook.rb
Updated Role tomcat-wildbook!