Learn to use chef. I used the tutorial here. Play list of all videos here.
- 
vagrant installed. Refer to documentation 
- 
Install rbenv - brew install rbenv ruby-build
- 
Add rbenv to path - echo 'eval "$(rbenv init -)"' >> ~/.bash_profile && source ~/.bash_profile
- 
Install ruby and chef rbenv rehash rbenv install 1.9.3-p385 rbenv shell 1.9.3-p385 rbenv global 1.9.3-p385 gem install chef rbenv rehash
These are some notes I made based on the videos:
- Configure Knife
- The way it does that is via 3 files knife.rb,app-validator.pemandusername.pem.
- knife looks for these 3 files in these locations - .chef/in your project directory or in your home or/etc/chef
 
- The way it does that is via 3 files 
- Update Vagrantfile to include chef_client, locations to keys and node name
- vagrant up - you will see the node get registered on opscode.com
- Now you need to get cookbooks
- Can use knife to download - knife cookbook site download apt
- Extract and move to cookbooks - tar xzvf apt*.tar.gz -C cookbooks && rm apt*.tar.gz
- Upload cookbook - knife cookbook upload apt
- Upload multiple cookbooks - knife cookbook upload -a
 
- Can use knife to download - 
- Go to opscode.com and select the recipes you want to the runlist
- the video tells you to drag omnibus-updater but the new cookbook does now work with chef 10.x. I added config.omnibus.chef_version = :latestto my Vagrantfile to get the latest chef
 
- the video tells you to drag omnibus-updater but the new cookbook does now work with chef 10.x. I added 
- vagrant provision
- Can also use knife to add a recipe to the run list - knife node edit ubuntu
- Install mongodb and other cookbooks. The video talks about adding the default mongodb recipe, but that didn't work as I kept getting "recipe compile error". I used recipe[mongodb::10gen_repo]instead. It also said 'Ruby development headers... not found' when installing apache, but the webserver itself was up and running.
- Note - To better manage cookbooks checkout berkshelf
- vagrant provisionto converge the node
Skipping this section; created saj_cookbook but delete all other cookbooks; kept just apt, mongo and nginx
- Objective is to create a multi node environment
- base node - for runlists that are common across servers - knife role create base- add recipe[apt]here
 
- add 
- now knife node edit ubuntu, removerecipe[apt]here and addrole[base]instead
- this has to be added to our code base. so:
- mkdir roles
- knife role show base -Fj > roles/base.json
 
- to create a role and upload via knife:
- first add a role like database.json
- knife role from file roles/database.json
- now we can add this to runlist like so - knife node run_list add ubuntu "role[database]"
 
- first add a role like 
 
- base node - for runlists that are common across servers - 
- Manually downloading cookbooks was getting painful; enter Berkshelf:
- Configure berkshelf - berks configure --force
- If there are SSL errors, edit ~/.berkshelf/config.jsonand set ssl verify to false, like it is shown here
- Install cookbooks - berks install --path cookbooks/
- vagrant up
 
- Configure berkshelf -