Decoupling Drupal using static site generation

Posted on: Thu, 03/24/2016 - 18:01 By: Darko
Diagram for Drupal de-coupling architecture ('headless Drupal')

Our Drupal expert: Progressive De-coupling using Static Site Generation  + RESTful web services or GraphQL

NOTE: This architecture is suitable for sites where the End Users are anonymous and the content does not change that often, say, once an hour.

What is 'Headless Drupal'?

The site generator generates a static HTML site using pre-defined generator templates, data from Drupal repository and Drupal rendered entities, such as rendered node or menu trees. The dynamic aspects of the site are exposed as REST services and the user interacts with back-end Drupal using JS / AJAX. The Drupal site runs securely on a different machine / port, perhaps on the internal company network. Content editors can still access the site using the standard Drupal interface, benefiting from Drupal features, like edit node, find content etc...

The advantages and disadvantages of a decoupled Drupal site are outlined below:

Advantages of an HTML generated site

  • Security

  • Stability (if the Drupal site goes down the html site still runs, just without services like search or subscribe, which can be gracefully degraded with JS)

  • Scalability / performance

  • Running costs (much cheaper to host and manage)

  • Easy to devise DDOS attacks strategy, as it is easy to move the site to a different host.

  • It is easier to plug in different data sources, such as another CMS or database.

Disadvantages

  • Functionalities that are not static will need to be rebuilt using JavaScript and REST services or GraphQL (i.e extra development efforts)

  • Development effort needed to allow existing site to be generated as HTML site.

  • Some additional DevOps effort needed to set up site generator software and configure the above described architecture.

 

Tools, modules, services, and references for decoupling Drupal sites
 

Static site generator tools
 

https://staticsitegenerators.net/

 

Drupal generator module

https://www.drupal.org/project/static

 

Popular site generator tools

 

Services

RESTful service could be used for interactive / de-coupled part of the site. When the GraphQL Drupal module is ready it can be used instead.
 

https://www.drupal.org/project/graphql
 

References:

------------------
De-coupling

http://blog.openlucius.com/en/blog/headless-drupal-why-how-restful-api-drupal

http://buytaert.net/how-should-you-decouple-drupal

https://pantheon.io/decoupled-cms

https://www.lullabot.com/articles/sending-a-drupal-site-into-retirement

https://www.ostraining.com/blog/drupal/what-is-headless-drupal/

https://groups.drupal.org/headless-drupal

http://ez.no/Blog/Why-you-want-your-CMS-both-decoupled-and-integrated

 

GraphQL

https://www.acquia.com/resources/webinars/introduction-graphql-and-what-it-means-drupal

 

Sharethis