Skip to main content

Building and maintaining Drupal + CiviCRM application containers

In my previous two posts, I provided some background into why I decided on using containers for a boutique Drupal + CiviCRM hosting platform, and why Docker and its micro-services approach is a good choice for building and maintaining containers.

Although I promised to talk about orchestration, that was getting ahead of the story - first I'm going to look at the challenge of keeping your application containers up-to-date with OS and application-level updates. There's a fair amount of work in that, but the tooling is mature and there is lots of good documentation.

A great place to start is to visit the official Drupal docker hub page. From there, you can pull a working Drupal code container, and it gets re-built frequently with all the OS and Drupal-code updates, so you just refresh your containers whenever you want (i.e. whenever a security release comes out, or more often to stay up-to-date).

A nice thing about that project is that it demonstrates a technique for maintaining multiple Drupal versions over time, with multiple variants of each one for apache with mod_php, nginx with php-fpm, and even a variant using an alpine base image. To see how that works, visit the github docker-library drupal project, which is used to automatically generate the images on docker hub.

My first working attempt at a Drupal + CiviCRM container was loosely based on the project code at the time - I copied over the Drupal 7-apache Dockerfile and modified it with some additional requirements for CiviCRM. That attempt has evolved somewhat, but is still the basis for my production containers.

But since it's grown to include a fair amount of customization specific to my needs, and since the Drupal project code has evolved somewhat, I've re-created the idea as an "open-source" kind of Drupal + CiviCRM application container.

The way I've implemented the CiviCRM support adds some additional complexity. I want to continue to get updates from origin project, so my project's master branch just pulls from the Drupal origin project, and then I've added two new permanent custom branches. Updates from master branch can then get merged up to these two new custom branches. The first branch "civicrm-5" adds the required OS bits to host a Drupal 7/CiviCRM 5 install, i.e. things like imagemagick and SOAP. The second branch "civicrm-5-stable" also adds the civicrm code base itself. Both images are useful in different contexts. Each branch with each Drupal variant can then be used to generate a docker image, and I've set those up on docker hub, where you'll see quite a few auto-generated docker images here

https://hub.docker.com/r/blackflysolutions/drupal/tags

The convention I've used is to name the tags after the combined drupal variant - civicrm branch that generated the image. I plan to also add some additional bits to the tag to track each different drupal/civi release that they're using.

Note that I (still) haven't actually said anything about orchestration - the process of launching the container in combination with an appropriate sql container and a way to keep the files around when you replace the container with a newer one.

Docker is not for the dilettante.

Popular posts from this blog

The Tyee: Bricolage and Drupal Integration

The Tyee is a site I've been involved with since 2006 when I wrote the first, 4.7 version of a Drupal module to integrate Drupal content into a static site that was being generated from bricolage. About a year ago, I met with Dawn Buie and Phillip Smith and we mapped out a number of ways to improve the Drupal integration on the site, including upgrading the Drupal to version 5 from 4.7. Various parts of that grand plan have been slowly incorporated into the site, but as of next week, there'll be a big leap forward that coincides with a new design [implemented in Bricolage by David Wheeler who wrote and maintains Bricolage] as well as a new Drupal release of the Bricolage integration module . Plans Application integration is tricky, and my first time round had quite a few issues. Here's a list of the improvements in the latest version: File space separation. Before, Drupal was installed in the apache document root, which is where bricolage was publishing it's co...

Refactoring My Backup Process

A couple of weeks ago, I decided to spend a few hours on a Friday afternoon improving my backup process for my Blackfly managed hosting service . Two weeks later, I've published my ongoing work as an update to my backup-rsync project and have decided to share it with you. You might think I'm trying to compete for "least click-bait like title ever", but I'm going to claim this topic and project might be of interest to anyone who likes to think about refactoring , or who is implementing backups for container-based hosting (like mine ). Definition "Backup" is one of those overloaded words in both vernacular and computer-specific use, so I want to start with definitions. Since "a backup" is amongst the least interesting objects (unless it contains what you absolutely need in that moment), I think it's more interesting and useful to define backups functionally, i.e. A "backup process" is a process that 1. provides a degree of insuranc...

drupal, engagement, mailing lists, email

I lived, worked and studied in Costa Rica from 1984 to 1989. Ostensibly, I was there to study Mathematics at the University, and indeed I graduated with an MSc. in Mathematics supervised by Ricardo Estrada (check that page, he even advertises me as one of his past students). And yes, I do have a nine page thesis that I wrote and defended in Spanish somewhere in my files, on a proof and extension of one of Ramanujan's theories. But mathematics is a pretty lonely endeavour, and what drew me back to Central America (after the first visit, which was more of an accident), was the life and politics. The time I lived there was extremely interesting (for me as an outsider, though also painful and tragic for it's inhabitants) because of the various wars that were largely fuelled by US regional hegemonic interests (of the usual corporate suspects and individuals) and neglect (of the politicians and public) - the Contra war in Nicaragua, the full-scale guerrilla wars in El Salvador and...