Build Automation with `make` - Utilizing Docker with Vagrant

As a web application developer, there should be as little friction as possible setting up your dev environment to begin contributing code to a new project.  The more complex the application, the more there is to setup.  You can document the 20 steps to get started working on a project in a `README` file in your project root, but really, who wants to follow a list like this just to contribute code to your project:

Installation Instructions

* Install Postgres and configure this way
* Install Solr with this configuration
* Install nodejs, npm, gulp, etc...
* ...
* ...
* (15 more steps)

 

Wouldn't it be amazing to be able clone the repo you want to contribute to and have everything come up with the strike of one command?

 

At ActiveLAMP, we solve this (for the most part) utilizing a `Makefile` at the project root of our projects, allowing new developers the ability to just run `make` to get everything spun up.  I say for the most part because we still have some prerequisites you must ensure you have on your machine to run `make`, but once you have the prequisites installed, each subsequent project is a matter of just running `make`.

To give you an idea, here are some prereqs:

  • Install Virtualbox
  • Install Vagrant
  • Install these Vagrant plugins

**Disclaimer: YMMV on Windows.  Unix-based machines, like Mac OSX, is what we have tested this process on.**

In this session, I'll pull the curtain back to show you what is happening when `make` is executed.

You will find out:

  • Why using a `Makefile` is a good pattern to follow
  • A crash course on what Docker is, and the contents of a `Dockerfile`
  • A crash course on Docker Compose
  • A crash course on Vagrant, and the contents of a `Vagrantfile`
  • Building Drupal 8 with Composer
  • Using Drush and Drupal Console from the host, which natively runs within the Drupal container.
  • Managing files between the host and container environment

There are a lot of moving parts behind the scenes.  With build automation, new developers don't need to spend hours setting up environments just to contribute to a project, more like 20 minutes sipping on coffee while Vagrant and Docker take care of the heavy lifting.

Session track: 
Session skill level: 
Session speaker(s):