Warning message

Documentation is currently being migrated into the new system. Some pages might be temporary missing, and some guides might appear empty. Thank you for you patience while we are improving Drupal.org documentation.

Managing configuration in Drupal 8

Last updated on
August 10, 2016 - 19:42

For Drupal 7, see https://www.drupal.org/node/1861064

Drupal 8 has a whole new configuration system to store configuration data in a consistent manner. All of your site configuration from enabled modules through fields, contact categories to views, are stored with this system. The system is designed to make it much easier than prior Drupal versions to make changes, export site configuration to files, and import those changes back into the site.

The Configuration Manager module in Drupal 8 provides a user interface for importing and exporting configuration changes between a Drupal installation in different environments, such as Development, Staging and Production, so you can make and verify your changes with a comfortable distance from your live environment.

This allows you to deploy a configuration from one environment to another, provided they are the same site. The site is identified using a Universally Unique Identifier (UUID). The site UUID must match the target site to allow any importing of configuration files on that site.

Configuration files

Default configuration shipped with modules, distributions, and themes is imported into the active configuration store when the respective projects are enabled. So the active configuration store is the complete set of live configuration at any given time.

The active configuration is stored in the database by default.

Importing, exporting, and synchronizing configuration

Making configuration changes on the live site is often not the best idea. The goal of the configuration system in Drupal 8 is to make it easy to take a copy of the site configuration, and set up a development site where you make changes. After changes are made, importing the development configuration back into the live site is also made simple.

With the Configuration Manager module (config) enabled, you can import, export, and synchronize configuration in your site via Manage > Configuration > Development > Configuration Synchronization (admin/config/development/configuration).

Configuration can be synchronized as individual configuration objects with a copy/paste workflow. This is useful if, for example, you wanted to just move a newly created view from one environment to another.

Configuration can also be synchronized as a full export wherein the entire configuration of a site is synchronized between environments.

Synchronizing configuration only works if you're moving configuration between two copies of the same site. Like a developers copy of the site used for testing new configuration and the live production site where you would like the new changes to appear.

There are a few different ways that you can perform a full configuration synchronization, including:

The configuration manager can also be used to review changes before importing them to ensure the changes are correct.

Once the synchronization is completed, all the changes will be made, such as new modules being enabled, or new fields, content types, etc. being added. In short all configuration changes made on the development site are now live on the production site.

More Information

If you're looking for more in-depth information about the Configuration Management system in Drupal 8, you can check the handbook pages for Configuration API.

Do's and Don'ts

DO'S

  • It's strongly recommended that you do a database-dump before each synchronization of the staging and the active directory. The database-dump "could save your life" on a potential needed rollback-strategy.

DON'TS

  • Try to change the active configuration on your site by changing files in a module's config/install directory. This will NOT work because Drupal will only read from that directory when the module is installed.