Drupal 8 has made significant improvements towards the ability to stage configuration. But what about content staging? Has it gotten easier in Drupal 8?
This session is targeted towards site builders where we will continue to explore the content staging solution that is being built for Drupal 8 and that was initially presented in Austin. It's a solution that brings vast improvements to sites owners that need to stage or replicate content across sites.
Further, site builders will learn how this solution also applies to broader and sometimes more exciting use cases - content sharing and filtered replication across networks of sites and applications.
The recorded video is available here: https://amsterdam2014.drupal.org/session/content-staging-drupal-8-continued
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'));
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.
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.
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
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).
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.
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