Introduction To



Introduction To

0 0


slides-vagrant-intro

An Introduction to Vagrant

On Github EddieWoodley / slides-vagrant-intro

Introduction To

What is Vagrant?

“Development environments made easy.”

A wrapper around virtual machines

I want this VM, set up in this way.

Why Vagrant?

Everyone has the same machine.

Get a fresh environment set up in minutes.

Traditionally

Install a web server.
  • LAMP, WAMP, MAMP...
Configure the web server. Install NodeJS. Install build tools.
  • karma, bower, grunt-cli, protractor...
Download local dependencies.
  • npm install

The Vagrant Way

Install Virtual Box Install Vagrant vagrant up

How do I Vagrant?

Vagrantfile

Vagrant.configure("2") do |config|
  config.vm.box = "hashicorp/precise64"
end
      

What now?

Everyone has the same machine, but there's nothing on it.

Provisioning

Vagrant.configure("2") do |config|
  config.vm.box = "hashicorp/precise64"
  config.vm.provision "shell", path: "setup.sh"
end
      

Provisioning with Puppet

Provisioning with Puppet

Install a web server and configure it.

# Install a web server
package { 'nginx':
  ensure => latest
}

# Configure the web server
file { 'setup-nginx-node':
  path => '/etc/nginx/sites-enabled/config',
  ensure => link,
  require => Package['nginx'],
  source => '/vagrant/files/nginx_config'
}
      

Provisioning with Puppet

Install NodeJS and the build tools.

# Install NodeJS
class { 'nodejs':
  version => 'stable',
}

# Install build tools
package { 'grunt-cli':
  ensure => '0.1.x',
  provider => 'npm',
}
package { 'karma':
  ensure => '0.12.x',
  provider => 'npm',
}
package { 'bower':
  ensure => '1.3.x',
  provider => 'npm',
}
      

Beyond Development Environments

Questions?