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.
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.