Vagrant devopsdays Mountain View 2011

27,240 views
27,110 views

Published on

Published in: Technology
1 Comment
45 Likes
Statistics
Notes
  • DevOps Mountain View 2011: Why Vagrant is Cool by Patrick Debois from dev2ops.org on Vimeo.<br /><object type="application/x-shockwave-flash" data="http://vimeo.com/moogaloop.swf?clip_id=25891810&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1&amp;autoplay=0&amp;loop=0" width="350" height="288"><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=25891810&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1&amp;autoplay=0&amp;loop=0"></param><embed src="http://vimeo.com/moogaloop.swf?clip_id=25891810&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1&amp;autoplay=0&amp;loop=0" width="350" height="288" type="application/x-shockwave-flash"></embed></object>
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total views
27,240
On SlideShare
0
From Embeds
0
Number of Embeds
17,153
Actions
Shares
0
Downloads
152
Comments
1
Likes
45
Embeds 0
No embeds

No notes for slide

Vagrant devopsdays Mountain View 2011

  1. 1. Vagrant Ecosystem Patrick DeboisFriday 17 June 2011
  2. 2. Info & Credits • Mitchell Hashimoto & John Bender • http://vagrantup.com • Based on Virtualbox , Ruby • Runs on Mac OS, Linux, WindowsFriday 17 June 2011
  3. 3. AHA Let’s get this project startedFriday 17 June 2011
  4. 4. Vagrant 101Friday 17 June 2011
  5. 5. The power of CLI $ gem install vagrant $ vagrant box add base http://files.vagrantup.com/lucid32.box $ vagrant init $ vagrant upFriday 17 June 2011
  6. 6. Step 1 : installation $ gem install vagrant $ vagrant box add base http://files.vagrantup.com/lucid32.box $ vagrant init $ vagrant up Installs the vagrant ruby softwareFriday 17 June 2011
  7. 7. Step 2 : base box $ gem install vagrant $ vagrant box add base http://files.vagrantup.com/lucid32.box $ vagrant init $ vagrant up ‘BASE’ LUCID Downloads predefined VM - f.i. Ubuntu 10.04 (Lucid) and registers it as name ‘base’Friday 17 June 2011
  8. 8. Step 3 : configuration $ gem install vagrant $ vagrant box add base http://files.vagrantup.com/lucid32.box $ vagrant init $ vagrant up Creates a standard configuration fileFriday 17 June 2011
  9. 9. Vagrantfile Vagrant::Config.run do |config| # Every Vagrant virtual environment requires a box to build off of. config.vm.box = "base" end ‘BASE’ LUCID Vagrantfile = Project file Links our project with the ‘Base’ boxFriday 17 June 2011
  10. 10. Step 4 : boot $ gem install vagrant $ vagrant box add base http://files.vagrantup.com/lucid32.box $ vagrant init $ vagrant up Extracts the ‘basebox’ Creates a new VM in Virtualbox based on ‘basebox’ Boots the new VMFriday 17 June 2011
  11. 11. KA-CHING Ready to rock SSHFriday 17 June 2011
  12. 12. I VagrantFriday 17 June 2011
  13. 13. Reduces Setup Time 1 2 3 4 SSHNo-VM Automated ReadyFriday 17 June 2011
  14. 14. Simplicity VBoxManage guestcontrol exec[ute] <vmname>|<uuid> <path to program> --username <name> --password <password> [--arguments "<arguments>"] [--environment "<NAME>=<VALUE> [<NAME>=<VALUE>]"] [--flags <flags>] [--timeout <msec>] [--verbose] [--wait-for exit,stdout,stderr||] $ gem install vagrant copyto|cp <vmname>|<uuid> $ vagrant box add base http://files.vagrantup.com/ <source on host> <destination on guest> lucid32.box --username <name> --password <password> $ vagrant init [--dryrun] [--follow] [--recursive] [--verbose] $ vagrant up createdir[ectory]|mkdir|md <vmname>|<uuid> <directory to create on guest> --username <name> --password <password> [--parents] [--mode <mode>] [--verbose] updateadditions <vmname>|<uuid> [--source <guest additions .ISO>] [--verbose]Friday 17 June 2011
  15. 15. Self-Servicing Base box “PULL”Friday 17 June 2011
  16. 16. Consistency Base box DEVELOPER1 DEVELOPER2Friday 17 June 2011
  17. 17. Repeatability Base box UP DESTROY UP DESTROY t1 t2 t3 t4Friday 17 June 2011
  18. 18. Contained Project 1 Project 2 Project 3 LaptopFriday 17 June 2011
  19. 19. Vagrant 201Friday 17 June 2011
  20. 20. FileSharing /data config.vm.share_folder "datastore", "/data", "./data" /home/patrick/dataFriday 17 June 2011
  21. 21. Port Forwarding 80 # Forward a port from the guest to the host, which allows for outside # computers to access the VM, whereas host only networking does not. config.vm.forward_port "http", 80, 9000 config.vm.forward_port "redis", 6379, 6379 config.vm.forward_port "mysql", 3306, 3306 8080Friday 17 June 2011
  22. 22. Non-Intrusive Project 1 Project 2 Project 3 Laptop My Editor My IDE My BrowserFriday 17 June 2011
  23. 23. Multi VM Stack config.vm.define :web do |web_config| WEB WEB WEB web_config.vm.box = "ubuntu" ... end config.vm.define :app do |app_config| app_config.vm.box = "ubuntu" APP APP APP ... end config.vm.define :db do |db_config| db_config.vm.box = "ubuntu" DB DB DB ... end Project 1 Project 2 Project 3Friday 17 June 2011
  24. 24. Vagrant 301Friday 17 June 2011
  25. 25. Cookbooks/ Manifests + Provision Basebox Provisioner VM chef/puppet/script Just Enough Operating SystemFriday 17 June 2011
  26. 26. Vagrantbox.es Gareth RushgroveFriday 17 June 2011
  27. 27. CLI Vagrantbox.es >> vagrant vagrantboxes search centos3 centos 5.5 http://dl.dropbox.com/u/15307300/vagrant-0.7-centos-64-base.box6 opscode centos 5 http://opscode-vagrant-boxes.s3.amazonaws.com/centos5-gems.box7 opscode ubuntu 10.04 http://opscode-vagrant-boxes.s3.amazonaws.com/ubuntu10.04-gems.b9 puppet centos 5.5 64 http://puppetlabs.s3.amazonaws.com/pub/centos5_64.box10 puppet centos 4 64 http://puppetlabs.s3.amazonaws.com/pub/centos4_64.box21 centos 5.6 32 http://yum.mnxsolutions.com/vagrant/centos_56_32.box https://github.com/garethr/ruby-vagrantboxesFriday 17 June 2011
  28. 28. Package Cookbooks/ Manifests + Basebox Base VM Provisioner chef/puppet/script box Just Enough Operating SystemFriday 17 June 2011
  29. 29. Provision Config config.vm.provision :chef_solo do |chef| chef.cookbooks_path = ["chefrepo/cookbooks"] chef.add_recipe("app_rails") chef.json.merge!({ :apache => { :listen_ports => [ "8080"] Puppet }) end standalone Chef config.vm.provision :puppet do |puppet| Solo puppet.pp_path = "/tmp/vagrant-puppet" puppet.manifests_path = "./manifests" puppet.module_path = "./modules" puppet.manifest_file = "newbox.pp" end Chef PuppetFriday 17 June 2011 Server Server
  30. 30. Self-Executable Boxes • java -jar mygreatbox.jar “proof of concept” http://www.jedi.be/blog/2011/03/31/installable-vagrant-boxes/ https://github.com/maestrodev/wantonFriday 17 June 2011
  31. 31. Veewee ISO Basebox Provisioner chef/puppet/script Kickstart/Preseed/ Autoyast/ AutoUnattend Ubuntu, Debian, Centos, Just Enough Fedora, Gentoo, Operating System Solaris, Suse, Archlinux, Windows https://github.com/jedi4ever/veeweeFriday 17 June 2011
  32. 32. Version Controlled Basebox Provisioner chef/puppet/script ISO VM Just Enough Operating System Kickstart/Preseed/ Autoyast/ Cookbooks/ Vagrant AutoUnattend Manifests file Git Repo Git Repo Git RepoFriday 17 June 2011
  33. 33. Complex Setups VM Cookbooks/ Manifests Rails Nodejs Hadoop Esper Flume Postgres Mysql HDFS JavaFriday 17 June 2011
  34. 34. Sharing on Github Veewee Chef/Puppet Vagrant Kickstart/Preseed/ Autoyast/ Cookbooks/ Vagrantfile AutoUnattend Manifests Git Repo Git Repo Git RepoFriday 17 June 2011
  35. 35. Shared “codebase” Kickstart/Preseed/ Autoyast/ Cookbooks/ Vagrantfile AutoUnattend Manifests Git Repo Git Repo Git Repo Application Code Git RepoFriday 17 June 2011
  36. 36. Co-Ownership Cookbooks/ Manifests Git Repo Kickstart/Preseed/ Vagrantfile Autoyast/ AutoUnattend DEV & OPS Git Repo pairing Git Repo Application Code Git RepoFriday 17 June 2011
  37. 37. More Ops into Dev • can we speed up this provisioning? • we need a migration script from vX -> vY • we need start/stop scripts • we need consistent data restoreFriday 17 June 2011
  38. 38. Synchronized Release Cycle Application vX Application vX+1 System vX System vX+1Friday 17 June 2011
  39. 39. Tools/Config Consistency DEV PROD Kickstart/Preseed/ Kickstart/Preseed/ Autoyast/ Autoyast/ AutoUnattend AutoUnattend Cookbooks/ Cookbooks/ Manifests Manifests Provisioner Provisioner chef/puppet/script chef/puppet/scriptFriday 17 June 2011
  40. 40. Fail-Safe • vagrant-snap - snapshots - • https://github.com/t9md/vagrant-snap • sahara - sandbox execution apply, rollback • https://github.com/jedi4ever/saharaFriday 17 June 2011
  41. 41. Disposable Test Environments DEV TEST/QA PROD Kickstart/Preseed/ Kickstart/Preseed/ Kickstart/Preseed/ Autoyast/ Autoyast/ Autoyast/ AutoUnattend AutoUnattend AutoUnattend Cookbooks/ Cookbooks/ Cookbooks/ Manifests Manifests Manifests Provisioner Provisioner Provisioner chef/puppet/script chef/puppet/script chef/puppet/script http://paperairoplane.net/?p=240Friday 17 June 2011
  42. 42. Reuse Workflow https://github.com/geemus/fog Vagrant Mccloud https://github.com/jedi4ever/mccloudFriday 17 June 2011
  43. 43. Vagrant - EC2 ‘BASE’ BOX AMI MultiVM MultiVM Recipes/Manifest Recipes/Manifest Shared Folder Rsync Port Forwarding SSH Forwarding Package Snapshot ENV=dev,prod Loadbalancing CloudformationFriday 17 June 2011
  44. 44. Future 1 expand virtualization Vagrant MccloudFriday 17 June 2011
  45. 45. Future 2: Expand baseboxes Linux Windows OSX Vagrant & Veewee & MccloudFriday 17 June 2011
  46. 46. Future 3: integrate in dev tools Maven Eclipse Jenkins deploy Plugin Plugin PluginFriday 17 June 2011
  47. 47. Future 4: dev environment in a box Eclipse Browsers + plugins + plugins VI Textmate Debug tools Database tools Download toolsFriday 17 June 2011
  48. 48. “It works on my machine”Friday 17 June 2011
  49. 49. For Devs (Test Code)Friday 17 June 2011
  50. 50. For Ops (Test Manifests)Friday 17 June 2011
  51. 51. For QA (Explore)Friday 17 June 2011
  52. 52. For Sales (To show off)Friday 17 June 2011
  53. 53. Bridging four worlds without changing! http://www.jedi.be/blog/2011/03/28/using-vagrant-as-a-team/Friday 17 June 2011
  54. 54. Demo Tomorrow OpenspacesFriday 17 June 2011

×