Skip to content

Latest commit

 

History

History
 
 

02_ProvisioningTestEnvironment

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

##Session 2: Provisioning Test Environment with Chef and Vagrant

The aim of this session is to help Tester to quickly set up Test / Dev environment on their own machine and share the configuration among team members.

####Contents:

  • Common Tasks on setting up new Dev/Test Environment (without Chef/Vagrant)
  • Most common used Vagrant commands
  • Installing pre-require packages
  • Iteration 1: Installing base packages for the Guest VM
  • Iteration 2: Installing DB and creating seed data
  • Iteration 3: Loading latest code
  • Iteration 4: Handling the configuration to other members

####Installation Instruction ######Prerequisite packages:

######Important time saving note Since creating first virtual machine would trigger downloading of hundred of megabytes, please run below command prior coming to the session

vagrant box add chef/ubuntu-14.04

and select option 1 (Virtual Box), this would trigger downloading the base virtual box for ubuntu 14.04 x64

######Ruby and related Gems

  • For Unix:
curl -sSL https://get.rvm.io | bash -s stable --ruby
sudo gem install bundler
vagrant plugin install vagrant-berkshelf
vagrant plugin install vagrant-omnibus

######Checkout project from GitHub

git clone https://github.com/SydneyTestersBootcamp/sydneyTestersBootcamp.git
  • Bring up the machine
cd sydneyTestersBootcamp/02_ProvisioningTestEnvironment/machines
bundle install
vagrant up
  • You're now ready to travel to your VM
vagrant ssh

####Most used commands

  • vagrant up: bring up and provision the machine
  • vagrant destroy: anything goes wrong, destroy the machine and rebuild it with vagrant up
  • vagrant halt: shutdown the machine
  • vagrant reload: restart the machine
  • vargant provision: provision the machine with all chef's recipes
  • vagrant box add box-name / box-url: download the base box (this step is included in vagrant up, but we can still pre-download it)
  • vagrant suspend: hibernate the machine, you can later resume it with vagrant resume
  • vagrant ssh: connect to the local virtual machine via ssh

####Common issues

  • RuntimeError: Couldn't determine Berks version
    You would need to add chefdk/bin at front of your PATH
    For MacOSX: default chefdk is at /opt/chefdk/bin
    For Windows: default chefdk is at C:\opscode\chefdk\bin
  • The directory where plugins are installed (the Vagrant home directory) has a space in it...
    For Windows user only, you can use echo %username% to get username and you can fix this by moving the .vagrant.d to a folder that has no space in the full path, and set the system variable VAGRANT_HOME=new_path_to_vagrant.d
    i.e: VAGRANT_HOME=C:\HashiCorp.vagrant.d

####Reading Material