Top Banner
Better Local Development with Vagrant by Derek DeRaps Mediacurrent Webinar November 19th, 2013
20

Better Local Development with Vagrant

May 10, 2015

Download

Technology

Mediacurrent

Watch the presentation at http://www.mediacurrent.com/blog/better-local-development-vagrant

At Mediacurrent, we found that on-ramping new team members to a project was costing us a lot of time (and money). Although some of our developers already used Vagrant for development, most of us used (native) MAMP or native LAMP, and we routinely spent time troubleshooting problems with our local stack or site-issues that only occurred on one of our machines. Additionally, sometimes errors would appear in Production that could not be reproduced in our local environments.

Vagrant solves a lot of those headaches. By automating the generation of a LAMP stack and project setup - from host file edits to site installations to database imports - we can be assured that we're all working from identical environments. Additionally, we have fewer "surprises" when we release to production, because our Vagrant stack has been tuned to closely match that environment.

Other benefits include:
- A clean separation between projects (e.g., no more switching PHP versions for the project de l'heure).
- Low-cost troubleshooting: if your local stack gets foobared, you can wipe away and rebuild for a fresh start.

If you are already familiar with Vagrant, this presentation will help you learn about latest projects in the Drupal Vagrant ecosystem that will improve your workflow.

For those new to Vagrant, watch this presentation to learn about why you should be using it and how to get started!

Note: This webinar reviews some of the active Vagrant projects in the Drupal community; the proposed solutions are being explored but are not expressly endorsed by Mediacurrent.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Better Local Development with Vagrant

Better Local Development with Vagrantby Derek DeRapsMediacurrent WebinarNovember 19th, 2013

Page 2: Better Local Development with Vagrant

Derek DeRapsDrupal Developerd.o derek.deraps

@mediacurrent

Page 3: Better Local Development with Vagrant

Agenda● What is Vagrant?● Why use it? (BENEFITS)● Why not to use it? (DOWNSIDES)● Approaches (Per-project vs. One stack)● Provisioners (Chef and Puppet)● Demos!

○ Proviso○ Drupal LAMP○ Kalabox (ask me for a code)

● Q&A, Discussion

@Mediacurrent

Page 4: Better Local Development with Vagrant

What is

Vagrant?

Page 5: Better Local Development with Vagrant

What is Vagrant?

Vagrant is a tool for building complete development environments. With an easy-to-use

workflow and focus on automation, Vagrant lowers development environment setup time, increases development/production parity, and

makes the "works on my machine" excuse a relic of the past.

@Mediacurrent

Vagratup.com

Page 6: Better Local Development with Vagrant

What is Vagrant?

● a headless* Virtual Machine.○ VirtualBox (free)○ VMWare Fusion (paid)○ Parallels (yup, see here)

● a Development Environment**○ LAMP stack○ WWW files mounted for host access○ Replaces your local stack: MAMP, WAMP, XAMPP, etc.

● Automated stack provisioning + configuration○ via Chef, Puppet, or ?

@Mediacurrent

Page 7: Better Local Development with Vagrant

Why use it?

Benefits

Page 8: Better Local Development with Vagrant

Benefits@Mediacurrent

● On-ramp new team members more quickly and more easily.

● Sandbox environment - clean local machine.● Automated provisioning and configuration

○ Chef, Puppet, Others?● Mirror the production stack and configuration.● Same stack across your team.● Lowers the cost of mistakes. Boxes are “cheap”

- easy to blow away + recreate.

Page 9: Better Local Development with Vagrant

Why not to use it?

Disadvantages

Page 10: Better Local Development with Vagrant

Disadvantages@Mediacurrent

● Fresh build takes a long time (5 to 10 minutes).● Disk space/bloat, when using boxes per project.● Learning curve: Chef/Puppet, etc.● Large upfront investment to configure.

○ New Vagrant projects lowering this cost.● Slow file system?

○ Mount with NFS.● Need drush access?

○ Use Drush Aliases to access the guest.

Page 11: Better Local Development with Vagrant

Directory Layout &

Approaches

Page 12: Better Local Development with Vagrant

Directory Layout@Mediacurrent

Page 13: Better Local Development with Vagrant

Approaches@Mediacurrent

● One box○ All your projects in one box.○ 70% of the “win” with 50% of the work.

● Boxes per hosting environment○ All your Acquia clients in one Vagrant tuned

to match Acquia’s stack, et al for each different production hosting environment.

● Per-project boxes○ Tuned to exactly match project’s prod. env.○ More overhead when switching contexts.

Page 14: Better Local Development with Vagrant

Puppet and Chef

Provisioners

Page 15: Better Local Development with Vagrant

Provisioners@Mediacurrent

● Puppet○ Some folks love it >Chef.

● Chef (by OpsCode)○ Create recipes inside of cookbooks to

provision and configure the stack.○ Everything you need for a basic LAMP stack

provided by OpsCode: https://github.com/opscode/cookbooks

● A quick tour of Chef recipes and cookbooks.

Page 16: Better Local Development with Vagrant

Time for some Demos :)

“ How do I Vagrant?? ”

Page 17: Better Local Development with Vagrant

Kalabox@Mediacurrent

● Node.js application wrapper for a single box.● Still in private beta - Ask me for a beta key so

you can download and try it out.● The most win for your time - dead simple to

install and use!● Even more WIN if you host with Pantheon.● Warning: last beta install wiped out my

VirtualBox installation (but not the box files!) and I had to reinstall.

● Poke around in ~/.kalabox

kalabox.kalamuna.com

Page 18: Better Local Development with Vagrant

Proviso@Mediacurrent

● Drupal-specific: Aiming to be *THE* development environment for Drupalers.

● A collaboration between different agencies who have all built Vagrant profiles from the ground-up multiple times, and are sick of it.

● A lofty goal, given the variance between hosting environments.

● Still very much a work in progress: Last I used, did not come with a working stack.

github.com/proviso/provisoWatch the DrupalConPrague session

Page 19: Better Local Development with Vagrant

Drupal LAMP@Mediacurrent

● A project by New Media (a Denver agency)● A single environment for all their projects.● Heavy investment in project automation.● Can automatically download the project

repository, import the site’s database, update your host file, and more.

● They are Chef masters: All their configuration (including production boxes) managed by Chef server.

github.com/cyberswat/drupal-lamp

Page 20: Better Local Development with Vagrant

Thank You!

Questions?@Mediacurent Mediacurrent.com

slideshare.net/mediacurrent

drupal.org user derek.derapsdrupal.org/user/1571646/contact