Version Control and Configuration Management

Last updated on
17 October 2018

Drupal 7 will no longer be supported after January 5, 2025. Learn more and find resources for Drupal 7 sites

In a typical Drupal development situation, a developer will work locally and push code and files to a remote server. In this setup, version control is crucial. What happens if a mistake is made and we need to roll back the code? What if multiple people are working on the same code? Implementing version control with a tool such as Git is a critical step in solving these common development workflow challenges.

Often, there are multiple remote servers set up to correspond with the various stages in the development cycle. For example, remote environments often include a "Dev" server used for development, a "Staging" server for staging content, and a "Production" server for publishing the finished product. Moving code between these environments while maintaining version control best practices is relatively easy; pull from the remote code repository to sync your local environment to the latest remote version, develop locally, then push code and files to the remote server to be merged with the remote version. Using a product like Acquia Cloud further simplifies this process, providing a drag-and-drop interface to move code, files, and databases between the different development servers.

While version control for code is adequate for many types of sites, Drupal sites store much of their most important information in a relational database rather than in code, making version control a bit trickier. Content, content types, views, and most other information set through the browser front end are all stored in the database. While version controlled code can be reverted to a previous state in the case of an accidental mishap, overwriting content in a database is permanent. It is therefore generally considered bad practice to push a database from a local server to a remote server; there is no way to undo the damage of accidentally overwriting content in the database that you had not intended to update or delete. Through version control, the Features module can provide a safer option for moving some data from a local environment to a remote environment.

Configuration management presents another challenge to building and maintaining Drupal sites. Because much of the most important information in a Drupal site is stored in the database, not in code, replicating the settings of a locally developed Drupal site in remote development environments is not nearly as straightforward as copying files from one location to another. Features can allow you to quickly store and re-create specific configuration settings from one site to another.

Version Control for Site Configuration

Site configurations are controlled almost exclusively through the frontend admin UI. Modules are switched on and off to add or remove functionality; content types are built to customize the information architecture; taxonomies are created to categorize data; views are built to filter and display structured data; and roles and permissions are set up to control user access to content and authoring controls. The upside to this is that site builders can often build complex, highly functional websites and applications without touching the backend code. The downside to controlling site configuration through the frontend is that it usually requires dozens of switches, checkboxes, radio buttons, text fields, and advanced settings to be configured in a very specific way through the UI. This takes a great deal of time and is subject to human error which can be problematic when, for example, a site builder wants to recreate a specific configuration from a sandbox environment in a development environment. All of these changes are stored in the database, not code, and are therefore not subject to version control. This is the type of problem that features can solve.

In summary, building a site in Drupal presents some unique challenges for managing site configuration and version control. As with most things in Drupal, there are many ways to skin a cat. For managing site configuration and version control, however, the Features module can often be the right tool for the job.

Help improve this page

Page status: No known problems

You can: