Decoupled Drupal: Auto-Scaling Kubernetes, RHEL, OpenShift, NGINX, Varnish, & Redis with Lagoon

Cloud Data Centers & Decoupled Drupal CMS Hosting: Support for 100+ Million Monthly Views

The Decoupled Drupal Days summit took place in New York this month representing some of the most advanced re-architecting of the CMS for cloud & mobile optimization in the third-party developer ecosystem. Featured presentations of "Headless Architecture with the Multi-Tenant Platform" were presented by technicians from Chromatic & Meredith, while Mark Llobrera of Bluecadet spoke on "Drupal Unhitched: The CMS in Decoupled Architectures." According to Llobrera, a decoupled CMS is "an architecture for websites and applications where the CMS is not used to render the user-facing site or application." With Drupal 8 as an example, React, Express, Storybook, Webpack, or Gatsby can be used for building pages with JavaScript & Node.js rather than Drupal CMS theme files. Drupal or Magento Commerce PHP variables can be loaded in JavaScript templates similar to serverless or FaaS methods with Drupal operating in "headless" mode. This framework is a fairly radical re-write of Drupal around the core theme layer & monolithic/vertical MySQL reliance, but decoupled Drupal solutions are gaining popularity in professional web development agencies. Drupal & Magento can be integrated for cloud ecommerce applications using decoupled CMS methodologies. For scaling Drupal to billions of annual page views, decoupled CMS architecture allows for the deployment of Docker, Kubernetes, & OpenStack solutions together in data centers. The Lagoon platform from Amazee.io builds cloud web hosting solutions for decoupled Drupal with Node.js features.

Lagoon: Drupal 8, OpenShift, NGINX, Varnish Cache, Redis, & Node.js

Michael Schmid, CTO of Amazee.io, gave a keynote address at the Decoupled Drupal Days Summit in New York on "How to run Decoupled Drupal for 110 million page hits per month." This seminar is instructive for those looking for information on the industry leading way to run Drupal at scale on AWS. Schmid introduced his company's "Lagoon" platform, which is built for optimizing hosting for Decoupled Drupal sites on public cloud hosts using OpenStack. Using Lagoon, Drupal administrators create containers for PHP with NGINX, run the MySQL or MariaDB installation in another container, with Node.js configured on a third set. Containers for Redis, Varnish Cache, & Solr complete the install, with Kubernetes & OpenStack managing load balancing, page caching, & auto-scaling web server nodes to match traffic rates. Lagoon relies upon Red Hat Enterprise Linux and the OpenShift platform, as well as the Original Community Kubernetes Distribution (OKD). Systems administrators will need to use Jenkins, Ansible, Vagrant, TravisCI, Puppet, Docker, & CircleCI for configuration. Programmers & developers will need to be familiar with GraphQL, React, Apollo, Next.js, & Prometheus. Lagoon uses Alpine Linux for container installs from Docker images. CDN integration completes a different production route for anonymous traffic by geo-location, further optimizing data center hardware.

https://www.youtube.com/watch?v=eZJz4VbM1E4

Docker, Lagoon, & Drupal: "Lagoon allows developers to develop locally with Docker, and have the exact same Docker images and Containers running in production in Kubernetes. Lagoon understands how to run a Drupal site with everything you might want to use to make it, including: Varnish, Nginx, PHP, MariaDB, Solr, Elasticsearch, Redis, Drush, Composer, and Console on Kubernetes. And it does it all for you. All you have to do is push to your Git Repository and it’s deployed. It’s that simple." Learn More About Decoupled Drupal & Lagoon.

The workflow process with Lagoon is to read the docker-compose.yml and build disk images which set up the OS for web servers in containers and then push disk images to an OS registry like GitHub or BitBicket. Ansible is used to push the disk image to a git repo and make commits to Node.js for testing. Lagoon deploys disk images from the git repo for Drupal web hosting requirements in Kubernetes clusters. Minishift can be used to run OpenShift server administration on the desktop. Lagoon includes server-side rendering for Node.js & React on NGINX, running Drupal on NGINX in isolated containers separately, then using Varnish Cache to manage HTML file transfers to users & CDNs. Drupal developers & systems administrators can learn more about Lagoon from Michael Schmid at Amazee.io:

https://www.youtube.com/watch?v=3RnZPrjvoqo

Drupal, Kubernetes, & OpenShift: "Each service (Nginx, PHP, MySQL, Solr, Redis) is running in its own container, with Drush running in a separate container for better security. Decoupled projects just have a Node.js container running beside the regular Drupal containers. Cache Tags are very important and are passed through all Cache layers in order to reach the best cache rates. We run a Single Monorepo for Frontend (Node.js) and Backend (Drupal), which provides better parallel deployments and coordinated rollouts of changes. The ability to create individual Environments for each Pull Request and Branch allows for better testing of individual features." Learn More About Decoupled Drupal Hosting.

OpenShift: RHEL OpenStack & Origin Community Kubernetes (OKD)

One of the major advantages of the Lagoon platform is the ability to use Drupal with OpenStack & Kubernetes in production on Red Hat Enterprise Linux & OpenShift. Lagoon compiles disk images for containers using Alpine Linux for smaller build sizes. Work with Docker containers and export web server package builds to the cloud through a Git repository. Lagoon provides a utility service between the Drupal CMS script for OpenStack, Kubernetes, & Docker. It also integrates with Ansible, Vagrant, Puppet, & Pygmy for web server automation.

Origin Kubernetes: "OKD is the Origin community distribution of Kubernetes optimized for continuous application development and multi-tenant deployment. OKD adds developer and operations-centric tools on top of Kubernetes to enable rapid application development, easy deployment and scaling, and long-term lifecycle maintenance for small and large teams. " Learn More About Origin Kubernetes.

Decoupled Drupal: React/Gatsby & Node.js + Symfony & PHP

The main JavaScript frameworks being advanced for decoupled Drupal theme solutions are: React, Storybook, Gatsby, Webpack, GraphQL, Atomic Design, Jest, & Express. Symfony is the core PHP partner for Drupal module development standards & integration tools. With decoupled Drupal, the MySQL, PHP, & Node.js aspects of the CMS architecture all run in different containers rather than on one VPS or dedicated server. The containers can then be auto-scaled using either OpenStack or Kubernetes to manage the deployment according to the function of the container in the web stack. Ansible, Vagrant, & Puppet are used for other web server scripting and configuration automation, i.e. for using Caddy and Let's Encrypt or disk image automation. Similarly PHP support is minimal for some web server builds but optimized with multi-layer caching on custom NGINX servers for running Drupal core & React.js files.

  • Pros: Lagoon is built upon Docker with Red Hat OpenShift and can now be used on any public cloud hardware.
  • Cons: The disadvantage is that website templates need to be custom coded by JavaScript & Node.js experts.

Summary: Running Drupal core and Node.js servers together in cloud containers parallel to the MySQL, then routing users to HTML cached content managed by Varnish & Redis, is the industry-leading scalability solution for Decoupled Drupal CMS hosting, which has proven reliable at more than 100 million page views per month on AWS.

Headless Drupal: Building Blazing-Fast Websites with React/GatsbyJS

https://www.youtube.com/watch?v=TuVeWTieJGI

Kyle Mathews - React, Gatsby, & Drupal 8: "Don't build a website with last decade's tech. The future of the web is mobile, JavaScript and APIs—the JAMstack. Every website is a web app and every web app is a website. Gatsby.js is the universal JavaScript framework you’ve been waiting for.. Enjoy the power of the latest web technologies – React.js , Webpack , modern JavaScript and CSS and more — all setup and waiting for you to start building." Learn More About Gatsby.js.

Summary: Decoupled Drupal & Node.js for Cloud Applications

With monolithic Drupal CMS installations, the theme layer runs through the PHP processing engine on the server to render, adding JavaScript & CSS under DHTML/XHTML code. For the enterprise standard of 100 million page views per month in ecommerce, with Magento integration, big brands cannot support web traffic on data center hardware efficiently using monolithic hosting techniques. The cloud server architecture outlined by Lagoon is industry-leading in building on RHEL, OpenStack, NGINX, Varnish Cache, Redis, & MariaDB for running Drupal 8 in Docker containers with Kubernetes orchestration. This solution will work on AWS, Google Cloud, Microsoft Azure, or any other public cloud architecture with portability.

Recommended Downloads:

  1. Docker Desktop
  2. Acquia Dev Desktop
  3. Red Hat OpenShift
  4. Origin Kubernetes (OKD)
  5. Amazeeio Lagoon
  6. GatsbyJS

Drupal Modules:

  1. Purge
  2. Varnish Purge

Conclusion: Lagoon is a state-of-the-art data center solution for hosting Drupal CMS websites at scale using NGINX, Varnish Cache, & Redis servers, but Node.js theme layer is required.

Eliran Ouzan
Author:
Eliran Ouzan is the Co. Founder and designer of HostAdvice and also owns Moonshot Marketing LTD, a leading web design & development firm and was a member at GreenPeace.

Widely known for his pixel-perfect and high conversion rate web designs. Over the course of his web experience he experimeneted with over 200 web hosting companies and have a superior knowledge on what defines a good hosting company.

Share this post

"Decoupled Drupal: Auto-Scaling Kubernetes, RHEL, OpenShift, NGINX, Varnish, & Redis with Lagoon"

Decoupled Drupal: Auto-Scaling Kubernetes, RHEL, OpenShift, NGINX, Varnish, & Redis with Lagoon