Vagrant

Virtualizing your development

Created by Javi M. / @javiyt

Agenda

  • Why virtualization?
  • What’s Vagrant?
  • Why use it? What does it require?
  • Terminology
  • The Vagrantfile
  • Demo

Why virtualize environments?

  • Hard configuration of servers in Desktop
  • Keep different configurations
  • Everyone run the code in the same OS
  • Avoid software conflicts
  • Remove differences between environments
  • Test your code in different environments
  • Cheaper than hardware

What is vagrant?

  • Build portable VMs
  • On top of VirtualBox, VMWare, etc…
  • Headless mode
  • Automation (Chef, Puppet, ….)
  • Easy configuration
  • Automatic SSH access and shared folders
  • Build on Ruby by M. Hashimoto & J. Bender

Ok, but why Vagrant?

  • Easy to use
  • Multi-platform tool
  • Configuration versioning
  • Open source tool (MIT License)
  • Share a VM with a few KBs file
  • Developers can test your app using Vagrant

I'm not sure it can be useful

  • vagrant up
  • Run multiple VMs
  • Can be extended via plugins
  • Complete command-line
  • GUI mode

What I need to use it?

Terminology

  • Vagrantfile
  • Box (precise64.box, ….)
  • Provider (VirtualBox, VMWare, ….)
  • Provisioner (Puppet, Chef, …)

Useful Vagrant commands

  • $ vagrant init
  • $ vagrant up/halt
  • $ vagrant reload
  • $ vagrant suspend/resume
  • $ vagrant provision
  • $ vagrant destroy
  • $ vagrant ssh

The Vagrantfile

  • Hostname
  • Network
  • Shared folders
  • Provisioner

Let's start

  • Choose a virtual machine as base from vagrantcloud.com or create yours
  • $ vagrant init (name of selected virtual machine)
  • $ vagrant up

Demo time

code can be found on: github.com/javiyt/vagrantdemo

Useful links

Books

Questions