February 26, 2015
A Content Staging Solution for Drupal 8 (and more)
Moving content between different environments is a need for many big companies that have a Drupal site and content that should be created, reviewed, edited and published on different environments. Although Drupal 8 is not yet released, a content staging solution is already in the works. Dick Olsson (dixon_ on drupal.org) and I are working on this solution together and we aim to release an alpha version soon.
The content staging solution for Drupal 8 is based on a re-designed version of the Deploy module. This solution consists of some contrib modules and depends on three Drupal core modules. The core dependencies are Entity API, Serialization and Restful Web Services. The contributed module dependencies are Relaxed Web Services, Multiversion, Key-value Extensions and (soon) Deploy.
The Relaxed Web Services module provides a Restful/Relaxed JSON API and endpoints for entities, file attachments, administrative tasks like revisions comparison, starting/stopping replication, etc. It extends the core REST API with better support for handling UUID references, revisions, file attachments, etc. This module is borrowing the API interface from CouchDB and its Replication API. CouchDB is a NoSQL, document-oriented database.
The Multiversion module provides revision support for all content entities. It also tracks update sequences to make dependency management easier and tracks revision trees (similar to Git) in order to support conflict detection. With Multiversion, entities are never deleted, they are just flagged as deleted. This is needed in order to replicate deletions and for conflict handling.
Key-value Extensions provides an extension of the core key-value API with a backend for lists and sorted sets that you can do range queries on. This module is needed because of the way the Multiversion module stores its sequence indexes. Deploy (will be implemented soon) - provides a simple user interface to manage replication and conflicts.
At the moment, we are using the CouchDB replicator to test content replication between different systems. The CouchDB Replication protocol is a protocol for synchronizing documents between 2 peers over HTTP. This protocol will be used to implement the Replication Web Service module for Drupal 8.
The Replication Web Service module will provide the possibility to replicate content between different systems and Drupal 8, it will also have a Drush plugin for running the replication. Furthermore, it will be possible to run live replications in order to synchronize applications.
By using a standardized HTTP replication protocol for Drupal, such as the one CouchDB is using, the same solution will be applicable to other very interesting use cases as well.
The Offline First principle is quite new in web development, but it has many benefits for users and their experience. A website designed after these principles will continue to work, even if there is no Internet connection available. Now it’s possible to create Offline First applications with Drupal 8! We can build offline applications using the same suite of modules that we introduced earlier. To do this we need a remote database - represented by a Drupal 8 site and a local browser-based database, for example PouchDB.
The content staging suite provides all necessary features, such as synchronization, revisioning and file attachments, to create an offline application. At the moment, it’s working with PouchDB version 3.2.1. I’ve created a video to demonstrate how synchronization between PouchDB and Drupal 8 works.
In Drupal 8, we have integrated the Twig template framework, a very good thing, especially for front-end developers. However, sometimes we want to create an absolutely custom frontend using the power of libraries and frameworks like AngularJS and Hoodie, combined with Drupal 8 on the back-end.
The solution we implement provides a lot more possibilities than the Restful Web Services module from Drupal 8 core. This will make possible to create awesome applications using frameworks like AngularJS, a PouchDB database and Drupal 8.
The content staging suite will have many different use-cases, allow for replication between different systems and database, not just between Drupal sites.
Currently we have test suites for replication between Drupal 8 and CouchDB (using the CouchDB replicator, but later you will be able to use the Replication Web Services module). We also have test suites for replication between Drupal 8 and PouchDB.
In the future, this solution may be used to integrate Drupal 8 with other libraries and frameworks.
For more information, check out: