Docker4Drupal

By Rob Loach - Kalamuna

October 19th, 2017 - BADCamp, 2017

robloach.github.io/slides

Rob Loach

robloach.net / @RobLoach / GitHub

Kalamuna

Local Development Suck

  • Difficult to install complete stacks
    • Web server? Apache, Nginx, Express
    • Language? PHP, Node.js, Python
    • Database? MySQL, Postgres, CouchDB
  • Unable to switch services
  • Slow re-install process
  • Version inconsistancy across team

"VMs are out, Containers are in"

-- Michelle Krejci

  • DDev
  • Lando
  • Outrigger

Docker4Drupal

  • Optimized Docker Containers for Drupal
  • Simple Docker Compose Configs
  • Focus on local development
  • Unique per project
  • Swappable Services

Features

  • Simple to setup
  • Servers: Nginx, Apache
  • Platform: Drupal 6, 7, 8
  • PHP: 5.3, 5.6, 7.0, 7.1
  • Database: MariaDB
  • Other stuffs: Redis, Varnish, Solr, Node.js, Memcache, Webgrid, Blackfire, Syslog, AthenaPDF, Mailhog, Adminer, phpMyAdmin, Portainer, Traefik

Installation

1. Docker

2. Docker Compose

Two Methods

github.com/wodby/docker4drupal

1. Vanilla

2. Mounted

Vanilla

  • Download docker-compose.yml
  • docker-compose up
  • http://drupal.docker.localhost:8000

Mounted

  • Download docker-compose.yml to your Drupal root
  • Update nginx/php mount locations
    • ./:/var/www/html
  • Update settings.php to match MariaDB service
  • docker-compose up
  • http://drupal.docker.localhost:8000

But what about...

Composer

docker-compose run php composer

Drush

docker-compose run php drush

Drupal Console

docker-compose run php drupal

"SSH in?"

docker-compose run php bash

Exposing Services

Traefik manages routing

labels:- 'traefik.backend=pma'- 'traefik.port=80'- 'traefik.frontend.rule=Host:pma.project.docker.localhost'

pma.drupal.docker.localhost:8000

adminer.drupal.docker.localhost:8000

servicename.drupal.docker.localhost:8000

What Now?

  • Add docker-compose.yml to EVERYTHING
  • Containerize all services
  • Standardize stack from local to production
  • Ease team on-boarding
  • Hosting: Lagoon/Platform.sh/Pantheon/DO
  • We need to go deeper
    • ChatOps? IRC, Slack?
    • AI?

"Simplify, Simplify, Simplify"

-- Henry David Thoreau

docker-compose down

Thank You

robloach.github.io/slides