SlideShare a Scribd company logo
1 of 18
vagrant |ˈvāgrənt
 a person without a settled
 home or regular work who
wanders from place to place
       and lives by begging
                  @CraigMcEldowney
                                 +
                       @SteveRifkin
                                 =
                           @crifkin
 Ruby-powered command line interface to
  VirtualBox
 Deployment environment for local virtual
  environments


According to those who know:
“Create and configure lightweight,
 reproducible and portable environments.”


Vagrant: What is it?
   Virtualized development environment
    ◦ aka Stop installing client crap on your local machine
   Built-in dev environment sandboxing
    ◦ Client A stops messing with Client B
    ◦ Client A’s hipster retro version of Varnish 1.2.x doesn’t
      trump Client B’s awesome future branch of Varnish 4.x
   Multi-VM Host Environment
    ◦ aka Run a full production stack on your local machine for
      testing
   Package Virtual Environments
    ◦ aka Sick of troubleshooting a fellow dev’s environment–
      WHY DOESN’T SOLR WORK!@$@!#-- just give them the
      entire environment




Vagrant: Why? (Use Cases)
   Download and install VirtualBox
    ◦ https://www.virtualbox.org/wiki/Downloads
   Download and install Vagrant
    ◦ http://vagrantup.com
   Download base Box (aka AMI, Base
    Image, etc)
    ◦ vagrant box add precise64
      http://files.vagrantup.com/precise64.box
    ◦ Community-curated list of Vagrant boxes:
      http://www.vagrantbox.es/




Vagrant: What?
 My First Vagrant machine
 mkdirmymachine
 cdmymachine
 vagrant init precise64
    ◦ Creates a general Vagrantfile
   vagrant up
    ◦ Create/spin up virtual machine instance
   vagrant ssh
    ◦ Connect to virtual machine instance



My First Vagrant…
   config.vm.box = "precise64”
    ◦ Base image your server built on.
    ◦ This association only exists on first spin-up, then this instance becomes its
      own standalone
   config.vm.network :hostonly, "192.168.100.10”
    ◦ Specify an IP address that can be used by other Virtual Machines in this
      VirtualBox environment
    ◦ http://vagrantup.com/v1/docs/host_only_networking.html
    ◦ No Security built-in. All ports open!
   config.vm.network :bridged
    ◦ Make VM appear as a physical device on your current network
    ◦ http://vagrantup.com/v1/docs/bridged_networking.html
   config.vm.forward_port 80,8080
    ◦ Forward port from VM to localhost, e.g. I go to localhost:8080 in my
      browser to see VM-hosted website




My Vagrantfile: Basic
   Super simple portability:
    cdmyserver
    vagrant package –-output grammas-present.box
    Give resulting grammas-present.box to your
    closest friends and they can spin up the
    environment
    To use on remote machine:
   Copy Vagrant box locally
   vagrant box add grammas-present.box
   vagrant init grammas-present
   vagrant up



Pack Your Box and Hit the Road
   vagrant reload
    ◦ Reload settings from Vagrantfile, run any
      provisioners (more later)
   Need to rerun config?
    ◦ Just tear it down and start again
    ◦ vagrant destroy && vagrant up




Tweak existing Vagrant VM
   vagrant suspend
    ◦ Save the current running state of VM and then
      stop it!
    ◦ Resume working with resume
   Vagrant halt
    ◦ Graceful shutdown of machine
    ◦ Resume working with vagrant up
   Vagrant destroy
    ◦ I hate this machine. I will destroy it.
    ◦ Resume working (from scratch) with vagrant
      up



I’m done with this Vagrant box
   Vagrant automatically shares the root
    directory for vagrant file to VM at /vagrant

   mkdirmyserver&&cdmyserver
   vagrant init precise64
   vagrant up
   touch hi.txt
   vagrant ssh
   >ls –al /vagrant
    ◦ You’ll see hi.txt smiling back at you.




Other Awesome: NFS Mounts
   Use other tools to provision the box:
    ◦   Chef-solo
    ◦   Chef-server
    ◦   Puppet
    ◦   PuppetServer
    ◦   Shell
    ◦   Others…




Now the fun stuff-- Provisioning
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = "../my-recipes/cookbooks”
chef.roles_path = "../my-recipes/roles”
chef.data_bags_path = "../my-recipes/data_bags”
chef.add_recipe "mysql”
chef.add_role "web”
 # You may also specify custom JSON attributes:
 # chef.json = { :mysql_password => "foo" }
end




Provisioning: Chef-Solo
 Define Chef Server URL, validation key path, run list, client
  name, environment…
 Override any node attributes!!
chef.json.merge!({
 :cloud => {:private_ips => "192.168.100.11”},
 :drupal => {
   :db => {
     :database => "crifkin”,
     :host => "192.168.100.100",
     :user => "drupal",
     :password => "drupal1”
   }
 }
})




Provisioning: Chef-server
   Remember to delete client/node between
    runs
   Vagrant provision == chef-client
    ◦ OR chef-client –c /tmp/vagrant-chef-1/client.rb
   ipaddress
    ◦ Vagrant assigns internal IP address to eth0
    ◦ Host-only address is assigned, but not saved to
      ohaivar for ipaddress
    ◦ Work-around: Overwrite desired ohai value with
     chef.json.merge!({
       :cloud => {
         :private_ips => "192.168.100.11"
       }})




Chef-Server Gotchas
Vagrant::Config.run do |config|
config.vm.define :web do |web_config|
web_config.vm.box = "web"
web_config.vm.forward_port 80, 8080
 end
config.vm.define :db do |db_config|
db_config.vm.box = "db"
db_config.vm.forward_port 3306, 3306
 end
End

•   To spin up:
•   cdmystack
•   vagrant up
•   OR do them one at a time with
    • Vagrant up db
    • Vagrant up web




More fun… Multiple VMs!!!
   Vagrant up doesn’t always work for inexplicable
    reasons
    ◦ That’s why there is:
       vagrant destroy –f&& vagrant up
   VirtualBox sometimes gets overzealous in
    creating backups/clones
    ◦ Check ~/VirtualBoxVMs for any folders not matching
      actual Virtual Machines and clean out periodically
 Documentation is good, but sparse. No
  comprehensive resource yet on all
  Vagrantfileparams, etc…
 Vagrants are known to steal cats.
    ◦ Just something I heard on the interwebs




General Vagrant Gotchas
   Basic Tutorial:
    http://vagrantup.com/v1/docs/getting-
    started/index.html
   General Docs:
    http://vagrantup.com/v1/docs/index.html
   Some great use cases and advanced tutorial
    http://devops.me/2011/10/05/vagrant/
   http://beacon.wharton.upenn.edu/404/2011/
    12/keeping-your-machine-clean-with-
    vagrant-chef/
   http://lumberjaph.net/misc/2010/11/22/vagr
    ant-rocks.html



Awesome Links
   Fancy box packaging
    ◦ http://devops.me/2011/10/06/building-
      baseboxes/
    ◦ http://wiki.opscode.com/display/chef/Vagrant
   postinstall.sh
    ◦ Custom scripts to run after spin-up
    ◦ Cheap/easy way to configure the box other
      than chef/other sources…
    ◦ Create DBs, load files, etc… true end-to-end
      bootstrap



Advanced topics

More Related Content

What's hot

Vagrant crash course
Vagrant crash courseVagrant crash course
Vagrant crash courseMarcus Deglos
 
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
 
It Works On My Machine: Vagrant for Software Development
It Works On My Machine: Vagrant for Software DevelopmentIt Works On My Machine: Vagrant for Software Development
It Works On My Machine: Vagrant for Software DevelopmentCarlos Perez
 
Vagrant + Docker provider [+Puppet]
Vagrant + Docker provider [+Puppet]Vagrant + Docker provider [+Puppet]
Vagrant + Docker provider [+Puppet]Nicolas Poggi
 
Vagrant 101 Workshop
Vagrant 101 WorkshopVagrant 101 Workshop
Vagrant 101 WorkshopLiora Milbaum
 
VCCW - Vagrant based WordPress development environment
VCCW - Vagrant based WordPress development environmentVCCW - Vagrant based WordPress development environment
VCCW - Vagrant based WordPress development environmentTakayuki Miyauchi
 
Vagrant hands on workshop for beginners
Vagrant hands on workshop for beginnersVagrant hands on workshop for beginners
Vagrant hands on workshop for beginnersLiora Milbaum
 
Node.js, Vagrant, Chef, and Mathoid @ Benetech
Node.js, Vagrant, Chef, and Mathoid @ BenetechNode.js, Vagrant, Chef, and Mathoid @ Benetech
Node.js, Vagrant, Chef, and Mathoid @ BenetechChristopher Bumgardner
 
Wocker @WordBench Osaka No.41
Wocker @WordBench Osaka No.41Wocker @WordBench Osaka No.41
Wocker @WordBench Osaka No.41Kite Koga
 
Create your very own Development Environment with Vagrant and Packer
Create your very own Development Environment with Vagrant and PackerCreate your very own Development Environment with Vagrant and Packer
Create your very own Development Environment with Vagrant and Packerfrastel
 
Virtualization for Developers
Virtualization for DevelopersVirtualization for Developers
Virtualization for DevelopersJohn Coggeshall
 
Building (localized) Vagrant boxes with Packer
Building (localized) Vagrant boxes with PackerBuilding (localized) Vagrant boxes with Packer
Building (localized) Vagrant boxes with PackerCristovao G. Verstraeten
 

What's hot (20)

Introduction to Vagrant
Introduction to VagrantIntroduction to Vagrant
Introduction to Vagrant
 
Vagrant crash course
Vagrant crash courseVagrant crash course
Vagrant crash course
 
Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)
 
Intro to vagrant
Intro to vagrantIntro to vagrant
Intro to vagrant
 
It Works On My Machine: Vagrant for Software Development
It Works On My Machine: Vagrant for Software DevelopmentIt Works On My Machine: Vagrant for Software Development
It Works On My Machine: Vagrant for Software Development
 
Vagrant + Docker provider [+Puppet]
Vagrant + Docker provider [+Puppet]Vagrant + Docker provider [+Puppet]
Vagrant + Docker provider [+Puppet]
 
Vagrant 101 Workshop
Vagrant 101 WorkshopVagrant 101 Workshop
Vagrant 101 Workshop
 
Vagrant
Vagrant Vagrant
Vagrant
 
Vagrant
VagrantVagrant
Vagrant
 
Vagrant
VagrantVagrant
Vagrant
 
Using vagrant
Using vagrantUsing vagrant
Using vagrant
 
VCCW - Vagrant based WordPress development environment
VCCW - Vagrant based WordPress development environmentVCCW - Vagrant based WordPress development environment
VCCW - Vagrant based WordPress development environment
 
Vagrant hands on workshop for beginners
Vagrant hands on workshop for beginnersVagrant hands on workshop for beginners
Vagrant hands on workshop for beginners
 
Vagrant
VagrantVagrant
Vagrant
 
Node.js, Vagrant, Chef, and Mathoid @ Benetech
Node.js, Vagrant, Chef, and Mathoid @ BenetechNode.js, Vagrant, Chef, and Mathoid @ Benetech
Node.js, Vagrant, Chef, and Mathoid @ Benetech
 
Wocker @WordBench Osaka No.41
Wocker @WordBench Osaka No.41Wocker @WordBench Osaka No.41
Wocker @WordBench Osaka No.41
 
Create your very own Development Environment with Vagrant and Packer
Create your very own Development Environment with Vagrant and PackerCreate your very own Development Environment with Vagrant and Packer
Create your very own Development Environment with Vagrant and Packer
 
Vagrant & Docker
Vagrant & DockerVagrant & Docker
Vagrant & Docker
 
Virtualization for Developers
Virtualization for DevelopersVirtualization for Developers
Virtualization for Developers
 
Building (localized) Vagrant boxes with Packer
Building (localized) Vagrant boxes with PackerBuilding (localized) Vagrant boxes with Packer
Building (localized) Vagrant boxes with Packer
 

Viewers also liked

SF DevOps: Introducing Vagrant
SF DevOps: Introducing VagrantSF DevOps: Introducing Vagrant
SF DevOps: Introducing VagrantMitchell Hashimoto
 
Automate your Development Environment with Vagrant & Chef
Automate your Development Environment with Vagrant & ChefAutomate your Development Environment with Vagrant & Chef
Automate your Development Environment with Vagrant & Chef Michael Lihs
 
AtoM and Vagrant: Installing and Configuring the AtoM Vagrant Box for Local T...
AtoM and Vagrant: Installing and Configuring the AtoM Vagrant Box for Local T...AtoM and Vagrant: Installing and Configuring the AtoM Vagrant Box for Local T...
AtoM and Vagrant: Installing and Configuring the AtoM Vagrant Box for Local T...Artefactual Systems - AtoM
 
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
 
DevOps, A brief introduction to Vagrant & Ansible
DevOps, A brief introduction to Vagrant & AnsibleDevOps, A brief introduction to Vagrant & Ansible
DevOps, A brief introduction to Vagrant & AnsibleArnaud LEMAIRE
 
A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩
A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩
A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩Wen-Tien Chang
 
Virtual Box Presentation
Virtual Box Presentation Virtual Box Presentation
Virtual Box Presentation Pete DuMelle
 
Automated Deployments with Ansible
Automated Deployments with AnsibleAutomated Deployments with Ansible
Automated Deployments with AnsibleMartin Etmajer
 
Vagrant and docker
Vagrant and dockerVagrant and docker
Vagrant and docker文峰 眭
 

Viewers also liked (10)

SF DevOps: Introducing Vagrant
SF DevOps: Introducing VagrantSF DevOps: Introducing Vagrant
SF DevOps: Introducing Vagrant
 
Automate your Development Environment with Vagrant & Chef
Automate your Development Environment with Vagrant & ChefAutomate your Development Environment with Vagrant & Chef
Automate your Development Environment with Vagrant & Chef
 
AtoM and Vagrant: Installing and Configuring the AtoM Vagrant Box for Local T...
AtoM and Vagrant: Installing and Configuring the AtoM Vagrant Box for Local T...AtoM and Vagrant: Installing and Configuring the AtoM Vagrant Box for Local T...
AtoM and Vagrant: Installing and Configuring the AtoM Vagrant Box for Local T...
 
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
 
DevOps, A brief introduction to Vagrant & Ansible
DevOps, A brief introduction to Vagrant & AnsibleDevOps, A brief introduction to Vagrant & Ansible
DevOps, A brief introduction to Vagrant & Ansible
 
Virtualbox
VirtualboxVirtualbox
Virtualbox
 
A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩
A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩
A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩
 
Virtual Box Presentation
Virtual Box Presentation Virtual Box Presentation
Virtual Box Presentation
 
Automated Deployments with Ansible
Automated Deployments with AnsibleAutomated Deployments with Ansible
Automated Deployments with Ansible
 
Vagrant and docker
Vagrant and dockerVagrant and docker
Vagrant and docker
 

Similar to Vagrant-Overview

ITB2015 - Winning with Vagrant, Puppet and Chef
ITB2015 - Winning with Vagrant, Puppet and ChefITB2015 - Winning with Vagrant, Puppet and Chef
ITB2015 - Winning with Vagrant, Puppet and ChefOrtus Solutions, Corp
 
Vagrant step-by-step guide for Beginners
Vagrant step-by-step guide for BeginnersVagrant step-by-step guide for Beginners
Vagrant step-by-step guide for BeginnersSagar Acharya
 
Create Development and Production Environments with Vagrant
Create Development and Production Environments with VagrantCreate Development and Production Environments with Vagrant
Create Development and Production Environments with VagrantBrian Hogan
 
Quick & Easy Dev Environments with Vagrant
Quick & Easy Dev Environments with VagrantQuick & Easy Dev Environments with Vagrant
Quick & Easy Dev Environments with VagrantJoe Ferguson
 
NetDevOps Developer Environments with Vagrant @ SCALE16x
NetDevOps Developer Environments with Vagrant @ SCALE16xNetDevOps Developer Environments with Vagrant @ SCALE16x
NetDevOps Developer Environments with Vagrant @ SCALE16xHank Preston
 
Making Developers Productive with Vagrant, VirtualBox, and Docker
Making Developers Productive with Vagrant, VirtualBox, and DockerMaking Developers Productive with Vagrant, VirtualBox, and Docker
Making Developers Productive with Vagrant, VirtualBox, and DockerJohn Rofrano
 
Minicurso de Vagrant
Minicurso de VagrantMinicurso de Vagrant
Minicurso de VagrantLeandro Nunes
 
Environments line-up! Vagrant & Puppet 101
Environments line-up! Vagrant & Puppet 101Environments line-up! Vagrant & Puppet 101
Environments line-up! Vagrant & Puppet 101jelrikvh
 
Using Vagrant
Using VagrantUsing Vagrant
Using Vagrantandygale
 
Vagrant for real
Vagrant for realVagrant for real
Vagrant for realCodemotion
 
Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))Michele Orselli
 
Vagrant are you still develop in a non-virtual environment-
Vagrant  are you still develop in a non-virtual environment-Vagrant  are you still develop in a non-virtual environment-
Vagrant are you still develop in a non-virtual environment-Anatoly Bubenkov
 
Vagrant - Version control your dev environment
Vagrant - Version control your dev environmentVagrant - Version control your dev environment
Vagrant - Version control your dev environmentbocribbz
 
Multi-provider Vagrant and Chef: AWS, VMware, and more
Multi-provider Vagrant and Chef: AWS, VMware, and moreMulti-provider Vagrant and Chef: AWS, VMware, and more
Multi-provider Vagrant and Chef: AWS, VMware, and moreChef Software, Inc.
 
Local development environment through virtualisation
Local development environment through virtualisationLocal development environment through virtualisation
Local development environment through virtualisationRadu Barbu
 
Devoxx UK 2013: Sandboxing with the Vagrant-Binding API
Devoxx UK 2013: Sandboxing with the Vagrant-Binding APIDevoxx UK 2013: Sandboxing with the Vagrant-Binding API
Devoxx UK 2013: Sandboxing with the Vagrant-Binding APIHendrik Ebbers
 
DevOps Hackathon - Session 1: Vagrant
DevOps Hackathon - Session 1: VagrantDevOps Hackathon - Session 1: Vagrant
DevOps Hackathon - Session 1: VagrantAntons Kranga
 
Vagrant-Binding JUG Dortmund
Vagrant-Binding JUG DortmundVagrant-Binding JUG Dortmund
Vagrant-Binding JUG DortmundHendrik Ebbers
 

Similar to Vagrant-Overview (20)

ITB2015 - Winning with Vagrant, Puppet and Chef
ITB2015 - Winning with Vagrant, Puppet and ChefITB2015 - Winning with Vagrant, Puppet and Chef
ITB2015 - Winning with Vagrant, Puppet and Chef
 
Vagrant step-by-step guide for Beginners
Vagrant step-by-step guide for BeginnersVagrant step-by-step guide for Beginners
Vagrant step-by-step guide for Beginners
 
Create Development and Production Environments with Vagrant
Create Development and Production Environments with VagrantCreate Development and Production Environments with Vagrant
Create Development and Production Environments with Vagrant
 
Quick & Easy Dev Environments with Vagrant
Quick & Easy Dev Environments with VagrantQuick & Easy Dev Environments with Vagrant
Quick & Easy Dev Environments with Vagrant
 
NetDevOps Developer Environments with Vagrant @ SCALE16x
NetDevOps Developer Environments with Vagrant @ SCALE16xNetDevOps Developer Environments with Vagrant @ SCALE16x
NetDevOps Developer Environments with Vagrant @ SCALE16x
 
Making Developers Productive with Vagrant, VirtualBox, and Docker
Making Developers Productive with Vagrant, VirtualBox, and DockerMaking Developers Productive with Vagrant, VirtualBox, and Docker
Making Developers Productive with Vagrant, VirtualBox, and Docker
 
Minicurso de Vagrant
Minicurso de VagrantMinicurso de Vagrant
Minicurso de Vagrant
 
Environments line-up! Vagrant & Puppet 101
Environments line-up! Vagrant & Puppet 101Environments line-up! Vagrant & Puppet 101
Environments line-up! Vagrant & Puppet 101
 
Using Vagrant
Using VagrantUsing Vagrant
Using Vagrant
 
Vagrant for real
Vagrant for realVagrant for real
Vagrant for real
 
Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))
 
Vagrant are you still develop in a non-virtual environment-
Vagrant  are you still develop in a non-virtual environment-Vagrant  are you still develop in a non-virtual environment-
Vagrant are you still develop in a non-virtual environment-
 
Vagrant - Version control your dev environment
Vagrant - Version control your dev environmentVagrant - Version control your dev environment
Vagrant - Version control your dev environment
 
FreeBSD: Dev to Prod
FreeBSD: Dev to ProdFreeBSD: Dev to Prod
FreeBSD: Dev to Prod
 
Vagrant Up in 5 Easy Steps
Vagrant Up in 5 Easy StepsVagrant Up in 5 Easy Steps
Vagrant Up in 5 Easy Steps
 
Multi-provider Vagrant and Chef: AWS, VMware, and more
Multi-provider Vagrant and Chef: AWS, VMware, and moreMulti-provider Vagrant and Chef: AWS, VMware, and more
Multi-provider Vagrant and Chef: AWS, VMware, and more
 
Local development environment through virtualisation
Local development environment through virtualisationLocal development environment through virtualisation
Local development environment through virtualisation
 
Devoxx UK 2013: Sandboxing with the Vagrant-Binding API
Devoxx UK 2013: Sandboxing with the Vagrant-Binding APIDevoxx UK 2013: Sandboxing with the Vagrant-Binding API
Devoxx UK 2013: Sandboxing with the Vagrant-Binding API
 
DevOps Hackathon - Session 1: Vagrant
DevOps Hackathon - Session 1: VagrantDevOps Hackathon - Session 1: Vagrant
DevOps Hackathon - Session 1: Vagrant
 
Vagrant-Binding JUG Dortmund
Vagrant-Binding JUG DortmundVagrant-Binding JUG Dortmund
Vagrant-Binding JUG Dortmund
 

Recently uploaded

Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 

Recently uploaded (20)

Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 

Vagrant-Overview

  • 1. vagrant |ˈvāgrənt a person without a settled home or regular work who wanders from place to place and lives by begging @CraigMcEldowney + @SteveRifkin = @crifkin
  • 2.  Ruby-powered command line interface to VirtualBox  Deployment environment for local virtual environments According to those who know: “Create and configure lightweight, reproducible and portable environments.” Vagrant: What is it?
  • 3. Virtualized development environment ◦ aka Stop installing client crap on your local machine  Built-in dev environment sandboxing ◦ Client A stops messing with Client B ◦ Client A’s hipster retro version of Varnish 1.2.x doesn’t trump Client B’s awesome future branch of Varnish 4.x  Multi-VM Host Environment ◦ aka Run a full production stack on your local machine for testing  Package Virtual Environments ◦ aka Sick of troubleshooting a fellow dev’s environment– WHY DOESN’T SOLR WORK!@$@!#-- just give them the entire environment Vagrant: Why? (Use Cases)
  • 4. Download and install VirtualBox ◦ https://www.virtualbox.org/wiki/Downloads  Download and install Vagrant ◦ http://vagrantup.com  Download base Box (aka AMI, Base Image, etc) ◦ vagrant box add precise64 http://files.vagrantup.com/precise64.box ◦ Community-curated list of Vagrant boxes: http://www.vagrantbox.es/ Vagrant: What?
  • 5.  My First Vagrant machine  mkdirmymachine  cdmymachine  vagrant init precise64 ◦ Creates a general Vagrantfile  vagrant up ◦ Create/spin up virtual machine instance  vagrant ssh ◦ Connect to virtual machine instance My First Vagrant…
  • 6. config.vm.box = "precise64” ◦ Base image your server built on. ◦ This association only exists on first spin-up, then this instance becomes its own standalone  config.vm.network :hostonly, "192.168.100.10” ◦ Specify an IP address that can be used by other Virtual Machines in this VirtualBox environment ◦ http://vagrantup.com/v1/docs/host_only_networking.html ◦ No Security built-in. All ports open!  config.vm.network :bridged ◦ Make VM appear as a physical device on your current network ◦ http://vagrantup.com/v1/docs/bridged_networking.html  config.vm.forward_port 80,8080 ◦ Forward port from VM to localhost, e.g. I go to localhost:8080 in my browser to see VM-hosted website My Vagrantfile: Basic
  • 7. Super simple portability: cdmyserver vagrant package –-output grammas-present.box Give resulting grammas-present.box to your closest friends and they can spin up the environment To use on remote machine:  Copy Vagrant box locally  vagrant box add grammas-present.box  vagrant init grammas-present  vagrant up Pack Your Box and Hit the Road
  • 8. vagrant reload ◦ Reload settings from Vagrantfile, run any provisioners (more later)  Need to rerun config? ◦ Just tear it down and start again ◦ vagrant destroy && vagrant up Tweak existing Vagrant VM
  • 9. vagrant suspend ◦ Save the current running state of VM and then stop it! ◦ Resume working with resume  Vagrant halt ◦ Graceful shutdown of machine ◦ Resume working with vagrant up  Vagrant destroy ◦ I hate this machine. I will destroy it. ◦ Resume working (from scratch) with vagrant up I’m done with this Vagrant box
  • 10. Vagrant automatically shares the root directory for vagrant file to VM at /vagrant  mkdirmyserver&&cdmyserver  vagrant init precise64  vagrant up  touch hi.txt  vagrant ssh  >ls –al /vagrant ◦ You’ll see hi.txt smiling back at you. Other Awesome: NFS Mounts
  • 11. Use other tools to provision the box: ◦ Chef-solo ◦ Chef-server ◦ Puppet ◦ PuppetServer ◦ Shell ◦ Others… Now the fun stuff-- Provisioning
  • 12. config.vm.provision :chef_solo do |chef| chef.cookbooks_path = "../my-recipes/cookbooks” chef.roles_path = "../my-recipes/roles” chef.data_bags_path = "../my-recipes/data_bags” chef.add_recipe "mysql” chef.add_role "web” # You may also specify custom JSON attributes: # chef.json = { :mysql_password => "foo" } end Provisioning: Chef-Solo
  • 13.  Define Chef Server URL, validation key path, run list, client name, environment…  Override any node attributes!! chef.json.merge!({ :cloud => {:private_ips => "192.168.100.11”}, :drupal => { :db => { :database => "crifkin”, :host => "192.168.100.100", :user => "drupal", :password => "drupal1” } } }) Provisioning: Chef-server
  • 14. Remember to delete client/node between runs  Vagrant provision == chef-client ◦ OR chef-client –c /tmp/vagrant-chef-1/client.rb  ipaddress ◦ Vagrant assigns internal IP address to eth0 ◦ Host-only address is assigned, but not saved to ohaivar for ipaddress ◦ Work-around: Overwrite desired ohai value with chef.json.merge!({ :cloud => { :private_ips => "192.168.100.11" }}) Chef-Server Gotchas
  • 15. Vagrant::Config.run do |config| config.vm.define :web do |web_config| web_config.vm.box = "web" web_config.vm.forward_port 80, 8080 end config.vm.define :db do |db_config| db_config.vm.box = "db" db_config.vm.forward_port 3306, 3306 end End • To spin up: • cdmystack • vagrant up • OR do them one at a time with • Vagrant up db • Vagrant up web More fun… Multiple VMs!!!
  • 16. Vagrant up doesn’t always work for inexplicable reasons ◦ That’s why there is:  vagrant destroy –f&& vagrant up  VirtualBox sometimes gets overzealous in creating backups/clones ◦ Check ~/VirtualBoxVMs for any folders not matching actual Virtual Machines and clean out periodically  Documentation is good, but sparse. No comprehensive resource yet on all Vagrantfileparams, etc…  Vagrants are known to steal cats. ◦ Just something I heard on the interwebs General Vagrant Gotchas
  • 17. Basic Tutorial: http://vagrantup.com/v1/docs/getting- started/index.html  General Docs: http://vagrantup.com/v1/docs/index.html  Some great use cases and advanced tutorial http://devops.me/2011/10/05/vagrant/  http://beacon.wharton.upenn.edu/404/2011/ 12/keeping-your-machine-clean-with- vagrant-chef/  http://lumberjaph.net/misc/2010/11/22/vagr ant-rocks.html Awesome Links
  • 18. Fancy box packaging ◦ http://devops.me/2011/10/06/building- baseboxes/ ◦ http://wiki.opscode.com/display/chef/Vagrant  postinstall.sh ◦ Custom scripts to run after spin-up ◦ Cheap/easy way to configure the box other than chef/other sources… ◦ Create DBs, load files, etc… true end-to-end bootstrap Advanced topics