Vagrant + chef's cookbooks development environment like the production in few steps
-
Upload
tiago-butzke -
Category
Self Improvement
-
view
2.280 -
download
0
Transcript of Vagrant + chef's cookbooks development environment like the production in few steps
Development environment like the production in few steps
@tiagobutzke
● Software Engineer
● Founder and CEO at Stoodos.com
● Classic rock lover
● LP collector
● Beer and coffee drinker
● “Development environments made easy”
● Roughly speaking, it's a way of control a VM via command line
Steps to start vagrant (1)
Download and install virtual boxwww.virtualbox.org/wiki/Downloads
Steps to start vagrant (2)
Download and install vagrantvagrantup.com/downloads.html
Steps to start vagrant (3)
Add a new boxwww.vagrantbox.es
eg.: $ vagrant box add lucid32 http://files.vagrantup.com/lucid32.box
Steps to start vagrant (4)
$ vagrant init
Steps to start vagrant (5)
Config VagrantFile
eg.: config.vm.box = “lucid32” # the box that we installed in step 3, remember?
Steps to start vagrant (6)
$ vagrant up
Steps to start vagrant (7)
Key Commands● $ vagrant up: starts the VM● $ vagrant suspend: save the machine state
and shut down the VM● $ vagrant ssh: Access VM via SSH● $ vagrant provision: Re-runs provision config
and start● $ vagrant reload: Reset VM● $ vagrant destroy: Remove VM
● “IT automation for speed and awesomeness”
● Roughly speaking, it's a way to automate your environment build and config using ruby
CookbooksIt's a ruleset that tell Chef how to install
something
Cookbooks
● You can develop your own cookbooks
● In Github you can find several cookbooks ready to use
Steps to add cookbooks ready (1)
Directories
eg.: $ mkdir -p {cookbooks, data_bags, roles}
Steps to add cookbooks ready (2)
Config VagrantFile
config.vm.provision :chef_solo do |chef| chef.cookbooks_path = “cookbooks” chef.data_bags_pash = “data_bags” chef.roles_path = “roles” chef.add_role = “default”end
Steps to add cookbooks ready (3)
Init git
$ git init .
Steps to add cookbooks ready (4)
Add a cookbook
eg.: $ git submodule add https://github.com/opscode-cookbooks/apt.git cookbooks/apt
Steps to add cookbooks ready (5)
Create default roles (file roles/defaylt.rb)
name “deafult”run_list( “recipe[apt]”)
Steps to add cookbooks ready (6)
Provision
If VM exists: $ vagrant provisionIf not: $ vagrant up
Steps to add cookbooks ready (7)
Be happy!
Tiago Butzke
@tiagobutzke
github.com/tiagobutzke
linkedin.com/in/tiagobutzke