There might be instances where an editorial team comes across challenges in the process of publishing its content. These include:
- Living a number of articles at the same time.
- Sending the final copy of approval on a website to different people but not living it.
- 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.
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.
- 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.
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?
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.
- Go to Admin → Structure → Workspace to check the workspaces provided by default. This becomes important later during the content transition stages. We 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.
- 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.
- 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.
- 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.
- To deploy all articles on Live workspace go to Admin → Structure → Deployment → Start New Deployment.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.
- Publish multiple articles at the same time, without accessing them individually.
- Deploy provides various kinds of permission such as Access content on a particular workspace.
- It also detects for changes done on the Live workspace directly and provides an interface for conflict resolution and content synchronisation between various workspaces.
- 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.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.
- 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.