SlideShare a Scribd company logo
1 of 43
Vagrant




Building Virtual Development Environments With
                     Vagrant
Vagrant




Building Virtual Development Environments With
                     Vagrant
Vagrant




Building Virtual Development Environments With
                     Vagrant
             Stop Cutting Cords!
Mike Hagedorn


• @mwhagedorn
• mike@silverchairsolutions.com
Vagrant
                  Agenda
• Why Vagrant?
• Vagrant Hello World
• Provisioning and Vagrant
• Sample Rails App
• Other cool stuff
$ git clone git://.../website.git
$ rails s




            In a perfect world...
$   git clone git://.../website.git
$   ...
$   (magic occurs)
$   ...
$   rails s




             On my planet...
$   git clone git://.../website.git
$   ...
$   (magic occurs)       Huh?
$   ...
$   rails s




             On my planet...
The Issues

• No Isolation
• Not Repeatable
• Not Reliable
The Solution
• Virtualization!
Resolved Issues
• Isolation
 • Application Code Silo’ed
• Repeatable
 • Server Configuration Is Controlled
• Reliable
 • Server Configuration is Proven
Other Benefits

• Bring New People Up To Speed FAST!
• Server Configuration is Source Controlled
• Easier What-If scenarios With Your System
Vagrant
• By Mitch Hashimoto and John Bender
  (1/2010 first commit)
• Leverages Virtual Box
 • Free Virtualization Solution from Oracle
• Provisioning via Chef or Puppet
 • Others via extension API
• Shared Folders
• SSH Access
Installation
$ gem install vagrant
$ vagrant box add base http://files.vagrantup.com/lucid32.box
$ vagrant init
$ vagrant up
Installation
$ gem install vagrant
$ vagrant box add base http://files.vagrantup.com/lucid32.box
$ vagrant init
$ vagrant up




               Downloads, saves as ‘base’
             (other distros vagrantboxes.es)
Installation
$ gem install vagrant
$ vagrant box add base http://files.vagrantup.com/lucid32.box
$ vagrant init
$ vagrant up




                    Create Vagrantfile
Installation
$ gem install vagrant
$ vagrant box add base http://files.vagrantup.com/lucid32.box
$ vagrant init
$ vagrant up




                    Launches Instance
Vagrantfile

Vagrant::Config.run do |config|
  config.vm.box = "base"
end
Demo
Other Commands
$ vagrant box list
$ vagrant box remove <NAME>
$ vagrant up | halt   #launch/shutdown
$ vagrant destroy #shutdown and delete image
$ vagrant suspend | resume #pause and restart
Provisioning


“Logging In To The Server Is A Smell”
Vagrant & Provisioners
Customizing
                  Provisioners
Vagrant::Config.run do |config|
  config.vm.box = "lucid32"
  config.vm.forward_port ‘web’, 80,4567
  # Enable and configure the chef solo provisioner
  config.vm.provision :chef_solo do |chef|
    # We're going to use a local copy of the cookbooks
    chef.cookbooks_path = "cookbooks"
    # Tell chef what recipe to run. In this case, the `vagrant_main` recipe
    # does all the magic.
    chef.add_recipe("vagrant_main")
    chef.json.merge!({ :my_recipe =>{ "foo" =>”bar” })
  end
end




                 Per Recipe Customization
Provisioning

• Chef
• Chef-Solo
• Puppet
• Custom
Provisioning

• Chef
• Chef-Solo
• Puppet
• Custom
Chef

• Abstracts away configuration details for
  platform
• Provides DSL for managing resources
• Idempotent
Chef
• Ruby-based infrastructure configuration
  management tool
• Codifies best practices
• Installation components called “recipes”
• Collection of recipes called “cookbook”
• Server-based and standalone
Chef



•   “Recipes for Chef are like RubyGems for Ruby”
Chef Cookbook
Vagrantfile
Vagrant::Config.run do |config|
  config.vm.box = "lucid32"
  config.vm.forward_port ‘web’, 80,4567
  # Enable and configure the chef solo provisioner
  config.vm.provision :chef_solo do |chef|
    # We're going to use a local copy of the cookbooks
    chef.cookbooks_path = "cookbooks"
    # Tell chef what recipe to run. In this case, the `vagrant_main` recipe
    # does all the magic.
    chef.add_recipe("vagrant_main")
  end
end




                          Maps VM Port
Vagrantfile
Vagrant::Config.run do |config|
  config.vm.box = "lucid32"
  config.vm.forward_port ‘web’, 80,4567
  # Enable and configure the chef solo provisioner
  config.vm.provision :chef_solo do |chef|
    # We're going to use a local copy of the cookbooks
    chef.cookbooks_path = "cookbooks"
    # Tell chef what recipe to run. In this case, the `vagrant_main` recipe
    # does all the magic.
    chef.add_recipe("vagrant_main")
  end
end




                 Recipe Metadata Location
Vagrantfile
Vagrant::Config.run do |config|
  config.vm.box = "lucid32"
  config.vm.forward_port ‘web’, 80,4567
  # Enable and configure the chef solo provisioner
  config.vm.provision :chef_solo do |chef|
    # We're going to use a local copy of the cookbooks
    chef.cookbooks_path = "cookbooks"
    # Tell chef what recipe to run. In this case, the `vagrant_main` recipe
    # does all the magic.
    chef.add_recipe("vagrant_main")
  end
end




                  Which Recipe To Invoke
Demo
Rails App Example
Other Commands
$ vagrant provision




             Only Runs Provisioning Step
Multi-VM Setups
Vagrant::Config.run do |config|
  config.vm.define :web do |web_config|
    web_config.vm.box = "web"
    web_config.vm.forward_port("http", 80, 8080)
    web_config.vm.network("192.168.1.10")
  end

  config.vm.define :db do |db_config|
    db_config.vm.box = "db"
    db_config.vm.forward_port("db", 3306, 3306)
    db_config.vm.network("192.168.1.11")
  end
end
Packaging Own Box


• Allows you to share a provisioned box
$ vagrant package --include Vagrantfile
$ vagrant box add tst package.box #other person adds




              Create Box and Add It
Mike Hagedorn
•   @mwhagedorn

•   mike@silverchairsolutions.com

•   https://github.com/mwhagedorn/lsrc

•   spkr8.com/t/7809
                       Resources
•   http://vagrantup.com

•   http://vagrantbox.es

•   http://wiki.opscode.com/display/chef/Home

•   http://community.opscode.com

More Related Content

Viewers also liked

Vagrant vs Docker
Vagrant vs DockerVagrant vs Docker
Vagrant vs Dockerjchase50
 
An Introduction to AtoM, Archivematica, and Artefactual Systems
An Introduction to AtoM, Archivematica, and Artefactual SystemsAn Introduction to AtoM, Archivematica, and Artefactual Systems
An Introduction to AtoM, Archivematica, and Artefactual SystemsArtefactual Systems - AtoM
 
An Introduction to Vagrant and Docker
An Introduction to Vagrant and DockerAn Introduction to Vagrant and Docker
An Introduction to Vagrant and DockerScott Lowe
 
Virtual Box Presentation
Virtual Box Presentation Virtual Box Presentation
Virtual Box Presentation Pete DuMelle
 
Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)Michele Orselli
 
Vagrant and docker
Vagrant and dockerVagrant and docker
Vagrant and docker文峰 眭
 

Viewers also liked (7)

Vagrant vs Docker
Vagrant vs DockerVagrant vs Docker
Vagrant vs Docker
 
An Introduction to AtoM, Archivematica, and Artefactual Systems
An Introduction to AtoM, Archivematica, and Artefactual SystemsAn Introduction to AtoM, Archivematica, and Artefactual Systems
An Introduction to AtoM, Archivematica, and Artefactual Systems
 
An Introduction to Vagrant and Docker
An Introduction to Vagrant and DockerAn Introduction to Vagrant and Docker
An Introduction to Vagrant and Docker
 
Virtualbox
VirtualboxVirtualbox
Virtualbox
 
Virtual Box Presentation
Virtual Box Presentation Virtual Box Presentation
Virtual Box Presentation
 
Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)
 
Vagrant and docker
Vagrant and dockerVagrant and docker
Vagrant and docker
 

More from Mike Hagedorn

Experienced Cloud Engineer Looking for New Roles
Experienced Cloud Engineer Looking for New RolesExperienced Cloud Engineer Looking for New Roles
Experienced Cloud Engineer Looking for New RolesMike Hagedorn
 
Hacking the Internet of Things
Hacking the Internet of ThingsHacking the Internet of Things
Hacking the Internet of ThingsMike Hagedorn
 
Using OpenStack With Fog
Using OpenStack With FogUsing OpenStack With Fog
Using OpenStack With FogMike Hagedorn
 
Exploring the Internet of Things Using Ruby
Exploring the Internet of Things Using RubyExploring the Internet of Things Using Ruby
Exploring the Internet of Things Using RubyMike Hagedorn
 
Playing With Fire - An Introduction to Node.js
Playing With Fire - An Introduction to Node.jsPlaying With Fire - An Introduction to Node.js
Playing With Fire - An Introduction to Node.jsMike Hagedorn
 
2011 a grape odyssey
2011   a grape odyssey2011   a grape odyssey
2011 a grape odysseyMike Hagedorn
 

More from Mike Hagedorn (7)

Experienced Cloud Engineer Looking for New Roles
Experienced Cloud Engineer Looking for New RolesExperienced Cloud Engineer Looking for New Roles
Experienced Cloud Engineer Looking for New Roles
 
Couchbase Talk
Couchbase TalkCouchbase Talk
Couchbase Talk
 
Hacking the Internet of Things
Hacking the Internet of ThingsHacking the Internet of Things
Hacking the Internet of Things
 
Using OpenStack With Fog
Using OpenStack With FogUsing OpenStack With Fog
Using OpenStack With Fog
 
Exploring the Internet of Things Using Ruby
Exploring the Internet of Things Using RubyExploring the Internet of Things Using Ruby
Exploring the Internet of Things Using Ruby
 
Playing With Fire - An Introduction to Node.js
Playing With Fire - An Introduction to Node.jsPlaying With Fire - An Introduction to Node.js
Playing With Fire - An Introduction to Node.js
 
2011 a grape odyssey
2011   a grape odyssey2011   a grape odyssey
2011 a grape odyssey
 

Recently uploaded

What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 

Recently uploaded (20)

What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 

Vagrant

  • 1. Vagrant Building Virtual Development Environments With Vagrant
  • 2.
  • 3.
  • 4. Vagrant Building Virtual Development Environments With Vagrant
  • 5. Vagrant Building Virtual Development Environments With Vagrant Stop Cutting Cords!
  • 6. Mike Hagedorn • @mwhagedorn • mike@silverchairsolutions.com
  • 7. Vagrant Agenda • Why Vagrant? • Vagrant Hello World • Provisioning and Vagrant • Sample Rails App • Other cool stuff
  • 8. $ git clone git://.../website.git $ rails s In a perfect world...
  • 9. $ git clone git://.../website.git $ ... $ (magic occurs) $ ... $ rails s On my planet...
  • 10. $ git clone git://.../website.git $ ... $ (magic occurs) Huh? $ ... $ rails s On my planet...
  • 11.
  • 12.
  • 13. The Issues • No Isolation • Not Repeatable • Not Reliable
  • 15. Resolved Issues • Isolation • Application Code Silo’ed • Repeatable • Server Configuration Is Controlled • Reliable • Server Configuration is Proven
  • 16. Other Benefits • Bring New People Up To Speed FAST! • Server Configuration is Source Controlled • Easier What-If scenarios With Your System
  • 17. Vagrant • By Mitch Hashimoto and John Bender (1/2010 first commit) • Leverages Virtual Box • Free Virtualization Solution from Oracle • Provisioning via Chef or Puppet • Others via extension API • Shared Folders • SSH Access
  • 18. Installation $ gem install vagrant $ vagrant box add base http://files.vagrantup.com/lucid32.box $ vagrant init $ vagrant up
  • 19. Installation $ gem install vagrant $ vagrant box add base http://files.vagrantup.com/lucid32.box $ vagrant init $ vagrant up Downloads, saves as ‘base’ (other distros vagrantboxes.es)
  • 20. Installation $ gem install vagrant $ vagrant box add base http://files.vagrantup.com/lucid32.box $ vagrant init $ vagrant up Create Vagrantfile
  • 21. Installation $ gem install vagrant $ vagrant box add base http://files.vagrantup.com/lucid32.box $ vagrant init $ vagrant up Launches Instance
  • 22. Vagrantfile Vagrant::Config.run do |config| config.vm.box = "base" end
  • 23. Demo
  • 24. Other Commands $ vagrant box list $ vagrant box remove <NAME> $ vagrant up | halt #launch/shutdown $ vagrant destroy #shutdown and delete image $ vagrant suspend | resume #pause and restart
  • 25. Provisioning “Logging In To The Server Is A Smell”
  • 27. Customizing Provisioners Vagrant::Config.run do |config| config.vm.box = "lucid32" config.vm.forward_port ‘web’, 80,4567 # Enable and configure the chef solo provisioner config.vm.provision :chef_solo do |chef| # We're going to use a local copy of the cookbooks chef.cookbooks_path = "cookbooks" # Tell chef what recipe to run. In this case, the `vagrant_main` recipe # does all the magic. chef.add_recipe("vagrant_main") chef.json.merge!({ :my_recipe =>{ "foo" =>”bar” }) end end Per Recipe Customization
  • 30. Chef • Abstracts away configuration details for platform • Provides DSL for managing resources • Idempotent
  • 31. Chef • Ruby-based infrastructure configuration management tool • Codifies best practices • Installation components called “recipes” • Collection of recipes called “cookbook” • Server-based and standalone
  • 32. Chef • “Recipes for Chef are like RubyGems for Ruby”
  • 34. Vagrantfile Vagrant::Config.run do |config| config.vm.box = "lucid32" config.vm.forward_port ‘web’, 80,4567 # Enable and configure the chef solo provisioner config.vm.provision :chef_solo do |chef| # We're going to use a local copy of the cookbooks chef.cookbooks_path = "cookbooks" # Tell chef what recipe to run. In this case, the `vagrant_main` recipe # does all the magic. chef.add_recipe("vagrant_main") end end Maps VM Port
  • 35. Vagrantfile Vagrant::Config.run do |config| config.vm.box = "lucid32" config.vm.forward_port ‘web’, 80,4567 # Enable and configure the chef solo provisioner config.vm.provision :chef_solo do |chef| # We're going to use a local copy of the cookbooks chef.cookbooks_path = "cookbooks" # Tell chef what recipe to run. In this case, the `vagrant_main` recipe # does all the magic. chef.add_recipe("vagrant_main") end end Recipe Metadata Location
  • 36. Vagrantfile Vagrant::Config.run do |config| config.vm.box = "lucid32" config.vm.forward_port ‘web’, 80,4567 # Enable and configure the chef solo provisioner config.vm.provision :chef_solo do |chef| # We're going to use a local copy of the cookbooks chef.cookbooks_path = "cookbooks" # Tell chef what recipe to run. In this case, the `vagrant_main` recipe # does all the magic. chef.add_recipe("vagrant_main") end end Which Recipe To Invoke
  • 37. Demo
  • 39. Other Commands $ vagrant provision Only Runs Provisioning Step
  • 40. Multi-VM Setups Vagrant::Config.run do |config| config.vm.define :web do |web_config| web_config.vm.box = "web" web_config.vm.forward_port("http", 80, 8080) web_config.vm.network("192.168.1.10") end config.vm.define :db do |db_config| db_config.vm.box = "db" db_config.vm.forward_port("db", 3306, 3306) db_config.vm.network("192.168.1.11") end end
  • 41. Packaging Own Box • Allows you to share a provisioned box
  • 42. $ vagrant package --include Vagrantfile $ vagrant box add tst package.box #other person adds Create Box and Add It
  • 43. Mike Hagedorn • @mwhagedorn • mike@silverchairsolutions.com • https://github.com/mwhagedorn/lsrc • spkr8.com/t/7809 Resources • http://vagrantup.com • http://vagrantbox.es • http://wiki.opscode.com/display/chef/Home • http://community.opscode.com

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. works on my machine is not a valid response\n\n
  11. \n
  12. \n
  13. \n
  14. shared folders - map a directory in your working directory to a place on the virtual file system\nuses share folders of vb by default, can use NFS if you have lots of files\nSSH access - can ssh to it from anywhere if you export and use the \n
  15. vagrant boxes download to ~./vagrant/boxes\ndownload once, is base for other vagrant projects, each project leaves box unmodified\n\n
  16. vagrant boxes download to ~./vagrant/boxes\ndownload once, is base for other vagrant projects, each project leaves box unmodified\n\nLucid32 is a Unbuntu 10.04 image\nother boxes look to vagrantbox.es\n
  17. explain what a vagrantfile is\nlike a rails generator\n
  18. imports base box HD into VB\noptionally it wil provision if its enabled\n\n
  19. \n
  20. ssh to box\nls /vagrant\ncreate a file on local\nshow it\nshow that its running inside of VB\nvagrant destroy\nmapping how it works\npossible to use NFS, some people say default sharing works not so well on big files\n\n
  21. explain\ninterestingly no rename\n\n
  22. not sure who said this, Zed Shaw perhaps\n
  23. by default vagrant provisioning is disabled\n\n
  24. you can do chef.json = in new build (chef only)\nmost examples are chef only, problem because its like italian/spanish.. similar but not same\n
  25. \n
  26. \n
  27. \n
  28. \n
  29. Cookbooks bundle recipes that describe how you want a part of your server to be configured along with the assets they need, such as configuration files or templates.\n
  30. \n
  31. \n
  32. \n
  33. \n
  34. use blink tag\n\n
  35. use TM\n
  36. vagrant reload if you have changed the cookbook path\n
  37. \n
  38. creates a package.box\n
  39. creates a file package.box in the same directory\nShoot for less than 500MB, otherwise too unwiedly, use tips on vagrantup.com\nDefault Memory Allocation set to 360MB\n
  40. \n