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.
- Download and Install Virtual Box.
- Download and Install Vagrant.
- Download and Install the Chef Development Kit.
- We are going to be using Berkshelf so we need to set this up:
- 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
- Type which berks and you should get /opt/chefdk/bin/berks
- Lets create a cookbook to test out:
- Type berks cookbook chef-test
- Type cd chef-test
- Open up the Gemfile and remove gem 'berkshelf'
- Type bundle install
- Open up your Vagrant file and comment out 'config.vm.network :private_network, type: "dhcp"'
- Lets install some Vagrant plugins:
- Type vagrant plugin install vagrant-berkshelf
- Type vagrant plugin install vagrant-omnibus
- Lets fire up the cookbook by typing vagrant up.