Download - Better Local Development with Vagrant

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