SlideShare a Scribd company logo
Configuration Management
for Development Environments

PuppetConf 22nd September 2011


gareth rushgrove | morethanseven.net   http://www.flickr.com/photos/36144637@N00/159627088/
Gareth Rushgrove


gareth rushgrove | morethanseven.net
Work at UK Government Digital Service


gareth rushgrove | morethanseven.net
Blog at morethanseven.net


gareth rushgrove | morethanseven.net
Curate devopsweekly.com


gareth rushgrove | morethanseven.net
Problems


gareth rushgrove | morethanseven.net   http://www.flickr.com/photos/iancarroll/5027441664
1. Not all developers want to be sysadmins


gareth rushgrove | morethanseven.net   http://www.flickr.com/photos/34652102@N04/5059217055
1. Sysadmins don’t want devs to be sysadmins


gareth rushgrove | morethanseven.net   http://www.flickr.com/photos/34652102@N04/5059217055
2. New team members getting started time


gareth rushgrove | morethanseven.net   http://www.flickr.com/photos/34652102@N04/5059824808
3. Running a full set of services locally


gareth rushgrove | morethanseven.net        http://www.flickr.com/photos/biggreymare
4. Works on my machine


gareth rushgrove | morethanseven.net
⚡ brew info mysql
      mysql 5.5.14

      $ aptitude show mysql-server
      Package: mysql-server
      State: not installed
      Version: 5.1.41-3ubuntu12.10




Homebrew is great but...


gareth rushgrove | morethanseven.net
23 releases and 21 months in-between 5.1.41 and 5.5.14. Here’s
 some fixed bugs:

 -      An ORDER BY clause was bound to the incorrect substatement
        when used in UNION context.
 -      A NOT IN predicate with a subquery containing a HAVING clause
        could retrieve too many rows, when the subquery itself returned
        NULL.
 -      MIN(year_col) could return an incorrect result in some cases.

 And lots more




What’s a few versions between friends?


gareth rushgrove | morethanseven.net
Spot the cross platform bug (not the security flaw)


gareth rushgrove | morethanseven.net
⚡ ./server.rb &
      ⚡ curl "http://127.0.0.1:8181/?query=Bob"
      ⚡ curl "http://127.0.0.1:8181/?query=bob"
      ⚡ ls




On our Mac


gareth rushgrove | morethanseven.net
⚡ ./server.rb &
      ⚡ curl "http://127.0.0.1:8181/?query=Bob"
      ⚡ curl "http://127.0.0.1:8181/?query=bob"
      ⚡ ls
      Bob
      ⚡ cat Bob
      Hello bob




On our Mac


gareth rushgrove | morethanseven.net
$     ./server.rb &
      $     curl "http://127.0.0.1:8181/?query=Bob"
      $     curl "http://127.0.0.1:8181/?query=bob"
      $     ls




On Linux


gareth rushgrove | morethanseven.net
$ ./server.rb &
      $ curl "http://127.0.0.1:8181/?query=Bob"
      $ curl "http://127.0.0.1:8181/?query=bob"
      $ ls
      Bob bob
      $ cat Bob
      Hello Bob
      $ cat bob
      Hello bob




On Linux


gareth rushgrove | morethanseven.net
Solutions


gareth rushgrove | morethanseven.net   http://www.flickr.com/photos/34652102@N04/5059208501
Virtualisation


gareth rushgrove | morethanseven.net   http://www.flickr.com/photos/dawilson/2598713027
VirtualBox


gareth rushgrove | morethanseven.net
VMware


gareth rushgrove | morethanseven.net
Virtualisation needs powerful hardware


gareth rushgrove | morethanseven.net   http://www.flickr.com/photos/martinoc/477335951
What about editing code?


gareth rushgrove | morethanseven.net   http://www.flickr.com/photos/peteradams/2272928740
Shared Folders or NFS


gareth rushgrove | morethanseven.net   http://www.flickr.com/photos/34652102@N04/5059846582
Doubledown
Vim


gareth rushgrove | morethanseven.net
Vagrantup.com


gareth rushgrove | morethanseven.net
-      Automated virtual machine creation using Oracle’s VirtualBox
-      Automated provisioning of virtual environments using Chef or Puppet
-      Full SSH access to created environments
-      Assign a static IP to your VM, accessible from your machine
-      Forward ports to the host machine
-      Shared folders allows you to continue using your own editor
-      Package environments into distributable boxes
-      Completely tear down environment when you’re done
-      Easily rebuild a complete environment with a single command


What is Vagrant?


gareth rushgrove | morethanseven.net
Base boxes


gareth rushgrove | morethanseven.net   http://www.flickr.com/photos/dawilson/2793319903
VeeWee


gareth rushgrove | morethanseven.net
Community boxes


gareth rushgrove | morethanseven.net
⚡ gem install vagrant
      ⚡ vagrant box add lucid32 http://.../lucid32.box
      ⚡ vagrant init
      ⚡ vagrant up




Vagrant up


gareth rushgrove | morethanseven.net
⚡ ls
   Vagrantfile
   ⚡ vagrant up
   ⚡ vagrant ssh
   ⚡ vagrant reload
   ⚡ vagrant halt
   ⚡ vagrant destroy




Vagrant command line


gareth rushgrove | morethanseven.net
⚡ vagrant ssh-config
   Host default
     HostName 127.0.0.1
     User vagrant
     Port 2222
     IdentityFile /Users/.../vagrant-0.8.2/keys/vagrant
     ...




Export SSH configuration


gareth rushgrove | morethanseven.net
Vagrant::Config.run do |config|
              config.vm.box = "lucid32"
            end




Vagrantfile


gareth rushgrove | morethanseven.net
Vagrant::Config.run do |config|
     config.vm.forward_port("web", 80, 8080)
     config.vm.forward_port("ftp", 21, 4567)
     config.vm.forward_port("ssh", 22, 2222, :auto => true)
   end




Port forwarding


gareth rushgrove | morethanseven.net
Vagrant::Config.run do |config|
     config.vm.share_folder("folder", "/guest", "../host")
   end




Shared folders


gareth rushgrove | morethanseven.net
Vagrant::Config.run do |config|
     config.vm.define :web do |web_config|
       web_config.vm.box = "web"
       web_config.vm.forward_port("http", 80, 8080)
     end

     config.vm.define :db do |db_config|
       db_config.vm.box = "db"
       db_config.vm.forward_port("db", 3306, 3306)
     end
   end




Multiple VMs in one file


gareth rushgrove | morethanseven.net
Vagrant::Config.run do |config|
     config.vm.boot_mode      = :gui
     config.ssh.forward_agent = true
     config.vm.network("33.33.33.10")
     config.vm.customize do |vm|
       vm.memory_size = 512
     end
   end




Lots more options


gareth rushgrove | morethanseven.net
Puppet


gareth rushgrove | morethanseven.net
Vagrant::Config.run do |config|
               config.vm.provision :puppet do |puppet|
                 puppet.manifests_path = "puppetmanifests"
                 puppet.manifest_file = "newbox.pp"
               end
             end




Vagrant provisioning with Puppet


gareth rushgrove | morethanseven.net
Vagrant::Config.run do |config|
               config.vm.provision :puppet_server do |puppet|
                 puppet.puppet_server = "puppet.example.com"
                 puppet.puppet_node   = "vm.example.com"
               end
             end




Vagrant provisioning with Puppetmaster


gareth rushgrove | morethanseven.net
Chef


gareth rushgrove | morethanseven.net
Vagrant::Config.run do |config|
               config.vm.provision :chef_solo do |chef|
                 chef.add_recipe     = "garethr"
                 chef.cookbooks_path = “cookbooks”
               end
             end




Vagrant provisioning with Chef


gareth rushgrove | morethanseven.net
Vagrant::Config.run do |config|
               config.vm.provision :chef_solo do |chef|
                 chef.roles_path = "roles"
                 chef.add_role("vm")
               end
             end




Specifying Chef roles


gareth rushgrove | morethanseven.net
Vagrant::Config.run do |config|
   config.vm.provision :chef_solo do |chef|
     chef.recipe_url = "http://github.com/cookbooks.tar.gz"
     chef.add_recipe "garethr"
     chef.cookbooks_path = [:vm, "cookbooks"]
     chef.json.merge!({ :garethr => {
       :ohmyzsh => "https://github.com/.../oh-my-zsh.git",
       :dotvim => "https://github.com/garethr/dotvim.git"
     }})
   end
 end



Remote file


gareth rushgrove | morethanseven.net
-      Vagrant Hosts - https://github.com/dwt/vagrant-hosts
-      Sahara - https://github.com/jedi4ever/sahara
-      Vagrantboxes - https://github.com/garethr/ruby-vagrantboxes




Plugins


gareth rushgrove | morethanseven.net                  http://www.flickr.com/photos/s3a/4710416678
⚡ vagrant provision
   [default] Running provisioner:
   Vagrant::Provisioners::Puppet...
   [default] Running Puppet with base.pp...
   [default] notice: /Stage[main]//File[/etc/motd]/
   content: content changed '{md5}
   a10cc0046a5fad11470513e5f5df9d91' to '{md5}
   9e5e449fc643d3e88a2cefeb1af7bc2e'
   [default]
   [default] notice: /Stage[main]//File[/etc/motd]/
   mode: mode changed '777' to '644'


Useful for testing puppet modules


gareth rushgrove | morethanseven.net
Useful for local configuration management


gareth rushgrove | morethanseven.net   http://www.flickr.com/photos/crustyscumbrothersontour/2674351601
-      I want my development environment on my local vms
-      I don’t want a wiki page of instructions
-      I don’t want to have to manually install anything
-      I don’t want to care about destroying a virtual machine




Real world example


gareth rushgrove | morethanseven.net
⚡ tree
   ├── Vagrantfile
   └── modules
       └── garethr
           ├── manifests
           │   └── init.pp
           ├── spec
           │   └── classes
           │        └── base.rv
           │        └── janus.rv
           │        └── ohmyzsh.rv
           └────── spec_helper.rb


Puppet layout


gareth rushgrove | morethanseven.net
class base {
               $packages = ["zsh", "wget", "curl", "lynx",
                          "git-core", "dvtm", “tree”,
                          "build-essential", "vim-nox"]
               package { $packages: ensure => "installed" }
             }




Packages I like


gareth rushgrove | morethanseven.net
$repo = "git://github.com/robbyrussell/oh-my-zsh.git"
      exec { "ohmyzsh":
        command => "git clone ${repo} .oh-my-zsh",
        cwd     => "/home/vagrant",
        creates => "/home/vagrant/.oh-my-zsh",
        require => Class["base"],
      }
      exec { "zshrc":
        command => "cp .... /home/vagrant/.zshrc",
        creates => "/home/vagrant/.zshrc",
        require => Exec["ohmyzsh"],
      }



My Zsh configs


gareth rushgrove | morethanseven.net
$repo = "git://github.com/carlhuda/janus.git"
      exec { "get_janus":
        command => "git clone ${repo} .vim",
        cwd     => "/home/vagrant",
        creates => "/home/vagrant/.vim",
        require => Class["base"],
      }
      exec { "compile_janus":
        command => "rake",
        creates => "/home/vagrant/.zshrc",
        require => Exec["ohmyzsh"],
        environment => "HOME=/home/vagrant",
      }


My Vim configs


gareth rushgrove | morethanseven.net
require 'spec_helper'

              describe 'ohmyzsh', :type => :class do
                it { should create_exec("ohmyzsh") }
                it { should create_exec("zshrc") }
                it { should create_class("base") }
              end




Testing with Rspec


gareth rushgrove | morethanseven.net
base
                  should create Package[zsh]
                  should create Package[vim-nox]
                  should create Package[git-core]

                ohmyzsh
                  should create Exec[ohmyzsh]
                  should create Exec[zshrc]
                  should create Class[base]

                Finished in 1.4 seconds
                10 examples, 0 failures



Rspec results


gareth rushgrove | morethanseven.net
-      Using Virtualisation makes getting started fast
-      Running the same platform catches bugs early
-      Using Vagrant makes managing virtual machines easy
-      Writing configuration as code makes it testable




Conclusions


gareth rushgrove | morethanseven.net
-      IRC - #vagrant on Freenode
-      Github Issues - https://github.com/mitchellh/vagrant/issues
-      Google Groups - http://groups.google.com/group/vagrant-up




More information on Vagrant


gareth rushgrove | morethanseven.net
Questions?


gareth rushgrove | morethanseven.net   http://flickr.com/photos/psd/102332391/

More Related Content

PDF
Vagrant and Configuration Management
PDF
Varnish Caching
PDF
Automating web site deployment
PDF
Learnings from govuk
PDF
Quick and Dirty Python Deployments with Heroku
PDF
Nginx Workshop Aftermath
PDF
[MeetUp][2nd] 컭on턺
PDF
[PHP 也有 Day] 垃圾留言守城記 - 用 Laravel 阻擋 SPAM 留言的奮鬥史
Vagrant and Configuration Management
Varnish Caching
Automating web site deployment
Learnings from govuk
Quick and Dirty Python Deployments with Heroku
Nginx Workshop Aftermath
[MeetUp][2nd] 컭on턺
[PHP 也有 Day] 垃圾留言守城記 - 用 Laravel 阻擋 SPAM 留言的奮鬥史

What's hot (20)

PPT
Html5, css3, canvas, svg and webgl
PPTX
No callbacks, No Threads - Cooperative web servers in Ruby 1.9
PDF
Vagrant for real
PDF
Transforming WebSockets
PDF
Single page apps with drupal 7
KEY
Plack at YAPC::NA 2010
PDF
Building a desktop app with HTTP::Engine, SQLite and jQuery
PDF
Create Development and Production Environments with Vagrant
PDF
Creating and Deploying Static Sites with Hugo
PDF
Shift Remote: JS - Node.js Scalability Tips - Luciano Mammino (FabFitFun)
KEY
Plack perl superglue for web frameworks and servers
PDF
Cloud focker を試してみた public
PPT
Real Time Event Dispatcher
PDF
Virtual Infrastructure
PDF
Node.js: scalability tips
PDF
Cooking Up Drama - ChefConf 2015
PDF
Cooking Up Drama
PDF
Real-Time Web Apps & Symfony. What are your options?
PDF
Introduction to Vagrant
KEY
What's new and great in Rails 3 - Matt Gauger - Milwaukee Ruby Users Group De...
Html5, css3, canvas, svg and webgl
No callbacks, No Threads - Cooperative web servers in Ruby 1.9
Vagrant for real
Transforming WebSockets
Single page apps with drupal 7
Plack at YAPC::NA 2010
Building a desktop app with HTTP::Engine, SQLite and jQuery
Create Development and Production Environments with Vagrant
Creating and Deploying Static Sites with Hugo
Shift Remote: JS - Node.js Scalability Tips - Luciano Mammino (FabFitFun)
Plack perl superglue for web frameworks and servers
Cloud focker を試してみた public
Real Time Event Dispatcher
Virtual Infrastructure
Node.js: scalability tips
Cooking Up Drama - ChefConf 2015
Cooking Up Drama
Real-Time Web Apps & Symfony. What are your options?
Introduction to Vagrant
What's new and great in Rails 3 - Matt Gauger - Milwaukee Ruby Users Group De...
Ad

Viewers also liked (9)

PDF
Automating Life in the Cloud - PuppetCamp Chicago '12
PDF
PuppetConf at a glance
PDF
Beginner's Thoughts on Making Puppet Modules - David Klann - PuppetCamp Chica...
PDF
State of the Puppet Community (Jan 2013)
PDF
It Automation: Doing it Wrong - Mykel Alvis
PDF
Eclipse con 2012 - Devops - Luke Kanies
KEY
Whirr dev-up-puppetconf2011
KEY
Stanford Hackathon - Puppet Modules
PDF
Hacking The Data out of Puppet - PuppetConf '12
Automating Life in the Cloud - PuppetCamp Chicago '12
PuppetConf at a glance
Beginner's Thoughts on Making Puppet Modules - David Klann - PuppetCamp Chica...
State of the Puppet Community (Jan 2013)
It Automation: Doing it Wrong - Mykel Alvis
Eclipse con 2012 - Devops - Luke Kanies
Whirr dev-up-puppetconf2011
Stanford Hackathon - Puppet Modules
Hacking The Data out of Puppet - PuppetConf '12
Ad

Similar to Config managament for development environments iii (20)

PDF
Config managament for development environments ii
PDF
Puppet Data Mining
PPTX
Vagrant introduction for Developers
PDF
You're Going To Need A Bigger Toolbox
PDF
Dev ninja -> vagrant + virtualbox + chef-solo + git + ec2
PDF
PPTX
Vagrant WordCamp Hamilton
PDF
vagrant-php
PDF
Instrumentación de entrega continua con Gitlab
PDF
FreeBSD: Dev to Prod
KEY
Railsconf2011 deployment tips_for_slideshare
PDF
Deploying Symfony | symfony.cat
PDF
如何透過 Go-kit 快速搭建微服務架構應用程式實戰
PDF
Minicurso de Vagrant
PPT
Geeky Academy Week 3 :: Vagrant + Puppet
PDF
Metrics with Ganglia
PPTX
2012 coscup - Build your PHP application on Heroku
PDF
Lights, Camera, Docker: Streaming Video at DramaFever
PPTX
Vagrant & Reusable Code
PDF
Config managament for development environments ii
Puppet Data Mining
Vagrant introduction for Developers
You're Going To Need A Bigger Toolbox
Dev ninja -> vagrant + virtualbox + chef-solo + git + ec2
Vagrant WordCamp Hamilton
vagrant-php
Instrumentación de entrega continua con Gitlab
FreeBSD: Dev to Prod
Railsconf2011 deployment tips_for_slideshare
Deploying Symfony | symfony.cat
如何透過 Go-kit 快速搭建微服務架構應用程式實戰
Minicurso de Vagrant
Geeky Academy Week 3 :: Vagrant + Puppet
Metrics with Ganglia
2012 coscup - Build your PHP application on Heroku
Lights, Camera, Docker: Streaming Video at DramaFever
Vagrant & Reusable Code

More from Puppet (20)

PPTX
Puppet Community Day: Planning the Future Together
PPTX
The Evolution of Puppet: Key Changes and Modernization Tips
PPTX
Can You Help Me Upgrade to Puppet 8? Tips, Tools & Best Practices for Your Up...
PPTX
Bolt Dynamic Inventory: Making Puppet Easier
PPTX
Customizing Reporting with the Puppet Report Processor
PPTX
Puppet at ConfigMgmtCamp 2025 Sponsor Deck
PPTX
The State of Puppet in 2025: A Presentation from Developer Relations Lead Dav...
PPTX
Let Red be Red and Green be Green: The Automated Workflow Restarter in GitHub...
PDF
Puppet camp2021 testing modules and controlrepo
PPTX
Puppetcamp r10kyaml
PDF
2021 04-15 operational verification (with notes)
PPTX
Puppet camp vscode
PDF
Modules of the twenties
PDF
Applying Roles and Profiles method to compliance code
PPTX
KGI compliance as-code approach
PDF
Enforce compliance policy with model-driven automation
PDF
Keynote: Puppet camp compliance
PPTX
Automating it management with Puppet + ServiceNow
PPTX
Puppet: The best way to harden Windows
PPTX
Simplified Patch Management with Puppet - Oct. 2020
Puppet Community Day: Planning the Future Together
The Evolution of Puppet: Key Changes and Modernization Tips
Can You Help Me Upgrade to Puppet 8? Tips, Tools & Best Practices for Your Up...
Bolt Dynamic Inventory: Making Puppet Easier
Customizing Reporting with the Puppet Report Processor
Puppet at ConfigMgmtCamp 2025 Sponsor Deck
The State of Puppet in 2025: A Presentation from Developer Relations Lead Dav...
Let Red be Red and Green be Green: The Automated Workflow Restarter in GitHub...
Puppet camp2021 testing modules and controlrepo
Puppetcamp r10kyaml
2021 04-15 operational verification (with notes)
Puppet camp vscode
Modules of the twenties
Applying Roles and Profiles method to compliance code
KGI compliance as-code approach
Enforce compliance policy with model-driven automation
Keynote: Puppet camp compliance
Automating it management with Puppet + ServiceNow
Puppet: The best way to harden Windows
Simplified Patch Management with Puppet - Oct. 2020

Recently uploaded (20)

PDF
Electronic commerce courselecture one. Pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
A Presentation on Artificial Intelligence
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Encapsulation_ Review paper, used for researhc scholars
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Approach and Philosophy of On baking technology
PDF
NewMind AI Monthly Chronicles - July 2025
Electronic commerce courselecture one. Pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
A Presentation on Artificial Intelligence
NewMind AI Weekly Chronicles - August'25 Week I
Dropbox Q2 2025 Financial Results & Investor Presentation
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Per capita expenditure prediction using model stacking based on satellite ima...
Encapsulation_ Review paper, used for researhc scholars
The AUB Centre for AI in Media Proposal.docx
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Building Integrated photovoltaic BIPV_UPV.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Understanding_Digital_Forensics_Presentation.pptx
Approach and Philosophy of On baking technology
NewMind AI Monthly Chronicles - July 2025

Config managament for development environments iii

  • 1. Configuration Management for Development Environments PuppetConf 22nd September 2011 gareth rushgrove | morethanseven.net http://www.flickr.com/photos/36144637@N00/159627088/
  • 2. Gareth Rushgrove gareth rushgrove | morethanseven.net
  • 3. Work at UK Government Digital Service gareth rushgrove | morethanseven.net
  • 4. Blog at morethanseven.net gareth rushgrove | morethanseven.net
  • 6. Problems gareth rushgrove | morethanseven.net http://www.flickr.com/photos/iancarroll/5027441664
  • 7. 1. Not all developers want to be sysadmins gareth rushgrove | morethanseven.net http://www.flickr.com/photos/34652102@N04/5059217055
  • 8. 1. Sysadmins don’t want devs to be sysadmins gareth rushgrove | morethanseven.net http://www.flickr.com/photos/34652102@N04/5059217055
  • 9. 2. New team members getting started time gareth rushgrove | morethanseven.net http://www.flickr.com/photos/34652102@N04/5059824808
  • 10. 3. Running a full set of services locally gareth rushgrove | morethanseven.net http://www.flickr.com/photos/biggreymare
  • 11. 4. Works on my machine gareth rushgrove | morethanseven.net
  • 12. ⚡ brew info mysql mysql 5.5.14 $ aptitude show mysql-server Package: mysql-server State: not installed Version: 5.1.41-3ubuntu12.10 Homebrew is great but... gareth rushgrove | morethanseven.net
  • 13. 23 releases and 21 months in-between 5.1.41 and 5.5.14. Here’s some fixed bugs: - An ORDER BY clause was bound to the incorrect substatement when used in UNION context. - A NOT IN predicate with a subquery containing a HAVING clause could retrieve too many rows, when the subquery itself returned NULL. - MIN(year_col) could return an incorrect result in some cases. And lots more What’s a few versions between friends? gareth rushgrove | morethanseven.net
  • 14. Spot the cross platform bug (not the security flaw) gareth rushgrove | morethanseven.net
  • 15. ⚡ ./server.rb & ⚡ curl "http://127.0.0.1:8181/?query=Bob" ⚡ curl "http://127.0.0.1:8181/?query=bob" ⚡ ls On our Mac gareth rushgrove | morethanseven.net
  • 16. ⚡ ./server.rb & ⚡ curl "http://127.0.0.1:8181/?query=Bob" ⚡ curl "http://127.0.0.1:8181/?query=bob" ⚡ ls Bob ⚡ cat Bob Hello bob On our Mac gareth rushgrove | morethanseven.net
  • 17. $ ./server.rb & $ curl "http://127.0.0.1:8181/?query=Bob" $ curl "http://127.0.0.1:8181/?query=bob" $ ls On Linux gareth rushgrove | morethanseven.net
  • 18. $ ./server.rb & $ curl "http://127.0.0.1:8181/?query=Bob" $ curl "http://127.0.0.1:8181/?query=bob" $ ls Bob bob $ cat Bob Hello Bob $ cat bob Hello bob On Linux gareth rushgrove | morethanseven.net
  • 19. Solutions gareth rushgrove | morethanseven.net http://www.flickr.com/photos/34652102@N04/5059208501
  • 20. Virtualisation gareth rushgrove | morethanseven.net http://www.flickr.com/photos/dawilson/2598713027
  • 21. VirtualBox gareth rushgrove | morethanseven.net
  • 22. VMware gareth rushgrove | morethanseven.net
  • 23. Virtualisation needs powerful hardware gareth rushgrove | morethanseven.net http://www.flickr.com/photos/martinoc/477335951
  • 24. What about editing code? gareth rushgrove | morethanseven.net http://www.flickr.com/photos/peteradams/2272928740
  • 25. Shared Folders or NFS gareth rushgrove | morethanseven.net http://www.flickr.com/photos/34652102@N04/5059846582
  • 27. Vim gareth rushgrove | morethanseven.net
  • 28. Vagrantup.com gareth rushgrove | morethanseven.net
  • 29. - Automated virtual machine creation using Oracle’s VirtualBox - Automated provisioning of virtual environments using Chef or Puppet - Full SSH access to created environments - Assign a static IP to your VM, accessible from your machine - Forward ports to the host machine - Shared folders allows you to continue using your own editor - Package environments into distributable boxes - Completely tear down environment when you’re done - Easily rebuild a complete environment with a single command What is Vagrant? gareth rushgrove | morethanseven.net
  • 30. Base boxes gareth rushgrove | morethanseven.net http://www.flickr.com/photos/dawilson/2793319903
  • 31. VeeWee gareth rushgrove | morethanseven.net
  • 32. Community boxes gareth rushgrove | morethanseven.net
  • 33. ⚡ gem install vagrant ⚡ vagrant box add lucid32 http://.../lucid32.box ⚡ vagrant init ⚡ vagrant up Vagrant up gareth rushgrove | morethanseven.net
  • 34. ⚡ ls Vagrantfile ⚡ vagrant up ⚡ vagrant ssh ⚡ vagrant reload ⚡ vagrant halt ⚡ vagrant destroy Vagrant command line gareth rushgrove | morethanseven.net
  • 35. ⚡ vagrant ssh-config Host default HostName 127.0.0.1 User vagrant Port 2222 IdentityFile /Users/.../vagrant-0.8.2/keys/vagrant ... Export SSH configuration gareth rushgrove | morethanseven.net
  • 36. Vagrant::Config.run do |config| config.vm.box = "lucid32" end Vagrantfile gareth rushgrove | morethanseven.net
  • 37. Vagrant::Config.run do |config| config.vm.forward_port("web", 80, 8080) config.vm.forward_port("ftp", 21, 4567) config.vm.forward_port("ssh", 22, 2222, :auto => true) end Port forwarding gareth rushgrove | morethanseven.net
  • 38. Vagrant::Config.run do |config| config.vm.share_folder("folder", "/guest", "../host") end Shared folders gareth rushgrove | morethanseven.net
  • 39. Vagrant::Config.run do |config| config.vm.define :web do |web_config| web_config.vm.box = "web" web_config.vm.forward_port("http", 80, 8080) end config.vm.define :db do |db_config| db_config.vm.box = "db" db_config.vm.forward_port("db", 3306, 3306) end end Multiple VMs in one file gareth rushgrove | morethanseven.net
  • 40. Vagrant::Config.run do |config| config.vm.boot_mode = :gui config.ssh.forward_agent = true config.vm.network("33.33.33.10") config.vm.customize do |vm| vm.memory_size = 512 end end Lots more options gareth rushgrove | morethanseven.net
  • 41. Puppet gareth rushgrove | morethanseven.net
  • 42. Vagrant::Config.run do |config| config.vm.provision :puppet do |puppet| puppet.manifests_path = "puppetmanifests" puppet.manifest_file = "newbox.pp" end end Vagrant provisioning with Puppet gareth rushgrove | morethanseven.net
  • 43. Vagrant::Config.run do |config| config.vm.provision :puppet_server do |puppet| puppet.puppet_server = "puppet.example.com" puppet.puppet_node = "vm.example.com" end end Vagrant provisioning with Puppetmaster gareth rushgrove | morethanseven.net
  • 44. Chef gareth rushgrove | morethanseven.net
  • 45. Vagrant::Config.run do |config| config.vm.provision :chef_solo do |chef| chef.add_recipe = "garethr" chef.cookbooks_path = “cookbooks” end end Vagrant provisioning with Chef gareth rushgrove | morethanseven.net
  • 46. Vagrant::Config.run do |config| config.vm.provision :chef_solo do |chef| chef.roles_path = "roles" chef.add_role("vm") end end Specifying Chef roles gareth rushgrove | morethanseven.net
  • 47. Vagrant::Config.run do |config| config.vm.provision :chef_solo do |chef| chef.recipe_url = "http://github.com/cookbooks.tar.gz" chef.add_recipe "garethr" chef.cookbooks_path = [:vm, "cookbooks"] chef.json.merge!({ :garethr => { :ohmyzsh => "https://github.com/.../oh-my-zsh.git", :dotvim => "https://github.com/garethr/dotvim.git" }}) end end Remote file gareth rushgrove | morethanseven.net
  • 48. - Vagrant Hosts - https://github.com/dwt/vagrant-hosts - Sahara - https://github.com/jedi4ever/sahara - Vagrantboxes - https://github.com/garethr/ruby-vagrantboxes Plugins gareth rushgrove | morethanseven.net http://www.flickr.com/photos/s3a/4710416678
  • 49. ⚡ vagrant provision [default] Running provisioner: Vagrant::Provisioners::Puppet... [default] Running Puppet with base.pp... [default] notice: /Stage[main]//File[/etc/motd]/ content: content changed '{md5} a10cc0046a5fad11470513e5f5df9d91' to '{md5} 9e5e449fc643d3e88a2cefeb1af7bc2e' [default] [default] notice: /Stage[main]//File[/etc/motd]/ mode: mode changed '777' to '644' Useful for testing puppet modules gareth rushgrove | morethanseven.net
  • 50. Useful for local configuration management gareth rushgrove | morethanseven.net http://www.flickr.com/photos/crustyscumbrothersontour/2674351601
  • 51. - I want my development environment on my local vms - I don’t want a wiki page of instructions - I don’t want to have to manually install anything - I don’t want to care about destroying a virtual machine Real world example gareth rushgrove | morethanseven.net
  • 52. ⚡ tree ├── Vagrantfile └── modules └── garethr ├── manifests │   └── init.pp ├── spec │   └── classes │   └── base.rv │   └── janus.rv │   └── ohmyzsh.rv └────── spec_helper.rb Puppet layout gareth rushgrove | morethanseven.net
  • 53. class base { $packages = ["zsh", "wget", "curl", "lynx", "git-core", "dvtm", “tree”, "build-essential", "vim-nox"] package { $packages: ensure => "installed" } } Packages I like gareth rushgrove | morethanseven.net
  • 54. $repo = "git://github.com/robbyrussell/oh-my-zsh.git" exec { "ohmyzsh": command => "git clone ${repo} .oh-my-zsh", cwd => "/home/vagrant", creates => "/home/vagrant/.oh-my-zsh", require => Class["base"], } exec { "zshrc": command => "cp .... /home/vagrant/.zshrc", creates => "/home/vagrant/.zshrc", require => Exec["ohmyzsh"], } My Zsh configs gareth rushgrove | morethanseven.net
  • 55. $repo = "git://github.com/carlhuda/janus.git" exec { "get_janus": command => "git clone ${repo} .vim", cwd => "/home/vagrant", creates => "/home/vagrant/.vim", require => Class["base"], } exec { "compile_janus": command => "rake", creates => "/home/vagrant/.zshrc", require => Exec["ohmyzsh"], environment => "HOME=/home/vagrant", } My Vim configs gareth rushgrove | morethanseven.net
  • 56. require 'spec_helper' describe 'ohmyzsh', :type => :class do it { should create_exec("ohmyzsh") } it { should create_exec("zshrc") } it { should create_class("base") } end Testing with Rspec gareth rushgrove | morethanseven.net
  • 57. base should create Package[zsh] should create Package[vim-nox] should create Package[git-core] ohmyzsh should create Exec[ohmyzsh] should create Exec[zshrc] should create Class[base] Finished in 1.4 seconds 10 examples, 0 failures Rspec results gareth rushgrove | morethanseven.net
  • 58. - Using Virtualisation makes getting started fast - Running the same platform catches bugs early - Using Vagrant makes managing virtual machines easy - Writing configuration as code makes it testable Conclusions gareth rushgrove | morethanseven.net
  • 59. - IRC - #vagrant on Freenode - Github Issues - https://github.com/mitchellh/vagrant/issues - Google Groups - http://groups.google.com/group/vagrant-up More information on Vagrant gareth rushgrove | morethanseven.net
  • 60. Questions? gareth rushgrove | morethanseven.net http://flickr.com/photos/psd/102332391/