Save time and continuously deliver higher quality | Docker and Drupal

Jun 04, 2018

Joris Snoek - Business Dev
+31 (0)20 - 261 14 99

As a digital agency, we develop many platforms and websites for different clients. In the past years, we often encountered the following problem: a developer produces something on his laptop that does not work instantaneously on the laptop of another developer. We had to look for the difference in laptop software and settings. This took time, is frustrating and a complete waste of energy, because this misery can be avoided if all systems are 'containerized' through Docker.

A notorious statement is:

It worked on my machine

This problem is caused by the fact that the laptops / servers differ in, for example:

  • Operating system;
  • PHP version;
  • Database version.

A minimal difference in the settings within an application (eg PHP or MySQL) can also take a long time to discover.

Also a difference in write permissions can take a lot of time to find out.

In addition, each platform or website has its own system requirements anyway: for example, one is ready for PHP 7 and the other requires PHP 5.6.

Docker solves these problems: it ensures that a website always lives in the same persistent environment in terms of operating system, associated applications and settings. Wherever you are running the website: locally or an online server - Mac, Linux or Windows.

Advantage for Drupal product owners (website owner)

  • Faster development and test processes.
  • Higher quality in deliveries due to consistency of underlying architecture.
  • Faster and stable live deployments.
  • Consistent continuous integration, which shortens the time to live of new functions. This applies to both support issues and complete sprints.

Traditional Drupal vs Drupal in Docker containers

Put simply, within Docker the application is linked to the environment, so that it always has the right server stack.

Traditional Drupal
You can see in the above workpiece that within a traditional environment, the Drupal website is separate from the server stack. The server stack therefore differs per environment (laptop or cloud server), giving you the aforementioned problems and frustrations as soon as you want to have it working elsewhere.

Drupal in Docker containers
In the Docker scenario you see that the Drupal website is inextricably linked to the server stack:

  • A bare bone OS (operating system).
  • The required server applications.
  • Libraries and settings.

Drupal bug tracking made easier

For example, the Drupal website always has exactly the same environment and it does not matter where you install it. So independent of laptop or server: it will work the same everywhere. Or, not work anywhere which is also important so you can bug-track in your Drupal website.

Without Drupal in Docker, the latter scenario also happens too often: a bug in the Drupal website can not be reproduced because it dóes work locally.

Plug and play server applications and tools

Where it used to be difficult to install required server applications on your laptop, that is now relatively quickly arranged.

Think about

You download this and it works instantaneously within a container, where your application can connect to.

Continuous Integration (CI) of Drupal applications

Because all environments are always the same, Drupal test trajectories will take less time. Because where you traditionally had to test all environments again - now you know (almost) for sure that once the Drupal application works locally, it works on the test, acceptance and live server.

We are currently further integrating Docker into our CI street. For an interesting article on continuous integration, see here

Why Docker?

There are several variants of virtualization software to solve the 'it worked on my machine' problem.

So why Docker? 5 reasons:

1. Docker is popular

Research shows that Docker is applied on a large scale. Cloud monitor DataDog saw March 2016 13.6 percent of customers running on Docker. A year later that number has grown to 18.8 percent - a growth of almost 40 percent in 12 months time.

RightScale noted in its RightScale 2018 State of the Cloud-report that the implementation of Docker has increased to 49 percent from 35 percent in 2017.

Stats
More than 3.5 million applications have been placed in containers with Docker technology and more than 37 billion containerized applications have been downloaded. source

2. Docker is relatively easy and safe

Compared to other virtualization software, Docker is relatively quick to learn for a dev-ops engineer. In addition, the containerization provides an environment that is faster and easier to keep safe.

3. Docker loves everything and everyone

Docker is also built in such a way that it can be used on other popular dev-ops applications like Puppet, Chef, Vagrant, and Ansible. Source.

4. Embrace by the big

Docker cooperates with Google, Microsoft, Amazon, Cisco, HP, IBM, RedHat, VMWare (source), whereby the necessary standardization was also made.

5. Docker versus other Virtual Machines

There are several similar virtualization techniques, but Docker's container architecture makes the difference. Simply put, you can run multiple applications on one VPS - where other virtualization techniques require one VPS per application.

Docker containers are isolated, but share the underlying operating system and -if necessary- applications and libraries.

With Docker you can use your server resources more efficiently: you can run multiple Docker environments on one VPS - this is not possible with other Virtual Machines. For more benchmarking details herein, see also this blog.

Docker says

Docker is the world’s leading software container platform available for developers, ops and businesses to build, ship and run any app on any infrastructure.

and

No Lock-in: Multi-Linux and Windows. Multi-Cloud.

and

Increase Security, Enable portability and lower costs in 5 days without changing app code.

Source: Docker.com

There is more

Some additional reasons to use Docker:

  • Local SSL relatively easily, via LetsEncrypt.
  • People can collaborate more quickly and easily on an application, without needing all kinds of dev-ops knowledge.
  • Because your application is instant portable you can switch from hosting provider easier.
  • Large projects can be more easily split up into small teams, using CI tools like Jenkins the code from different teams is integrated.
  • Create sandboxes quickly and destroy them, so that everything stays clean.
  • Docker has a large ecosystem.
  • Complex micro-service becomes possible within a container

Misc Docker stuff

Nice fact: lmctfy

Few people know this, but most of you have been using containers for years. Google has its own open-source container technology (Let Me Contain That For You). Every time you use Google functionality (Search, Gmail, Google Docs), you will be assigned a new container. source

Docker's ecosystem

Some popular parts in Docker's ecosystem:

DockerCon

Docker conferences are held annually, this year it takes place in San Francisco. For more info, see Dockercon.com.

Challenges and points for attention

  • Consolidation of Database data
  • Live environments for customers: some customers would like to host themselves, but do not support Docker yet.
  • On MacOS, some Docker related actions are unnecessarily slow.
  • All developers have to master the technique before your organization can completely adopt.

Wrap up

The it worked on my machine problem is a thing of the past with us, but some systems have to be completed but we are almost there.

This saves everyone, including product owners (our customers) a lot of time and energy. Deliveries go faster and better, what more do you want?

Questions or additions? Let me know!

-- Cheers, Joris

Sources

Comments

Stay up-to-date

Subscribe to our Lucius newsletter
and be the first to know about new articles!

Need even
more knowlegde?