Vagrant devopsdays Mountain View 2011

Preview:

Citation preview

VagrantEcosystem

Patrick Debois

Friday 17 June 2011

Info & Credits

• Mitchell Hashimoto & John Bender

• http://vagrantup.com

• Based on Virtualbox , Ruby

• Runs on Mac OS, Linux, Windows

Friday 17 June 2011

Let’s get this project started

AHA

Friday 17 June 2011

Vagrant 101

Friday 17 June 2011

The power of CLI

$ gem install vagrant$ vagrant box add base http://files.vagrantup.com/lucid32.box$ vagrant init$ vagrant up

Friday 17 June 2011

Step 2 : base box

$ gem install vagrant

$ vagrant box add base http://files.vagrantup.com/lucid32.box$ vagrant init$ vagrant up

Downloads predefined VM - f.i. Ubuntu 10.04 (Lucid)and registers it as name ‘base’

‘BASE’LUCID

Friday 17 June 2011

Step 3 : configuration

$ gem install vagrant$ vagrant box add base http://files.vagrantup.com/lucid32.box

$ vagrant init$ vagrant up

Creates a standard configuration file

Friday 17 June 2011

Vagrantfile

Vagrant::Config.run do |config| # Every Vagrant virtual environment requires a box to build off of. config.vm.box = "base"

end

‘BASE’LUCID

Vagrantfile = Project fileLinks our project with the ‘Base’ box

Friday 17 June 2011

Step 4 : boot

$ gem install vagrant$ vagrant box add base http://files.vagrantup.com/lucid32.box$ vagrant init

$ vagrant up

Extracts the ‘basebox’Creates a new VM in Virtualbox based on ‘basebox’

Boots the new VM

Friday 17 June 2011

Ready to rock SSH

KA-CHING

Friday 17 June 2011

I ♥ Vagrant

Friday 17 June 2011

Reduces Setup Time

1 2 3 4

No-VMSSH

Ready

Automated

Friday 17 June 2011

Simplicity♥

$ gem install vagrant$ vagrant box add base http://files.vagrantup.com/lucid32.box$ vagrant init$ vagrant up

VBoxManage guestcontrol exec[ute] <vmname>|<uuid> <path to program> --username <name> --password <password> [--arguments "<arguments>"] [--environment "<NAME>=<VALUE> [<NAME>=<VALUE>]"] [--flags <flags>] [--timeout <msec>] [--verbose] [--wait-for exit,stdout,stderr||]

copyto|cp <vmname>|<uuid> <source on host> <destination on guest> --username <name> --password <password> [--dryrun] [--follow] [--recursive] [--verbose]

createdir[ectory]|mkdir|md <vmname>|<uuid> <directory to create on guest> --username <name> --password <password> [--parents] [--mode <mode>] [--verbose]

updateadditions <vmname>|<uuid> [--source <guest additions .ISO>] [--verbose]

Friday 17 June 2011

Self-Servicing♥

Basebox

“PULL”

Friday 17 June 2011

Consistency

Basebox

DEVELOPER1 DEVELOPER2

Friday 17 June 2011

Repeatability

Basebox

UP DESTROY UP DESTROY

t1 t2 t3 t4

Friday 17 June 2011

Contained

Project 1 Project 2 Project 3

Laptop

Friday 17 June 2011

Vagrant 201

Friday 17 June 2011

FileSharing

/home/patrick/data

/data

config.vm.share_folder "datastore", "/data", "./data"

Friday 17 June 2011

Port Forwarding

80

8080

# Forward a port from the guest to the host, which allows for outside # computers to access the VM, whereas host only networking does not. config.vm.forward_port "http", 80, 9000 config.vm.forward_port "redis", 6379, 6379 config.vm.forward_port "mysql", 3306, 3306

Friday 17 June 2011

Non-Intrusive

Project 1 Project 2 Project 3

Laptop

My Editor My IDE My BrowserFriday 17 June 2011

Multi VM Stack

DB DB DB

Project 1 Project 2 Project 3

APP APP APP

WEB WEB WEBconfig.vm.define :web do |web_config| web_config.vm.box = "ubuntu"

...endconfig.vm.define :app do |app_config| app_config.vm.box = "ubuntu"

...endconfig.vm.define :db do |db_config| db_config.vm.box = "ubuntu"

...end

Friday 17 June 2011

Vagrant 301

Friday 17 June 2011

Basebox

Provision

Just EnoughOperating System

Provisionerchef/puppet/script

+

Cookbooks/Manifests

VM

Friday 17 June 2011

Vagrantbox.esGareth Rushgrove

Friday 17 June 2011

CLI Vagrantbox.es

>> vagrant vagrantboxes search centos

3 centos 5.5 http://dl.dropbox.com/u/15307300/vagrant-0.7-centos-64-base.box6 opscode centos 5 http://opscode-vagrant-boxes.s3.amazonaws.com/centos5-gems.box7 opscode ubuntu 10.04 http://opscode-vagrant-boxes.s3.amazonaws.com/ubuntu10.04-gems.box9 puppet centos 5.5 64 http://puppetlabs.s3.amazonaws.com/pub/centos5_64.box10 puppet centos 4 64 http://puppetlabs.s3.amazonaws.com/pub/centos4_64.box21 centos 5.6 32 http://yum.mnxsolutions.com/vagrant/centos_56_32.box

https://github.com/garethr/ruby-vagrantboxesFriday 17 June 2011

Package

Basebox

Just EnoughOperating System

Provisionerchef/puppet/script

+

Cookbooks/Manifests

VM Basebox

Friday 17 June 2011

Provision Configconfig.vm.provision :chef_solo do |chef| chef.cookbooks_path = ["chefrepo/cookbooks"]

chef.add_recipe("app_rails")chef.json.merge!({

:apache => { :listen_ports => [ "8080"]})

end ChefSolo

ChefServer

Puppet standalone

Puppet Server

config.vm.provision :puppet do |puppet| puppet.pp_path = "/tmp/vagrant-puppet" puppet.manifests_path = "./manifests" puppet.module_path = "./modules" puppet.manifest_file = "newbox.pp" end

Friday 17 June 2011

Self-Executable Boxes

• java -jar mygreatbox.jar

http://www.jedi.be/blog/2011/03/31/installable-vagrant-boxes/https://github.com/maestrodev/wanton

“proof of concept”

Friday 17 June 2011

Veewee

https://github.com/jedi4ever/veewee

Basebox

Just EnoughOperating System

Provisionerchef/puppet/script

ISO

Kickstart/Preseed/Autoyast/

AutoUnattendUbuntu, Debian, Centos,

Fedora, Gentoo, Solaris, Suse, Archlinux,

Windows

Friday 17 June 2011

Version ControlledBasebox

Just EnoughOperating System

Provisionerchef/puppet/script

ISO

Kickstart/Preseed/Autoyast/

AutoUnattend

VM

Git Repo Git Repo

Cookbooks/Manifests

Vagrantfile

Git RepoFriday 17 June 2011

Complex Setups

VM

Cookbooks/Manifests

Rails Nodejs FlumeHadoop Esper

Mysql HDFSPostgres JavaFriday 17 June 2011

Sharing on Github

Kickstart/Preseed/Autoyast/

AutoUnattend

Git Repo Git Repo

Cookbooks/Manifests

Vagrantfile

Git Repo

Veewee Chef/Puppet Vagrant

Friday 17 June 2011

Kickstart/Preseed/Autoyast/

AutoUnattend

Git Repo Git Repo

Cookbooks/Manifests

Vagrantfile

Git Repo

Git Repo

Application Code

Shared “codebase”♥

Friday 17 June 2011

Kickstart/Preseed/Autoyast/

AutoUnattend

Git Repo

Git Repo

Cookbooks/Manifests

Vagrantfile

Git Repo

Git Repo

Application Code

Co-Ownership♥

DEV & OPSpairing

Friday 17 June 2011

More Ops into Dev

• can we speed up this provisioning?

• we need a migration script from vX -> vY

• we need start/stop scripts

• we need consistent data restore

Friday 17 June 2011

Synchronized Release Cycle

Application vX

System vX

Application vX+1

System vX+1

Friday 17 June 2011

Tools/Config Consistency

Cookbooks/Manifests

Cookbooks/Manifests

DEV PROD

Provisionerchef/puppet/script

Provisionerchef/puppet/script

Kickstart/Preseed/Autoyast/

AutoUnattend

Kickstart/Preseed/Autoyast/

AutoUnattend

Friday 17 June 2011

• vagrant-snap - snapshots -

• https://github.com/t9md/vagrant-snap

• sahara - sandbox execution apply, rollback

• https://github.com/jedi4ever/sahara

Fail-Safe♥

Friday 17 June 2011

Disposable Test Environments♥

Cookbooks/Manifests

Cookbooks/Manifests

DEV PROD

Provisionerchef/puppet/script

Provisionerchef/puppet/script

Kickstart/Preseed/Autoyast/

AutoUnattend

Kickstart/Preseed/Autoyast/

AutoUnattend

TEST/QA

http://paperairoplane.net/?p=240

Cookbooks/Manifests

Provisionerchef/puppet/script

Kickstart/Preseed/Autoyast/

AutoUnattend

Friday 17 June 2011

Reuse Workflow

Vagrant Mccloud

https://github.com/geemus/fog

https://github.com/jedi4ever/mccloud

Friday 17 June 2011

Vagrant - EC2‘BASE’ BOX

Shared Folder

Loadbalancing

MultiVM

Port Forwarding

Cloudformation

Recipes/Manifest

AMI

Rsync

MultiVM

SSH Forwarding

Recipes/Manifest

SnapshotPackage

ENV=dev,prod

Friday 17 June 2011

Future 1expand virtualization

Vagrant Mccloud

Friday 17 June 2011

Future 2: Expand baseboxes

Vagrant & Veewee & Mccloud

Linux Windows OSX

Friday 17 June 2011

Future 3: integrate in dev tools

EclipsePlugin

JenkinsPlugin

MavendeployPlugin

Friday 17 June 2011

Future 4: dev environment in a box

VI

Eclipse+ plugins

Textmate

Browsers+ plugins

Debug tools Database tools

Download tools

Friday 17 June 2011

“It works on my machine”

Friday 17 June 2011

For Devs(Test Code)

Friday 17 June 2011

For Ops(Test Manifests)

Friday 17 June 2011

For QA(Explore)

Friday 17 June 2011

For Sales(To show off)

Friday 17 June 2011

Bridgingfour worlds

without changing!

http://www.jedi.be/blog/2011/03/28/using-vagrant-as-a-team/Friday 17 June 2011

DemoTomorrow

Openspaces

Friday 17 June 2011