Vagrant + chef's cookbooks development environment like the production in few steps

2,828 views

Published on

Published in: Self Improvement, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
2,828
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
13
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Vagrant + chef's cookbooks development environment like the production in few steps

  1. 1. Development environment like the production in few steps
  2. 2. ● Software Engineer ● Founder and CEO at Stoodos.com ● Classic rock lover ● LP collector ● Beer and coffee drinker @tiagobutzke
  3. 3. ● “Development environments made easy” ● Roughly speaking, it's a way of control a VM via command line
  4. 4. Steps to start vagrant (1) Download and install virtual box www.virtualbox.org/wiki/Downloads
  5. 5. Steps to start vagrant (2) Download and install vagrant vagrantup.com/downloads.html
  6. 6. Steps to start vagrant (3) Add a new box www.vagrantbox.es eg.: $ vagrant box add lucid32 http://files.vagrantup.com/lucid32.box
  7. 7. Steps to start vagrant (4) $ vagrant init
  8. 8. Steps to start vagrant (5) Config VagrantFile eg.: config.vm.box = “lucid32” # the box that we installed in step 3, remember?
  9. 9. Steps to start vagrant (6) $ vagrant up
  10. 10. Steps to start vagrant (7)
  11. 11. 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
  12. 12. ● “IT automation for speed and awesomeness” ● Roughly speaking, it's a way to automate your environment build and config using ruby
  13. 13. Cookbooks It's a ruleset that tell Chef how to install something
  14. 14. Cookbooks ● You can develop your own cookbooks ● In Github you can find several cookbooks ready to use
  15. 15. Steps to add cookbooks ready (1) Directories eg.: $ mkdir -p {cookbooks, data_bags, roles}
  16. 16. 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
  17. 17. Steps to add cookbooks ready (3) Init git $ git init .
  18. 18. Steps to add cookbooks ready (4) Add a cookbook eg.: $ git submodule add https://github.com/opscode-cookbooks/apt.git cookbooks/apt
  19. 19. Steps to add cookbooks ready (5) Create default roles (file roles/defaylt.rb) name “deafult” run_list( “recipe[apt]” )
  20. 20. Steps to add cookbooks ready (6) Provision If VM exists: $ vagrant provision If not: $ vagrant up
  21. 21. Steps to add cookbooks ready (7)
  22. 22. Be happy!
  23. 23. Tiago Butzke @tiagobutzke github.com/tiagobutzke linkedin.com/in/tiagobutzke

×