Configuration Workflow for Drupal 8 Sites

Greg Anderson, Open Source Contributor Reading estimate: 3 minutes

Managing configuration is an extremely important part of any multi-person website project, but in many cases, this area of the project does not receive as much attention as it deserves. The tools that have been available for Drupal 7 do not provide complete coverage of all configuration settings, leading to inconsistencies in configuration handling and inconvenient workarounds. This state of affairs has led to configuration management becoming a real thorn in the side for many projects. Parallel development of different features often results in conflicts between the commits; without an established configuration workflow that allows for merging, many projects suffer from slowdown, either due to explicit policies that limit when and where configuration changes can be made, or the necessity of re-implementing configuration changes in code, or simply due to the awkwardness of a manual merge process that may involve re-doing configuration changes in the admin UI.

With the advent of Drupal 8, much more powerful tools promise to greatly improve this situation. The new configuration management system provides complete and consistent import and export of all configuration settings, and Git already provides facilities for managing parallel work on different branches. When conflicts occur, it is easy—or at least, it is possible—to back out the conflicting changes, take just the version provided in the central repository, or, if neither of these alternatives are appropriate, three-way merge tools such as kdiff3 can be used to examine and manually resolve each difference. A new Drush project, config-extra, includes a config-merge command that streamlines the use of these tools.

Powerful tools can sometimes be difficult to learn and set up, though, and even with tools, a project is going to need to make a plan to manage the configuration workflow. To help projects get started in this area, Pantheon has set up a public repository on GitHub called Drush Config Workflow. This repository contains documentation on a couple of different configuration workflows that can be used during different phases of a project.

The Git configuration workflow describes how to use drush config-merge to export your configuration changes, commit them to Git, push them to the central repository, pull the same changes locally, and then merge them with your local development site’s configuration. All of this is done for you, in a single command.

The rsync configuration workflow allows you to use a similar workflow in situations where you cannot make commits on the remote Drupal site. In these instances, drush config-merge will export changes to a temporary directory, and then rsync them to the local system, where they are committed to a temporary branch in git, and then merged with the local configuration changes.

Additionally, the three-way merge page in this repository describes what to do when the config-merge tool encounters a conflict, and brings up a three-way merge tool such as kdiff3. This tool can considerably reduce the time needed to comprehend and resolve merge conflicts, so it is well worth learning.

Image

Three-Way Merge Page in Drush Config

If you would like to try out any of the example scenarios presented in this repository, there is also a handy installation script provided that will quickly set up a local environment for you to use. It can be used to either clone a Pantheon site locally, or it can create both sites locally. Instructions on how to use the script are detailed on the INSTALL page.

Block out some time, and take the config-merge tool for a spin. Once you get up and running with Drupal 8 development, you might just find that it’s the best time-saver since sql-sync.

Topics

Share

Discover More

Safely Publish to Web from Google Docs with Pantheon Content Publisher

Roland Benedetti (Senior Director, Product) and Zack Rosen (Co-Founder)
Reading estimate: 7 minutes

Unifying Content and Code: Inside Pantheon’s Vision for Content Operations

Chris Yates
Reading estimate: 5 minutes

Where Did All the Drupal 7 Sites Go? They Moved to WordPress

Josh Koenig
Reading estimate: 6 minutes

Try Pantheon for Free

Join thousands of developers, marketers, and agencies creating magical digital experiences with Pantheon.