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

Vagrant for WordPress Development

Vagrant for WordPress Development

An overview of Vagrant, virtualization, and how it could be used to ease WordPress development.

Lew Goettner

October 20, 2012
Tweet

More Decks by Lew Goettner

Other Decks in Technology

Transcript

  1. Supporting non-technical users Slower adoption of new technology Legacy systems

    There is always room for a better way! When you’re stuck in the middle.. Saturday, October 20, 12
  2. “I’ll run it in a chef-configured VM!” - Developer the

    progression... Saturday, October 20, 12
  3. “I’ll run it in a chef-configured VM, based on a

    post-install snapshot.” - Developer the progression... Saturday, October 20, 12
  4. “Why don’t we all start using this?” - Boss /

    Coworker / Intern the progression... Saturday, October 20, 12
  5. “Vagrant uses Oracle’s VirtualBox to build configurable, lightweight, and portable

    virtual machines dynamically.” - http://vagrantup.com Saturday, October 20, 12
  6. “VirtualBox is a general-purpose full virtualizer for x86 hardware, targeted

    at server, desktop and embedded use.” - virtualbox.org Saturday, October 20, 12
  7. “VirtualBox is a general-purpose full virtualizer for x86 hardware, targeted

    at server, desktop and embedded use.” - virtualbox.org FREE! Saturday, October 20, 12
  8. % vagrant box add precise32 \ http://files.vagrantup.com/ precise32.box % vagrant

    init precise32 % vagrant up 3 Lines = A Running VM Saturday, October 20, 12
  9. % vagrant box add precise32 \ http://files.vagrantup.com/ precise32.box % vagrant

    init precise32 % vagrant up Saturday, October 20, 12
  10. Base OS Install Software for access & configuration VirtualBox Guest

    Additions Base Box Saturday, October 20, 12
  11. Built in tools for management: % vagrant box -h %

    vagrant package -h Base Box Saturday, October 20, 12
  12. % vagrant box add precise32 \ http://files.vagrantup.com/ precise32.box % vagrant

    init precise32 % vagrant up Saturday, October 20, 12
  13. % vagrant box add precise32 \ http://files.vagrantup.com/ precise32.box % vagrant

    init precise32 % vagrant up Saturday, October 20, 12
  14. Vagrantfile = a Project Project = 1 to many VMs

    Vagrantfile Saturday, October 20, 12
  15. Text file Ruby DSL for configuring your VM(s) (no ruby

    skills required) Vagrantfile Saturday, October 20, 12
  16. % vagrant box add precise32 \ http://files.vagrantup.com/ precise32.box % vagrant

    init precise32 % vagrant up Saturday, October 20, 12
  17. “Let’s talk this thing to death in IRC!!” - Both

    Developers The Holy Wars Saturday, October 20, 12
  18. Vagrantfile config.vm.share_folder "web", "/var/www", "~/my-site", :nfs => true Identifier Path

    on VM Path on your workstation NFS for Performace Saturday, October 20, 12
  19. % vagrant box add precise32 \ http://files.vagrantup.com/ precise32.box % vagrant

    init precise32 Add our base box, initialize Saturday, October 20, 12
  20. % vagrant up % vagrant ssh Fire it up, SSH

    in Saturday, October 20, 12
  21. Inside the VM - Setup a LAMP Stack % sudo

    apt-get update % sudo apt-get install apache2 mysql- server php5 php5-mysql % mysqladmin -u root -p create wordpress % exit Saturday, October 20, 12
  22. Package it Up % vagrant halt % vagrant package --output

    wplamp.box (spits out a wplamp.box file) % vagrant box add wplamp wplamp.box Saturday, October 20, 12
  23. Vagrantfile (in a new folder) Vagrant::Config.run do |config| config.vm.box =

    "wplamp" config.vm.network :hostonly, "192.168.33.11" config.vm.share_folder "wordpress", "/var/www", "../wordpress", :nfs => true end Saturday, October 20, 12
  24. Vagrantfile (port forwarding) Vagrant::Config.run do |config| config.vm.box = "wplamp" config.vm.box_url

    = "http://you.com/wplamp.box" config.vm.network :hostonly, "192.168.33.11" config.vm.share_folder "wordpress", "/var/www", "../wordpress", :nfs => true end Saturday, October 20, 12
  25. Vagrantfile (port forwarding) Vagrant::Config.run do |config| config.vm.box = "wplamp" config.vm.box_url

    = "http://you.com/wplamp.box" config.vm.network :hostonly, "192.168.33.11" config.vm.share_folder "wordpress", "/var/www", "../wordpress", :nfs => true end The Interwebs! Saturday, October 20, 12
  26. Vagrantfile (port forwarding) Vagrant::Config.run do |config| config.vm.box = "wplamp" config.vm.forward_port

    80, 8080 config.vm.network :hostonly, "192.168.33.11" config.vm.share_folder "wordpress", "/var/www", "../wordpress", :nfs => true end Saturday, October 20, 12
  27. Vagrantfile (port forwarding) Vagrant::Config.run do |config| config.vm.box = "wplamp" config.vm.forward_port

    80, 8080 config.vm.network :hostonly, "192.168.33.11" config.vm.share_folder "wordpress", "/var/www", "../wordpress", :nfs => true end VM Saturday, October 20, 12
  28. Vagrantfile (port forwarding) Vagrant::Config.run do |config| config.vm.box = "wplamp" config.vm.forward_port

    80, 8080 config.vm.network :hostonly, "192.168.33.11" config.vm.share_folder "wordpress", "/var/www", "../wordpress", :nfs => true end VM Workstation Saturday, October 20, 12
  29. vagrant destroy Blow away the VM. But what’s left? Everything

    required to recreate it at will! Save space, fix problems, tinker at will. Saturday, October 20, 12
  30. Grow the F*ck Up Used when adults are acting like

    kids. - urbandictionary.com GTFU Saturday, October 20, 12
  31. “Modern version control systems make these setups insanely easy to

    distribute and modify.” - Lew What I’m trying to say.. Saturday, October 20, 12
  32. Developer - Before Local Dev? Don’t want it on all

    the time. 1 VM? Mixing Libraries, Dependencies, etc. Multiple VMs: Painful to manage, GBs Saturday, October 20, 12
  33. Organization - Before Fixed/shared dev? Developers like different tools Onboarding?

    Long time from hire to productivity Saturday, October 20, 12
  34. Organization - After Providing consistent local development leads to smoother

    deployments, drastically shortens on- boarding time, and puts no regulations on developer tools. Saturday, October 20, 12
  35. “Everybody is using it.” Goal: Provide easy to use directions

    to setup a dev environment for non- developers. Saturday, October 20, 12
  36. “You hacked the core?” Goal: Provide your setup to vendors

    with a clear acceptance path. Saturday, October 20, 12
  37. “You don’t run any servers?” Goal: Provide a setup to

    your clients where they can play with the site in- house. Saturday, October 20, 12
  38. “You said this worked on 3.0?” Goal: Test one plugin

    or theme across multiple versions of WordPress. Saturday, October 20, 12
  39. What’s it do? Creates a new Ubuntu 12.04 VM Installs

    and configures all server software Apache, PHP, MySQL, Apt, Subversion Downloads & Installs WordPress Saturday, October 20, 12
  40. What’s it do? Creates a new Ubuntu 12.04 VM Installs

    and configures all server software Apache, PHP, MySQL, Apt, Subversion Downloads & Installs WordPress Saturday, October 20, 12
  41. What’s it do? Creates a new Ubuntu 12.04 VM Installs

    and configures all server software Apache, PHP, MySQL, Apt, Subversion Downloads & Installs WordPress Saturday, October 20, 12
  42. What’s it do? Installs 30 wordpress.org plugins Installs 3 paid

    plugins via mapped folder Maps in custom theme folder (own repo) Apache, PHP, MySQL Saturday, October 20, 12
  43. What’s it do? Installs 30 wordpress.org plugins Installs 3 paid

    plugins via mapped folders Maps in custom theme folder (own repo) Apache, PHP, MySQL Saturday, October 20, 12
  44. What’s it do? Installs 30 wordpress.org plugins Installs 3 paid

    plugins via mapped folder Maps in custom theme folder (own repo) Apache, PHP, MySQL Saturday, October 20, 12
  45. What does it REALLY do? Takes a complicated and time

    consuming process, and reduces it to a few minutes. Saturday, October 20, 12
  46. Vagrant http://vagrantup.com @mitchellh VeeWee https://github.com/jedi4ever/ veewee Git http://git-scm.com/ Ruby http://www.ruby-lang.org/

    Chef http://opscode.com @opscode https://github.com/opscode https://github.com/opscode- cookbooks Librarian https://github.com/ applicationsonline/librarian My Github Stuff https://github.com/lewg/ Saturday, October 20, 12