Saturday, 25 October 2014

Configuring Chef Development Environment


At the current place that I am at one of the things that we are lacking is the concept of Infrastructure as Code. So I have decided to put my DevOps hat on and get the ball rolling.

I decided to use Chef as it feels more natural to me as a Ruby developer. The setup process was not as straight forward as I thought so I decided to document it, as I will forget later on.


  1. Download and Install Virtual Box.
  2. Download and Install Vagrant.
  3. Download and Install the Chef Development Kit.
  4. We are going to be using Berkshelf so we need to set this up:
    1. If you are using RVM find where RVM sets 'source "$HOME/.rvm/scripts/rvm"' after that place the following: export PATH=$HOME/.chefdk/gem/ruby/2.1.0/bin:/opt/chefdk/bin:$PATH
    2. Type which berks and you should get /opt/chefdk/bin/berks
  5. Lets create a cookbook to test out:
    1. Type berks cookbook chef-test
    2. Type cd chef-test
    3. Open up the Gemfile and remove gem 'berkshelf'
    4. Type bundle install
    5. Open up your Vagrant file and comment out ' :private_network, type: "dhcp"'
  6. Lets install some Vagrant plugins:
    1. Type vagrant plugin install vagrant-berkshelf
    2. Type vagrant plugin install vagrant-omnibus
  7. Lets fire up the cookbook by typing vagrant up.
  8. Profit!