SlideShare una empresa de Scribd logo
1 de 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

Más contenido relacionado

Destacado

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文峰 眭
 

Destacado (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
 

Más de 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
 

Más de 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
 

Último

Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 
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 Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
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
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...AliaaTarek5
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 

Último (20)

Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 
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 Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
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
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 

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

Notas del editor

  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