Slide 1

Slide 1 text

Vagrant for WordPress Development Lew Goettner @lewg #WCPhilly October 20, 2012 Saturday, October 20, 12

Slide 2

Slide 2 text

about me Saturday, October 20, 12

Slide 3

Slide 3 text

LEWIS JOSEPH GOETTNER THE @lewg Saturday, October 20, 12

Slide 4

Slide 4 text

Saturday, October 20, 12

Slide 5

Slide 5 text

By JSquish (Own work) [CC-BY-SA-3.0 (http://creativecommons.org/licenses/by-sa/3.0)], via Wikimedia Commons Saturday, October 20, 12

Slide 6

Slide 6 text

By TexasDex at en.wikipedia [GFDL (http://www.gnu.org/copyleft/fdl.html) or CC-BY-SA-3.0 (http://creativecommons.org/ licenses/by-sa/3.0/)], from Wikimedia Commons Saturday, October 20, 12

Slide 7

Slide 7 text

Saturday, October 20, 12

Slide 8

Slide 8 text

Wharton Computing Saturday, October 20, 12

Slide 9

Slide 9 text

PHP WordPress ColdFusion Windows Ubuntu/Red Hat MSSQL MySQL Ruby Saturday, October 20, 12

Slide 10

Slide 10 text

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

Slide 11

Slide 11 text

storytime Saturday, October 20, 12

Slide 12

Slide 12 text

“Here’s a shared dev space.” - Sysadmin the progression... Saturday, October 20, 12

Slide 13

Slide 13 text

“I’ll just run it locally.” - Developer the progression... Saturday, October 20, 12

Slide 14

Slide 14 text

“I’ll run it in a VM!” - Developer the progression... Saturday, October 20, 12

Slide 15

Slide 15 text

“I’ll run it in a chef-configured VM!” - Developer the progression... Saturday, October 20, 12

Slide 16

Slide 16 text

“I’ll run it in a chef-configured VM, based on a post-install snapshot.” - Developer the progression... Saturday, October 20, 12

Slide 17

Slide 17 text

“Why don’t we all start using this?” - Boss / Coworker / Intern the progression... Saturday, October 20, 12

Slide 18

Slide 18 text

“Shit.” - Developer the progression... Saturday, October 20, 12

Slide 19

Slide 19 text

vagrant Saturday, October 20, 12

Slide 20

Slide 20 text

“Vagrant uses Oracle’s VirtualBox to build configurable, lightweight, and portable virtual machines dynamically.” - http://vagrantup.com Saturday, October 20, 12

Slide 21

Slide 21 text

VirtualBox Saturday, October 20, 12

Slide 22

Slide 22 text

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

Slide 23

Slide 23 text

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

Slide 24

Slide 24 text

“I love the command line.” - Lew Saturday, October 20, 12

Slide 25

Slide 25 text

Assumption: You’ve installed both VirtualBox and Vagrant. 3 Lines = A Running VM Saturday, October 20, 12

Slide 26

Slide 26 text

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

Slide 27

Slide 27 text

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

Slide 28

Slide 28 text

Base OS Install Software for access & configuration VirtualBox Guest Additions Base Box Saturday, October 20, 12

Slide 29

Slide 29 text

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

Slide 30

Slide 30 text

VeeWee: tool for building your own https://github.com/jedi4ever/veewee Base Box Saturday, October 20, 12

Slide 31

Slide 31 text

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

Slide 32

Slide 32 text

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

Slide 33

Slide 33 text

Vagrantfile = a Project Project = 1 to many VMs Vagrantfile Saturday, October 20, 12

Slide 34

Slide 34 text

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

Slide 35

Slide 35 text

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

Slide 36

Slide 36 text

vagrant up http://www.flickr.com/photos/lightningjeff/7505934038/ Saturday, October 20, 12

Slide 37

Slide 37 text

“There’s potential here.” -Developer Saturday, October 20, 12

Slide 38

Slide 38 text

“VIM is the bee’s knees!” - Developer A The Holy Wars Saturday, October 20, 12

Slide 39

Slide 39 text

“Textmate would throat punch VIM!” - Developer B The Holy Wars Saturday, October 20, 12

Slide 40

Slide 40 text

“Let’s fight to the death!!” - Both Developers The Holy Wars Saturday, October 20, 12

Slide 41

Slide 41 text

“Let’s talk this thing to death in IRC!!” - Both Developers The Holy Wars Saturday, October 20, 12

Slide 42

Slide 42 text

Vagrantfile config.vm.share_folder "web", "/var/www", "~/my-site", :nfs => true Saturday, October 20, 12

Slide 43

Slide 43 text

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

Slide 44

Slide 44 text

Vagrantfile config.vm.share_folder "web", "/var/www", "~/my-site", :nfs => true Identifier Path on VM Saturday, October 20, 12

Slide 45

Slide 45 text

Vagrantfile config.vm.share_folder "web", "/var/www", "~/my-site", :nfs => true Identifier Path on VM Path on your workstation Saturday, October 20, 12

Slide 46

Slide 46 text

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

Slide 47

Slide 47 text

By Julius Schorzman (Own work) [CC-BY-SA-2.0 (http://creativecommons.org/licenses/by-sa/2.0)], via Wikimedia Commons Saturday, October 20, 12

Slide 48

Slide 48 text

Saturday, October 20, 12

Slide 49

Slide 49 text

0 1 2 3 Number of Children Coffee Consuption Sleep Saturday, October 20, 12

Slide 50

Slide 50 text

Saturday, October 20, 12

Slide 51

Slide 51 text

WordPress Convenience Strength: Saturday, October 20, 12

Slide 52

Slide 52 text

% vagrant box add precise32 \ http://files.vagrantup.com/ precise32.box % vagrant init precise32 Add our base box, initialize Saturday, October 20, 12

Slide 53

Slide 53 text

Vagrantfile (add networking) config.vm.network :hostonly, "192.168.33.10" (uncomment that line) Saturday, October 20, 12

Slide 54

Slide 54 text

% vagrant up % vagrant ssh Fire it up, SSH in Saturday, October 20, 12

Slide 55

Slide 55 text

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

Slide 56

Slide 56 text

Saturday, October 20, 12

Slide 57

Slide 57 text

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

Slide 58

Slide 58 text

“Why did we just do that?” -You Guys Saturday, October 20, 12

Slide 59

Slide 59 text

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

Slide 60

Slide 60 text

Saturday, October 20, 12

Slide 61

Slide 61 text

“Mind sharing?” Saturday, October 20, 12

Slide 62

Slide 62 text

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

Slide 63

Slide 63 text

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

Slide 64

Slide 64 text

“Can I take a look at that?” Saturday, October 20, 12

Slide 65

Slide 65 text

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

Slide 66

Slide 66 text

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

Slide 67

Slide 67 text

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

Slide 68

Slide 68 text

“One more thing..” -Bill Gates Saturday, October 20, 12

Slide 69

Slide 69 text

“One more thing..” -Steve Jobs Saturday, October 20, 12

Slide 70

Slide 70 text

% vagrant destroy Saturday, October 20, 12

Slide 71

Slide 71 text

Saturday, October 20, 12

Slide 72

Slide 72 text

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

Slide 73

Slide 73 text

? Saturday, October 20, 12

Slide 74

Slide 74 text

Distributing And a word of caution Saturday, October 20, 12

Slide 75

Slide 75 text

“VCS or GTFU” - Mark Jaquith Saturday, October 20, 12

Slide 76

Slide 76 text

“DVCS or GTFU” - Lew Saturday, October 20, 12

Slide 77

Slide 77 text

Saturday, October 20, 12

Slide 78

Slide 78 text

Whoops. Saturday, October 20, 12

Slide 79

Slide 79 text

“VCS or GTFO” - Mark Jaquith Saturday, October 20, 12

Slide 80

Slide 80 text

Grow the F*ck Up Used when adults are acting like kids. - urbandictionary.com GTFU Saturday, October 20, 12

Slide 81

Slide 81 text

“DVCS or GTFU” - Lew Saturday, October 20, 12

Slide 82

Slide 82 text

“Git or get out?” - Lew meh.. Saturday, October 20, 12

Slide 83

Slide 83 text

“Modern version control systems make these setups insanely easy to distribute and modify.” - Lew What I’m trying to say.. Saturday, October 20, 12

Slide 84

Slide 84 text

% git clone http://my-setup % vagrant up How Easy? Saturday, October 20, 12

Slide 85

Slide 85 text

? Saturday, October 20, 12

Slide 86

Slide 86 text

Recap Powered by meme Saturday, October 20, 12

Slide 87

Slide 87 text

Saturday, October 20, 12

Slide 88

Slide 88 text

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

Slide 89

Slide 89 text

Developer - After A dedicated, disposable, consistent development environment... per project! Saturday, October 20, 12

Slide 90

Slide 90 text

Saturday, October 20, 12

Slide 91

Slide 91 text

Organization - Before Fixed/shared dev? Developers like different tools Onboarding? Long time from hire to productivity Saturday, October 20, 12

Slide 92

Slide 92 text

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

Slide 93

Slide 93 text

Saturday, October 20, 12

Slide 94

Slide 94 text

+ or Saturday, October 20, 12

Slide 95

Slide 95 text

Homer Liwag [CC-BY-SA-3.0-2.5-2.0-1.0 (www.creativecommons.org/licenses/by-sa/3.0)], via Wikimedia Commons Configuration Management Saturday, October 20, 12

Slide 96

Slide 96 text

config.vm.provision :chef_solo do |chef| chef.cookbooks_path = "~/my-cookbooks" chef.roles_path = "~/my-roles" chef.add_role "my_app_server" end Vagrantfile Saturday, October 20, 12

Slide 97

Slide 97 text

WordPress Convenience Strength: Saturday, October 20, 12

Slide 98

Slide 98 text

“Everybody is using it.” Goal: Provide easy to use directions to setup a dev environment for non- developers. Saturday, October 20, 12

Slide 99

Slide 99 text

“You hacked the core?” Goal: Provide your setup to vendors with a clear acceptance path. Saturday, October 20, 12

Slide 100

Slide 100 text

“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

Slide 101

Slide 101 text

“You said this worked on 3.0?” Goal: Test one plugin or theme across multiple versions of WordPress. Saturday, October 20, 12

Slide 102

Slide 102 text

Install WordPress, plugins, themes, and map appropriate folders. http://github.com/lewg/wordpress-vagrant 1 Site = 1 Setup Repo Saturday, October 20, 12

Slide 103

Slide 103 text

In Practice Consistent Local Development for our most complicated WordPress install. Saturday, October 20, 12

Slide 104

Slide 104 text

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

Slide 105

Slide 105 text

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

Slide 106

Slide 106 text

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

Slide 107

Slide 107 text

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

Slide 108

Slide 108 text

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

Slide 109

Slide 109 text

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

Slide 110

Slide 110 text

What does it REALLY do? Takes a complicated and time consuming process, and reduces it to a few minutes. Saturday, October 20, 12

Slide 111

Slide 111 text

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