Drupal 8 and configuration management: a file-based approach

Oct 11, 2016
Drupal 8 and configuration management: a file-based approach

Mobile-friendliness, multilingual miracles, lightning-like editing, unmatched accessibility, a top-notch HTML5 markup… With all this, and much more, it looks like dreams really do come true with Drupal 8! A little bit of magic, and a lot of the effort from the tireless Drupal community, has made another dream of Drupal developers a reality by addressing the issue of moving your configuration between your website’s environments.

“Carry” your configuration by using files

Working with different environments of your site (known as “development,” “staging” and “production”) requires an exchange of data between them. This is the way to keep them all synchronized and updated.

Sometimes you may make changes to your configuration settings. These include content types, fields, module settings and states, taxonomy vocabularies, menus and much more — actually everything that can be configured in the dashboard and is not related to content. In this case, you should “take” these changes along with you to another environment, and the most efficient way to move it is by saving it in files, rather than the database.

Configuration Management System

A file-based approach to managing your configuration is very clean and professional. And this is exactly the approach that underlies the Drupal 8 configuration management system. Facilitating your dev-live and live-dev workflows was one of D8's goals and the focus of Drupal 8's Configuration Management Initiative (CMI).

The successfully new configuration management system saves you time and lets you easily track your changes and apply version control.

The essence of the process: your configuration settings are exported to YAML files from one environment’s database, then deployed on another and imported to its database.

This provides handy UI for your work. You can also use Drush commands for the configuration import and export. It’s also possible to make the process automated.

The Features module and its secrets

Before the configuration management system was created, the Features module was often used to manage configuration, though it was not its main purpose. It is likely that this module, improved now in Drupal 8, will still be used by some developers due to its more advanced options.

For example, the CMI is only meant for “delivering” configuration from one instance of the same site to another, that is, their UUID values must match. The Features modules enables working with different sites.

It also lets you better structure a big amount of configuration. Instead of having your configuration settings in lots of different YAML files, you can have it all grouped into “feature packages.” The Features module will allow you to do this on the basis of analyzing their dependencies.

To wrap up

So, this is a quick look at the philosophy of file-based configuration. Use it to your benefit, and if you need any assistance with your website, you can always rely on Drudesk support service.

 Get new blog posts by email