Upgrade to Pro — share decks privately, control downloads, hide ads and more …

But It Works on My Machine

But It Works on My Machine

An introduction using Virtual Machines for local development, presented at EECI 2012.

Avatar for Stephen Lewis

Stephen Lewis

May 30, 2012
Tweet

More Decks by Stephen Lewis

Other Decks in Programming

Transcript

  1. EECI 2012 : But It Works On My Machine But

    It Works On My Machine Stephen Lewis http://experienceinternet.co.uk @monooso
  2. EECI 2012 : But It Works On My Machine /

    Virtual Machines What’s Your Problem?
  3. EECI 2012 : But It Works On My Machine /

    What's Your Problem? Can You Believe This Shit?
  4. EECI 2012 : But It Works On My Machine /

    What's Your Problem? Let’s Dance With Low!
  5. EECI 2012 : But It Works On My Machine /

    Episode One / Sub-section The Problem • Working on multiple sites in parallel • Each site has different technological requirements
  6. EECI 2012 : But It Works On My Machine /

    Episode One / Sub-section
  7. EECI 2012 : But It Works On My Machine /

    What’s Your Problem? The local “server” mirrors the live server Each project is self-contained, and sandboxed The entire team has an identical setup The entire team has an up-to-date setup Remote and mobile workers are supported It’s easy to start a new project based on a “standard” setup
  8. EECI 2012 : But It Works On My Machine /

    Virtual Machines Rise of the Virtual Machines
  9. EECI 2012 : But It Works On My Machine /

    Virtual Machines / Features and Benefits A virtual machine is a fully- featured, self-contained, sandboxed OS, running inside your OS.
  10. EECI 2012 : But It Works On My Machine /

    Virtual Machines / Benefits A virtual machine is a fully- featured, self-contained, sandboxed OS, running inside your OS. fully- featured EECI 2012 : But It Works On My Machine / Virtual Machines / Features and Benefits
  11. The local “server” mirrors the live server Each project is

    self-contained, and sandboxed The entire team has an identical setup The entire team has an up-to-date setup Remote and mobile workers are supported It’s easy to start a new project based on a “standard” setup The local “server” mirrors the live server EECI 2012 : But It Works On My Machine / Virtual Machines / Features and Benefits
  12. EECI 2012 : But It Works On My Machine /

    Virtual Machines / Benefits A virtual machine is a fully- featured, self-contained, sandboxed OS, running inside your OS. fully- featured self-contained, sandboxed EECI 2012 : But It Works On My Machine / Virtual Machines / Features and Benefits
  13. The local “server” mirrors the live server Each project is

    self-contained, and sandboxed The entire team has an identical setup The entire team has an up-to-date setup Remote and mobile workers are supported It’s easy to start a new project based on a “standard” setup Each project is self-contained, and sandboxed The entire team has an identical setup Remote and mobile workers are supported The entire team has an up-to-date setup EECI 2012 : But It Works On My Machine / Virtual Machines / Features and Benefits The local “server” mirrors the live server
  14. EECI 2012 : But It Works On My Machine /

    Virtual Machines / Features and Benefits Snapshot Clone
  15. The local “server” mirrors the live server Each project is

    self-contained, and sandboxed The entire team has an identical setup The entire team has an up-to-date setup Remote and mobile workers are supported It’s easy to start a new project based on a “standard” setup Each project is self-contained, and sandboxed The local “server” mirrors the live server The entire team has an identical setup Remote and mobile workers are supported It’s easy to start a new project based on a “standard” setup The entire team has an up-to-date setup EECI 2012 : But It Works On My Machine / Virtual Machines / Benefits
  16. EECI 2012 : But It Works On My Machine /

    Virtual Machines / Building a Virtual Machine Building Your First Virtual Machine
  17. EECI 2012 : But It Works On My Machine /

    Virtual Machines / Building a Virtual Machine Building Your First VM 1. Download ISO image of desired OS 2. Create and configure new VM in VirtualBox 3. Install VM operating system from ISO image 4. Configure development site
  18. EECI 2012 : But It Works On My Machine /

    Virtual Machines / Building a Virtual Machine / Step 1 Step 1: Download OS ISO Image
  19. EECI 2012 : But It Works On My Machine /

    Virtual Machines / Building a Virtual Machine / Step 1 http://ubuntu.com/download/server
  20. EECI 2012 : But It Works On My Machine /

    Virtual Machines / Building a Virtual Machine / Step 1 http://virtualboxes.org
  21. EECI 2012 : But It Works On My Machine /

    Virtual Machines / Building a Virtual Machine / Step 2 Step 2: Create & Configure VM in VirtualBox
  22. EECI 2012 : But It Works On My Machine /

    Virtual Machines / Building a Virtual Machine / Step 3 Step 3: Install VM OS from ISO Image
  23. EECI 2012 : But It Works On My Machine /

    Virtual Machines / Building a Virtual Machine / Step 3
  24. EECI 2012 : But It Works On My Machine /

    Virtual Machines / Building a Virtual Machine / Step 4 Step 4: Configure Development Site
  25. EECI 2012 : But It Works On My Machine /

    Virtual Machines / Building a Virtual Machine / Step 4 Update the apt index Update any installed apt bundles Install the VirtualBox "Guest Additions" package, to enable shared folders Give Apache and your user account read / write permissions on VirtualBox shared folders Configure Apache's httpd.conf, to ensure Apache sends fresh files. Configure Apache's Virtual Hosts. Enable your new site, and disable the "default" site Secure MySQL Install phpMyAdmin Install the PHP5 cURL extension Enable the expires, headers, and rewrite Apache modules Install, enable, and configure XDebug Configure the location of PHP’s log files
  26. EECI 2012 : But It Works On My Machine /

    Virtual Machines / Building a Virtual Machine / Step 4 https://github.com/experience/vm-config
  27. EECI 2012 : But It Works On My Machine /

    Virtual Machines / Building a Virtual Machine / Demo Demo
  28. The local “server” mirrors the live server Each project is

    self-contained, and sandboxed The entire team has an identical setup The entire team has an up-to-date setup Remote and mobile workers are supported It’s easy to start a new project based on a “standard” setup Each project is self-contained, and sandboxed EECI 2012 : But It Works On My Machine / Virtual Machines / Benefits The local “server” mirrors the live server The entire team has an identical setup Remote and mobile workers are supported It’s easy to start a new project based on a “standard” setup The entire team has an up-to-date setup
  29. EECI 2012 : But It Works On My Machine /

    Vagrant / Definition Vagrant lets you create and configure lightweight, reproducible, and portable development environments.
  30. EECI 2012 : But It Works On My Machine /

    Vagrant / Advantages Advantages • Distribute scripts, not a monolithic VM file • Keep server config scripts in version control • Simple, declarative configuration syntax • Mix and match scripts • Provision multiple servers
  31. EECI 2012 : But It Works On My Machine /

    Vagrant / How It Works VirtualBox Puppet or Chef Vagrant Base box (hardware and software) Provisioning and configuration $> vagrant up
  32. EECI 2012 : But It Works On My Machine /

    Vagrant / Puppet user {'joel': ensure => present, gid => 'ewok', home => '/home/endor', }
  33. EECI 2012 : But It Works On My Machine /

    Episode One / Sub-section Puppet Resource Types • cron • file • host • notify • package • ssh_authorized_key • service • user • ...and 40 others
  34. EECI 2012 : But It Works On My Machine /

    Vagrant / Puppet / Examples package {'apache2': ensure => present, } file {'httpd.conf': path => '/etc/apache2/httpd.conf', require => Package['apache2'], source => template('httpd.conf.erb'), } service {'apache2': running => true, subscribe => File['httpd.conf'], }
  35. EECI 2012 : But It Works On My Machine /

    Vagrant / Puppet / Examples # httpd.conf.erb <VirtualHost *:80> DocumentRoot /media/sf_devsite ServerName <%= @fqdn %> </VirtualHost>
  36. EECI 2012 : But It Works On My Machine /

    Vagrant / Puppet / Examples # Generated httpd.conf <VirtualHost *:80> DocumentRoot /media/sf_devsite ServerName thingsthatlooklikejoel.dev </VirtualHost>
  37. EECI 2012 : But It Works On My Machine /

    Vagrant / When To Use Use Vagrant If You... • Need to provision a server from scratch • Have complex server configuration requirements • Need to provision multiple identical servers
  38. EECI 2012 : But It Works On My Machine /

    Vagrant / Resources Resources vagrantup.com docs.puppetlabs.com/puppet wiki.opscode.com/display/chef/Home
  39. EECI 2012 : But It Works On My Machine /

    Thank You Thank You Find me at: experienceinternet.co.uk github.com/experience @monooso [email protected]
  40. EECI 2012 : But It Works On My Machine /

    Questions? Questions? Find me at: experienceinternet.co.uk github.com/experience @monooso [email protected]