SlideShare a Scribd company logo
CONTENT STAGING 
IN DRUPAL 8 
DICK OLSSON TWITTER: @dickolsson 
ADVANCED SITE BUILDING
AGENDA 
What is content staging? 
What we want from the solution 
How it's (being) built for Drupal 8 
Reusable protocols 
Headless Drupal
WHO AM I? 
Dick Olsson 
Digital Engineering Manager 
at Pfizer 
dixon_ on drupal.org 
@dickolsson on Twitter 
Web technologist 
Drupal contributor
WHAT IS 
CONTENT STAGING?
SIMPLE WORKFLOW 
Stage Prod
SECURE PUBLISHING 
Stage Prod 
Corporate firewall
MERGE WORKFLOW 
Stage 
Edit 1 
Edit 2 
Edit 3 
Prod
HUB/SPOKE WORKFLOW 
A 
D Editorial B 
C
RING MODEL 
A 
D B 
C
IT'S SORT OF... 
Content staging 
Content sharing 
Replication 
Syndication
WHAT WE WANT
WHAT WE WANT 
We don't want to build just a “content staging” 
system. 
We need a generic and loosely coupled 
“content replication” framework capable of 
arbitrarily moving content between system.
WHAT WE WANT 
Learning from the Drupal 7 implementations of 
UUID, Deploy and WF Tools modules.
WHAT WE WANT 
Revisions everywhere 
Conflict detection 
Easier dependency management 
Ad-hoc / Continuous replication 
Bi-directional replication 
REST API
HOW IT'S BUILT
HOW IT'S BUILT 
Contrib: 
Multiversion 
Relaxed Web Services 
Deploy 
Core: 
Serialization 
Restful Web Services 
Entity API
multiversion.module 
Tracks update sequences in order to make 
dependency management a lot easier. 
Provides revision support for all content 
entities. 
Tracks revision trees in a way similar to Git to 
support conflict detection.
multiversion.module 
Revisions are not tracked with a UUID. A hash 
calculated from the actual changes is better. 
This way it's easier for each server to detect 
conflicts without deep inspection or asking the 
network. 
<?php 
md5($this->serialize(array( 
$deleted, 
$sequence_id, 
$old_rev, 
$normalized_entity 
), 'json'));
{ 
id: [{value: 1}], 
uuid: [{value: aabbcc}] 
_revs_info: [ 
{rev: 2-gghhii}, 
{rev: 1-ddeeff} 
], 
_local_seq: 1, 
_deleted: 0, 
} 
multiversion.module
multiversion.module 
CRAP instead of CRUD. 
Entities are never deleted. This is needed in 
order to replicate deletions while also being 
able to handle conflicts. Much like Git. 
A “compaction” job can be run on cron to purge 
old revisions if needed.
<?php 
namespace DrupalmultiversionEntity; 
class SqlContentEntityStorage extends [...] { 
use SqlContentEntityTrait; 
//... 
} 
multiversion.module
<?php 
namespace DrupalmultiversionEntity; 
class SequenceIndex implements SequenceIndexInterface { 
function _construct(KeyValueFactoryInterface $kv) {} 
// ... 
} 
multiversion.module
<?php 
namespace DrupalmultiversionEntity; 
class ConflictManager implements ConflictManagerIf { 
// ... 
} 
class CompactionManager implements CompactionManagerIf { 
// ... 
} 
multiversion.module
relaxed.module 
Provides a Restful/Relaxed JSON API. 
Endpoints for all content entities and file 
attachments. 
Endpoints for comparing revisions, 
starting/stopping replications and other 
administrative tasks. 
Drush plugin for running replications.
<?php 
namespace DrupalrelaxedPluginrestresource; 
/** 
* @RestResource( 
* id = “relaxed:doc” 
* ) 
*/ 
class DocResource extends ResourceBase { 
//... 
} 
relaxed.module
<?php 
namespace DrupalrelaxedPluginrestresource; 
/** 
* @RestResource( 
* id = “relaxed:_bulk_docs” 
* ) 
*/ 
class BulkDocsResource extends ResourceBase { 
//... 
} 
relaxed.module
<?php 
namespace DrupalrelaxedPluginrestresource; 
/** 
* @RestResource( 
* id = “relaxed:_changes” 
* ) 
*/ 
class ChangesResource extends ResourceBase { 
//... 
} 
relaxed.module
<?php 
namespace DrupalrelaxedPluginrestresource; 
/** 
* @RestResource( 
* id = “relaxed:_revs_diff” 
* ) 
*/ 
class RevsDiffResource extends ResourceBase { 
//... 
} 
relaxed.module
deploy.module 
A simple UI to manage replications and 
conflicts
HOW REPLICATION WORKS 
1. Identify source and target by UUID 
2. Get the current checkpoint from target site 
3. GET /_changes?since=N from source site 
4. Pass result to /_revs_diff on target site 
5. Collect all missing revisions from source site 
6. POST /_bulk_docs on target 
7. Save new checkpoint on target site
DEMO
DEMO 
:-(
REUSABLE PROTOCOLS 
The revision and conflict detection model 
is taken from both Git and CouchDB. 
The replication protocol along with the API 
spec is taken from CouchDB.
REUSABLE PROTOCOLS 
Reusing API specifications lends the 
framework to unexpected use cases and 
that otherwise would not be possible 
(CouchDB, PouchDB, TouchDB etc).
HEADLESS DRUPAL 
AngularJS 
PouchDB Replication
CONCLUSIONS 
Not straight port of the Drupal 7 modules. 
Loosely coupled system will cover more 
use cases and lend itself to unexpected 
ones as well. 
Implementing battle tested protocols.
SPECIAL THANKS 
Andrei Jechiu (jeqq on drupal.org 
for working to these modules.
FRIDAY CODE SPRINT 
Follow @drupalmentoring 
https://amsterdam2014.drupal.org/sprints 
Help improve Drupal: Sprint with the community on Friday. 
- We have tasks for every skill set. 
- Mentors are available for new contributors. 
- An optional Friday morning workshop will help you set up 
community tools.
WHAT DID YOU THINK? 
EVAULATE THIS SESSION - AMSTERDAM2014.DRUPAL.ORG/SCHEDULE 
THANK YOU! 
DRUPAL: dixon_ TWITTER: @dickolsson

More Related Content

ODP
Planning for CRAP and entity revisions in Drupal core
ODP
Let's Take Drupal Offline!
PPTX
Take your drupal sites offline
PDF
Tech Webinar: Offline First: Creare un'app Phonegap che funzioni offline e si...
PDF
[drupalday2017] - Drupal come frontend che consuma servizi: HTTP Client Manager
PDF
Apache Sling as an OSGi-powered REST middleware
PDF
Offline first, the painless way
PDF
DrupalGap. How to create native application for mobile devices based on Drupa...
Planning for CRAP and entity revisions in Drupal core
Let's Take Drupal Offline!
Take your drupal sites offline
Tech Webinar: Offline First: Creare un'app Phonegap che funzioni offline e si...
[drupalday2017] - Drupal come frontend che consuma servizi: HTTP Client Manager
Apache Sling as an OSGi-powered REST middleware
Offline first, the painless way
DrupalGap. How to create native application for mobile devices based on Drupa...

What's hot (20)

PDF
Drupal and diversity of Single sign-on systems
PPTX
Javascript Frameworks Comparison
PPTX
PDF
WordPress 2017 with VueJS and GraphQL
PDF
Backbone & React Together Forever
PDF
Understanding Microservices
PPTX
Developing advanced universal apps using html & js
PDF
Put a little Backbone in your WordPress vs. 3
PDF
Backbone.js with React Views - Server Rendering, Virtual DOM, and More!
PDF
Introduction to Meteor - Worldwide Meteor Day
PDF
Effective Web Application Development with Apache Sling
PPTX
Introduction to JS frameworks
KEY
New Perspectives on Performance
PPTX
Put a little Backbone in your WordPress
PPTX
Organized web app development using backbone.js
PDF
Static website generators
PDF
WordPress as the Backbone(.js)
PDF
The Javascript Toolkit 2.0
PPTX
SenchaCon 2016: Building Enterprise Ext JS Apps with Mavenized Sencha Cmd - F...
PDF
With Drupal Your Website is an API
Drupal and diversity of Single sign-on systems
Javascript Frameworks Comparison
WordPress 2017 with VueJS and GraphQL
Backbone & React Together Forever
Understanding Microservices
Developing advanced universal apps using html & js
Put a little Backbone in your WordPress vs. 3
Backbone.js with React Views - Server Rendering, Virtual DOM, and More!
Introduction to Meteor - Worldwide Meteor Day
Effective Web Application Development with Apache Sling
Introduction to JS frameworks
New Perspectives on Performance
Put a little Backbone in your WordPress
Organized web app development using backbone.js
Static website generators
WordPress as the Backbone(.js)
The Javascript Toolkit 2.0
SenchaCon 2016: Building Enterprise Ext JS Apps with Mavenized Sencha Cmd - F...
With Drupal Your Website is an API
Ad

Viewers also liked (20)

PDF
[HKDUG] #20160626 - HKOSCon 2015 - Website DIY with Drupal 8
PDF
What is Drupal? And Why is it Useful? Webinar
PPT
CMS web publishing solution for a travel related website using Drupal
PDF
Developing a Communication & Knowledge management Strategy - my experience at...
PPTX
Building Archivable Websites
PPTX
Drupal Migration
PDF
Migrate
PDF
Staging Drupal 8 31 09 1 3
PDF
Drush 5.0 (DrupalCamp LA 2012) - Chris Charlton
PDF
Moving In: how to port your content from * to Drupal
PPT
Create Website In Indian Languages using drupal
PDF
Recipes for Drupal distributions
PPTX
8 Web Practices for Drupal
PDF
GeorgiaGov's move to Drupal - presentation by Nikhil Deshpande @nikofthehill
PDF
Using Drupal Features in B-Translator
PDF
Moving Drupal to the Cloud
PDF
Drupal in the Cloud with Windows Azure
PDF
The Wonderful World of Drupal 8 Multilingual
ODP
Drupal: My Search for a CMS
PPTX
Data migration to Drupal using the migrate module
[HKDUG] #20160626 - HKOSCon 2015 - Website DIY with Drupal 8
What is Drupal? And Why is it Useful? Webinar
CMS web publishing solution for a travel related website using Drupal
Developing a Communication & Knowledge management Strategy - my experience at...
Building Archivable Websites
Drupal Migration
Migrate
Staging Drupal 8 31 09 1 3
Drush 5.0 (DrupalCamp LA 2012) - Chris Charlton
Moving In: how to port your content from * to Drupal
Create Website In Indian Languages using drupal
Recipes for Drupal distributions
8 Web Practices for Drupal
GeorgiaGov's move to Drupal - presentation by Nikhil Deshpande @nikofthehill
Using Drupal Features in B-Translator
Moving Drupal to the Cloud
Drupal in the Cloud with Windows Azure
The Wonderful World of Drupal 8 Multilingual
Drupal: My Search for a CMS
Data migration to Drupal using the migrate module
Ad

Similar to Content Staging in Drupal 8 (20)

PPTX
We need revisions and CRAP everywhere in Drupal core
PPTX
Workflow Initiative
KEY
Drupal Meetup Lisbon
PPTX
Using deploy in drupal 8
ZIP
Staging and Deployment
PDF
What in store in drupal 8
ODP
Drupal in 5mins + Previewing Drupal 8.x
PDF
High Available Drupal
PDF
Meetup - retour sur la DrupalCon Dublin 2016
PPTX
Decoupling Drupal 8.x: Drupal’s Web Services Today and Tomorrow
PDF
DeCoupling Drupal
PDF
Modernize Your Drupal Development
PDF
Drupal - Changing the Web by Connecting Open Minds - Josef Dabernig
PDF
Decoupling Content Management
PDF
Anna Fedoruk.Theworkflow.DrupalCamp Kyiv 2011
ODP
Hong Kong Drupal User Group - 2014 March 8th
PDF
Drupal, git and sanity
ODP
Drupal Architecture and functionality
PDF
Configuration as Dependency: Managing Drupal 8 Configuration with git and Com...
PDF
Drupal 8.3.0: the features are ready, are you?
We need revisions and CRAP everywhere in Drupal core
Workflow Initiative
Drupal Meetup Lisbon
Using deploy in drupal 8
Staging and Deployment
What in store in drupal 8
Drupal in 5mins + Previewing Drupal 8.x
High Available Drupal
Meetup - retour sur la DrupalCon Dublin 2016
Decoupling Drupal 8.x: Drupal’s Web Services Today and Tomorrow
DeCoupling Drupal
Modernize Your Drupal Development
Drupal - Changing the Web by Connecting Open Minds - Josef Dabernig
Decoupling Content Management
Anna Fedoruk.Theworkflow.DrupalCamp Kyiv 2011
Hong Kong Drupal User Group - 2014 March 8th
Drupal, git and sanity
Drupal Architecture and functionality
Configuration as Dependency: Managing Drupal 8 Configuration with git and Com...
Drupal 8.3.0: the features are ready, are you?

More from Dick Olsson (6)

PDF
Workflow Initiative Update
PDF
What Really Changed with Drupal 8
PDF
Multisite Content Deployments for Media Organizations
ODP
Content Staging in Drupal Core
PPT
How to Build a Scalable Platform for Today's Publishers
ODP
Drupal distributions - how to build them
Workflow Initiative Update
What Really Changed with Drupal 8
Multisite Content Deployments for Media Organizations
Content Staging in Drupal Core
How to Build a Scalable Platform for Today's Publishers
Drupal distributions - how to build them

Recently uploaded (20)

PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Digital Strategies for Manufacturing Companies
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PPTX
Introduction to Artificial Intelligence
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
Understanding Forklifts - TECH EHS Solution
PPTX
Online Work Permit System for Fast Permit Processing
PDF
System and Network Administration Chapter 2
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PPTX
history of c programming in notes for students .pptx
PPTX
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PTS Company Brochure 2025 (1).pdf.......
Upgrade and Innovation Strategies for SAP ERP Customers
Odoo Companies in India – Driving Business Transformation.pdf
How to Choose the Right IT Partner for Your Business in Malaysia
Digital Strategies for Manufacturing Companies
VVF-Customer-Presentation2025-Ver1.9.pptx
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
2025 Textile ERP Trends: SAP, Odoo & Oracle
Introduction to Artificial Intelligence
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Understanding Forklifts - TECH EHS Solution
Online Work Permit System for Fast Permit Processing
System and Network Administration Chapter 2
How to Migrate SBCGlobal Email to Yahoo Easily
Internet Downloader Manager (IDM) Crack 6.42 Build 41
history of c programming in notes for students .pptx
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)

Content Staging in Drupal 8

  • 1. CONTENT STAGING IN DRUPAL 8 DICK OLSSON TWITTER: @dickolsson ADVANCED SITE BUILDING
  • 2. AGENDA What is content staging? What we want from the solution How it's (being) built for Drupal 8 Reusable protocols Headless Drupal
  • 3. WHO AM I? Dick Olsson Digital Engineering Manager at Pfizer dixon_ on drupal.org @dickolsson on Twitter Web technologist Drupal contributor
  • 4. WHAT IS CONTENT STAGING?
  • 6. SECURE PUBLISHING Stage Prod Corporate firewall
  • 7. MERGE WORKFLOW Stage Edit 1 Edit 2 Edit 3 Prod
  • 8. HUB/SPOKE WORKFLOW A D Editorial B C
  • 9. RING MODEL A D B C
  • 10. IT'S SORT OF... Content staging Content sharing Replication Syndication
  • 12. WHAT WE WANT We don't want to build just a “content staging” system. We need a generic and loosely coupled “content replication” framework capable of arbitrarily moving content between system.
  • 13. WHAT WE WANT Learning from the Drupal 7 implementations of UUID, Deploy and WF Tools modules.
  • 14. WHAT WE WANT Revisions everywhere Conflict detection Easier dependency management Ad-hoc / Continuous replication Bi-directional replication REST API
  • 16. HOW IT'S BUILT Contrib: Multiversion Relaxed Web Services Deploy Core: Serialization Restful Web Services Entity API
  • 17. multiversion.module Tracks update sequences in order to make dependency management a lot easier. Provides revision support for all content entities. Tracks revision trees in a way similar to Git to support conflict detection.
  • 18. multiversion.module Revisions are not tracked with a UUID. A hash calculated from the actual changes is better. This way it's easier for each server to detect conflicts without deep inspection or asking the network. <?php md5($this->serialize(array( $deleted, $sequence_id, $old_rev, $normalized_entity ), 'json'));
  • 19. { id: [{value: 1}], uuid: [{value: aabbcc}] _revs_info: [ {rev: 2-gghhii}, {rev: 1-ddeeff} ], _local_seq: 1, _deleted: 0, } multiversion.module
  • 20. multiversion.module CRAP instead of CRUD. Entities are never deleted. This is needed in order to replicate deletions while also being able to handle conflicts. Much like Git. A “compaction” job can be run on cron to purge old revisions if needed.
  • 21. <?php namespace DrupalmultiversionEntity; class SqlContentEntityStorage extends [...] { use SqlContentEntityTrait; //... } multiversion.module
  • 22. <?php namespace DrupalmultiversionEntity; class SequenceIndex implements SequenceIndexInterface { function _construct(KeyValueFactoryInterface $kv) {} // ... } multiversion.module
  • 23. <?php namespace DrupalmultiversionEntity; class ConflictManager implements ConflictManagerIf { // ... } class CompactionManager implements CompactionManagerIf { // ... } multiversion.module
  • 24. relaxed.module Provides a Restful/Relaxed JSON API. Endpoints for all content entities and file attachments. Endpoints for comparing revisions, starting/stopping replications and other administrative tasks. Drush plugin for running replications.
  • 25. <?php namespace DrupalrelaxedPluginrestresource; /** * @RestResource( * id = “relaxed:doc” * ) */ class DocResource extends ResourceBase { //... } relaxed.module
  • 26. <?php namespace DrupalrelaxedPluginrestresource; /** * @RestResource( * id = “relaxed:_bulk_docs” * ) */ class BulkDocsResource extends ResourceBase { //... } relaxed.module
  • 27. <?php namespace DrupalrelaxedPluginrestresource; /** * @RestResource( * id = “relaxed:_changes” * ) */ class ChangesResource extends ResourceBase { //... } relaxed.module
  • 28. <?php namespace DrupalrelaxedPluginrestresource; /** * @RestResource( * id = “relaxed:_revs_diff” * ) */ class RevsDiffResource extends ResourceBase { //... } relaxed.module
  • 29. deploy.module A simple UI to manage replications and conflicts
  • 30. HOW REPLICATION WORKS 1. Identify source and target by UUID 2. Get the current checkpoint from target site 3. GET /_changes?since=N from source site 4. Pass result to /_revs_diff on target site 5. Collect all missing revisions from source site 6. POST /_bulk_docs on target 7. Save new checkpoint on target site
  • 31. DEMO
  • 33. REUSABLE PROTOCOLS The revision and conflict detection model is taken from both Git and CouchDB. The replication protocol along with the API spec is taken from CouchDB.
  • 34. REUSABLE PROTOCOLS Reusing API specifications lends the framework to unexpected use cases and that otherwise would not be possible (CouchDB, PouchDB, TouchDB etc).
  • 35. HEADLESS DRUPAL AngularJS PouchDB Replication
  • 36. CONCLUSIONS Not straight port of the Drupal 7 modules. Loosely coupled system will cover more use cases and lend itself to unexpected ones as well. Implementing battle tested protocols.
  • 37. SPECIAL THANKS Andrei Jechiu (jeqq on drupal.org for working to these modules.
  • 38. FRIDAY CODE SPRINT Follow @drupalmentoring https://amsterdam2014.drupal.org/sprints Help improve Drupal: Sprint with the community on Friday. - We have tasks for every skill set. - Mentors are available for new contributors. - An optional Friday morning workshop will help you set up community tools.
  • 39. WHAT DID YOU THINK? EVAULATE THIS SESSION - AMSTERDAM2014.DRUPAL.ORG/SCHEDULE THANK YOU! DRUPAL: dixon_ TWITTER: @dickolsson