Using Docker to boost your development experience with Drupal

Preview:

Citation preview

Jürgen Viljaste

Drupal developer

drupal.org/u/viljaste

Mait Roosvalt

Drupal developer

drupal.org/u/maitzzz

Using Docker to boost

your development

experience with Drupal

Part 1

High level explanation of Docker

● Wraps all the pieces of your application into a

standardized package

● Allows you to run your application virtually in any host

● Makes it very easy to share your application with others

● Whole-system virtualization (VirtualBox)

Getting started on non Linux hosts

● Whole-system virtualization (Vagrant + VirtualBox)

Getting started on non Linux hosts

● Docker Toolbox

Getting started on non Linux hosts

Architecture of Docker in a nutshell

What makes Linux so special?

● Container-based virtualization (Operating-system-level

virtualization) support by the kernel

● Considered mainstream operating system in the

technology world

Why is container-based

virtualization important?

● Efficiency - the amount of resources (CPU, RAM, disk

space etc.) you have available on your system can be

directly translated to the complexity of projects you can

develop on a single machine

● Speed - the faster you can start and rebuild your

application, the faster you can get the feedback and

solve problems

What is a Docker image?

● A read-only template that contains a collection of files

that your application needs in order to run

● Can be easily shared via centralized registries or

exported to a file

Ways to build a Docker image

● Manually - easy to perform, in practice hard to manage

● Automatically through a Dockerfile - prefered way to

build an image

What is a Docker container

● Isolated virtual environment for your application

● Feels like a lightweight virtual machine

● More efficient by sharing host’s operating system kernel

with other containers, but still gives you virtual machine

like capabilities

● Launched from a Docker image

● Fine control over resource allocation

● Per container monitoring

● Startup time is measurable in seconds

ELI5: The difference between a

Docker image and a Docker

container?

Dockerfile basics

● A file that contains a series of instructions on how to

build an image

● Very easy to get started with if you already know how to

use command line interface

Writing non-interactive commands

apt-get install apache2

Requires user interaction, image build process will fail if

used in a Dockerfile

apt-get install -y apache2

Doesn’t require user interaction, command will install

Apache without asking confirmation, OK to use in a

Dockerfile

Dockerfile syntax

Demo

Using Docker to boost

your development

experience with Drupal

Part 2

The Dark Ages

● Development environment not scalable due to using

inefficient tools and workflows

● Fixing a simple bug requires higher level of skill

● Front-end developers directly affected by issues that

shouldn’t belong to their domain

● Development cost higher than it should be

The Accident

sudo chown -R www-data.www-data /

Deploying Docker: Phase 1

Container + Drush = Crush

● Version agnostic wrapper around Drush that allows a

developer to use Drush seamlessly with containers

● Written in Bash, in the future should be ported to a

language that has a better support in Windows

● Supports Drupal 6, 7 and 8

Networking made easy

Deploying Docker: Phase 2

virtual + host = vhost

● The front page of your

development

environment

● Lists all your running

containers on a single

web page

● Access containers easily

through DNS

Drupal Compose

● Generates general purpose docker-

compose.yml file automatically for your

Drupal 6, 7 and 8 projects

● Developer can start working on a new

project immediately

On-premises Docker registry

● Stores our project specific Docker images that shouldn't

be available to public

● Saves lots of time, developers don't have to build

project images on their machine if they just want to

consume them

Demo

Conclusion

● Docker helped us to make our development

environments and people working together more

efficient

● Having a system in place that doesn't require any

knowledge of setting up your project, no matter what is

your skill level you can still fix bugs or develop new

features to any existing project

● More complex projects are easier to work with and

maintain

Contribute at

dockerizedrupal.com

Recommended