Upgrade Your Drupal Skills

We trained 1,000+ Drupal Developers over the last decade.

See Advanced Courses NAH, I know Enough

Content Staging With Drupal Deploy Module

Parent Feed: 

There might be instances where an editorial team comes across challenges in the process of publishing its content. These include:

  1. Living a number of articles at the same time.
  2. Sending the final copy of approval on a website to different people but not living it. 
  3. Publishing a number of articles on different websites/subdomains. 

Luckily, the Drupal Deploy module allows content staging and publishing without the user requiring to log into the target site. This is very handy when there are a number of people involved or multiple sites, in case of media and publishing websites especially.

top view of five hands fists bumping

What is Content Staging?

Content Staging is an in-house development environment where a team is involved in creating various kinds of content. This includes all the stages a piece of content has to go through before actually going to the production site. 

Exploring Drupal Deploy Module

The Deploy module allows users to easily stage and preview content for a Drupal site in different environments. The module automatically manages dependencies between entities and is designed to have a rich API which can easily be extended to use in a variety of content staging situations.

It allows: 

  • Cross-site content staging

To stage content between different Drupal sites.

  • Single-site content staging

Provide a workspace preview system for single-site content staging.

  • Fully decoupled site

Create a decoupled Drupal site.

The Deploy module is designed to allow users to easily stage content from one Drupal site to another.

How To Use Drupal Deploy Module?

Installation

Deploy module has various Drupal and PHP dependencies so the best way to install it, is by using composer.

composer require 'drupal/deploy:^1.0'

Exploring Deploy Suite

Once we run this command in our Drupal website we get all the modules and PHP libraries required to run the Deploy suite. Let’s have a quick look at all of the modules: 

  • Conflict: It provides resolution for conflicts which merge due to changes in translatable fields in non-edited content entity translations, changes in fields to which the user does not have access, fields with no edit access, fields not part of the entity form display, changes in entity metadata, revision ID, changed timestamp.
     
  • Key-value Extensions: A very important module which helps in speeding up the Deployment process. It extends the core key-value API with a backend for lists and sorted sets that you can do range queries on.
     
  • Multiversion: Multiversion will convert all core content entities on your site to be revisionable. Since Deploy suite is built around the revisionable entities, it is an important module in the process of Deployment.
     
  • Replication: This module provides the functionality and services to assist with replicating content between workspaces on a single site (using the Workspace module) or between workspaces across different sites (using the Relaxed Web Services module).
     
  • Workspace: Provides the ability to have multiple workspaces on a single site to facilitate things like the full-site preview and content staging.

Single-Site Content Staging

The Distributed Management of Content deals with the workflow involved in the content creation with a decentralized approach. The process can be very complicated and requires different levels of managerial checks. Deploy module, in that case, can turn out to be the best solution.

To use the Deploy content staging we have to enable the Deploy module which automatically installs all the required contributed modules, perform database operations and supply required default configurations for the modules.

To use Deploy it is worthwhile to check its out-of-the-box configurations and plan Deployment strategy for your website, accordingly.

  1. Go to Admin  Structure Workspace to check the workspaces provided by default. This becomes important later during the content transition stages. Admin interface of workspace with different owner, type, and statusWe have a Live and stage workspace and also functionality to add more of the workspaces as per our requirement. By default, the Live workspace is active and Stage inactive. It means that all the content added will be available on the Live Workspace.

    We also have an ability to set target workspaces on content updation as well which content entities to replicate.
     

  2. Following settings can also be accessed via admin toolbar on any page of the website. To continue with the deployment process, go ahead and select ‘Stage’ as the active environment from workspace switch option in the admin toolbar.admin interface with stage highlighted in the admin toolbar
  3. Now since we are currently on Stage workspace, all the content added will only be visible to those with access to View content in a particular workspace.
     
  4. Go ahead and add 10 articles via Node → Add → Article interface. As soon as all the articles are added they start appearing on Homepage for the user with access to the content. If we check website anonymously we won’t be able to see any of those articles and will get a 'Page Not Found' error. 

    At this particular time, all the content editors and stakeholders can have a look at the content, modify it or even remove it. 
     

  5. To deploy all articles on Live workspace go to Admin → Structure → Deployment  Start New Deployment.admin interface to deploy stage to live Provide a Deployment title and a description to keep a track record of all the Deployments.

Once we Deploy to Live, all the articles are available on the Live workspace after the next cron run.

Advantages

  1. Publish multiple articles at the same time, without accessing them individually. 
     
  2. Deploy provides various kinds of permission such as Access content on a particular workspace.
     
  3. It also detects for changes done on the Live workspace directly and provides an interface for conflict resolution and content synchronisation between various workspaces.
     
  4. You can create workspaces as per your requirement, For example, providing workspace for each content editor and then comparing the overall impact. Based on that you can very easily deploy content from various workspaces to the Live Workspace.

Cross-Site Content Staging  

Deploy module can be used with the Relaxed module to extend all the capabilities of Deploy suite for multiple websites. We can configure as many remotes as we want and then Deploy content on various websites.

  • Relax module can also be installed via composer using the following command.
composer require 'drupal/relaxed:^1.0'
  • After enabling the module, the relaxed remote endpoint can be configured from Admin → Config → Relaxed → Settings.admin interface of relaxed web services settings This endpoint will be used by the remote websites to interact with the workspaces available in your local.
     
  • To interact with remote endpoints they have to be configured in Admin → Config → Services → Relaxed → Add.admin interface of add remote
  • Once you have set up the Remote, you can then Deploy content to remote workspaces as well.

Drupal allows Distributed Content Management strategy to be applied to large volumes of content to facilitate efficient workflow. Specifically, the system allows different content and editors to be part of the same system without much replication, and Deploy module just helps build the architecture right.

Author: 
Original Post: 

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web