Better Local Development with Vagrant by Derek DeRaps Mediacurrent Webinar November 19th, 2013
May 10, 2015
Better Local Development with Vagrantby Derek DeRapsMediacurrent WebinarNovember 19th, 2013
Derek DeRapsDrupal Developerd.o derek.deraps
@mediacurrent
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
What is
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
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
Why use it?
Benefits
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.
Why not to use it?
Disadvantages
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.
Directory Layout &
Approaches
Directory Layout@Mediacurrent
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.
Puppet and Chef
Provisioners
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.
Time for some Demos :)
“ How do I 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
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
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
Thank You!
Questions?@Mediacurent Mediacurrent.com
slideshare.net/mediacurrent
drupal.org user derek.derapsdrupal.org/user/1571646/contact