Introduction to Vagrant & using it for WordPress development

10
Working with Vagrant in my WordPress development workflow James Bundey @jamesbundey Melbourne WordPress Developer Meetup November ‘14

Transcript of Introduction to Vagrant & using it for WordPress development

Page 1: Introduction to Vagrant & using it for WordPress development

Working with Vagrant in my

WordPress development

workflow

James Bundey @jamesbundey

Melbourne WordPress Developer Meetup November ‘14

Page 2: Introduction to Vagrant & using it for WordPress development

What is Vagrant?

Create and configure lightweight, reproducible, and

portable development environments

https://www.vagrantup.com

Page 3: Introduction to Vagrant & using it for WordPress development

Why bother?

• Simple to set-up

• Enables you to easily recreate local development

configurations

• Enables easy and total management of each

environments

• Keeps development clean - run one set-up for

WordPress projects another for another CMS

• Take advantage of the open source configurations

created by people far smarter than me.

Page 4: Introduction to Vagrant & using it for WordPress development

Getting started

1. Install Virtual Box - We need this to create the virtual machines

that are going to house our development environments -

https://www.virtualbox.org/wiki/Downloads

2. Install Vagrant - https://www.vagrantup.com/downloads.html

3. Install two extremely useful plugins via the command line

• Vagrant Hostsupdater - enables you to access your

development server via a web browser without additional

configuration$ vagrant plugin install vagrant-hostsupdater

• Vagrant Triggers - backs up and restores the database after

every shutdown and boot up.$ vagrant plugin install vagrant-triggers

Page 5: Introduction to Vagrant & using it for WordPress development

Vagrant & WordPress configuration

• Once Vagrant is set-up we need to create a configuration file to set-up

the development environment

• Thankfully there’s lots already out there - here’s a great overview of some

http://wptavern.com/13-vagrant-resources-for-wordpress-development

• I’m using Varying Vagrant Vagrants - https://github.com/Varying-Vagrant-

Vagrants/VVV

• To set-up our WordPress environment, we simply git clone VVV to a

folder and runcd ~/new-folder

vagrant up

• Sit back and grab a cup of tea (I am british after all) while it works its

magic

Page 6: Introduction to Vagrant & using it for WordPress development

Vagrant & WordPress

• Once completed you’ll have four WordPress site

configurations installed in the www folder

• WordPress Stable: local.wordpress.dev (typically what I’m going to use)

• WordPress Trunk:local.wordpress-trunk.dev

• WordPress Develop: src.wordpress-develop.dev & build.wordpress-develop.dev

• You can now access & freely develop as required -

http://local.wordpress.dev

• To access phpMyAdmin - http://vvv.dev/database-

admin/

Page 7: Introduction to Vagrant & using it for WordPress development

Some useful extensions

• VVV Site Wizard - saves time by enabling you to easily

create additional WordPress installs. The wizard guides

you through the set-up & creates the database, host

names etc - https://github.com/aliso/vvv-site-wizard

• VVV Dashboard - creates a dashboard that can be

viewed in the browser, that enables you to easily view

and manage all your installs

• Vagant Manager - OSX app for managing Vagrant

installs - http://www.vagrantmanager.com

Page 8: Introduction to Vagrant & using it for WordPress development

Integrating with my workflow

1. Using the VVV wizard I create a new install on the same

server - standard install

2. I store the plugins that I use 99.9% of the time in all

projects in a Git repository, which I clone to the wp-

content folder

3. I clone my framework, to the themes folder as my base

4. I then remove the .git file as I will be creating a new repo

to host this theme

5. I install my Bower & Grunt dependencies and start

developing

Page 9: Introduction to Vagrant & using it for WordPress development

Any problems

• So far none. I’ve found it extremely useful to set-up and

much quicker than Mamp Pro

• Highly recommend the app, as it makes things easy

• Keeping each environment separate has been a bonus

and for those using other CMS there are very similar

configuration files.

• Experimented with sharing the environment across

multiple machines using Dropbox and sym links, with

mixed success.

Page 10: Introduction to Vagrant & using it for WordPress development

Questions?

Connect with me

@jamesbundey

www.linkedin.com/in/jamesbundey