THE PROBLEM

Scenario 1

Plain LAMP suite

Every person has to install his enviroment from scratch

The software is different for every stack

No provisioning: manual configuration for each person

Scenario 2

Setup script

my application $ -> ./setup.sh

 

Problems!

Installing some server...

Installing some software...

Configuring it all...

Some people use dumb OSes without even a shell to run scripts

Your MAC / Windows / Wathever is different from the production environment

Unlikely all the software will work all in the same way in different computers

Unlikely the software will be configured the same way in all the computers 

Requires special manteinance (different scripts for different OSes)

Scenario 3

Mega README

The possibility that something goes wrong in a long installation are pretty high

Heavy manteinance, time consuming, platform specific

Problems

  • Not repeatable
  • Not verifiably correct
  • Not isolated

"Vagrant is a tool for creating, managing and distributing portable development environments"

$ vagrant up :

VM creation, VM configuration, provisioning, all in one command!

Repeatable

Correct

Isolated

Understandable

Open Source.

Runs on Mac, Windows, Linux

Using VirtualBox, VMWare, AWS, OpenStack...

Mature, around from 2010, used by a lot of companies

One command for every project

Vagrant is transparent (you use your tools)

You can replicate the same production environment

Golden use case: You can use same provisioning (Puppet)

$ vagrant up

$ vagrant ssh

$ vagrant suspend

$ vagrant halt

$ vagrant destroy

Once it's configured, the other developers don't need to know how it works

HOW IT WORKS

Primitives

  • Boxes
  • Vagrantfile
  • Provisioning script
  • Vagrant CLI

Boxes

Vagrantfile

Provisioning script

Vagrant CLI

$ vagrant up

Reads the Vagrantfile

Builds virtual machine using the box template

Runs provisioning script

Synced folder (using API, NFS, rsync)

Automated networking (NAT, host-only, bridged)

Advanced provisioning (Chef, Puppet, etc.)

Testing environments

OUR CONFIGURATION

Vagrantfile

vagrant-bootstrap.sh

CONS

Performance overhead

Resources overhead

Vagrant

By salvozappa

Vagrant

Introduction to Vagrant

  • 736