Mark Frost Discuss Sitecore 9
Feature

Taming Sitecore's Configuration Chaos

4 minute read
Ryan Bennett avatar

Smokey, this is not 'Nam. This is bowling. There are rules.  

—Walter Sobchak (in The Big Lebowski)

LAS VEGAS — One of the most frustrating aspects of managing Sitecore is dealing with its long and chaotic configuration process. 

Learning Opportunities

In recent releases, especially, the sheer number of configuration files has grown and grown. This combined with the mix-and-match nature of how you make updates (i.e., directly in the files, in patch files, using transforms, using their own separate config files and so on) made managing Sitecore configuration the Wild West. Unlike bowling, there were no rules.

Now, in Sitecore 9, the company has finally decided to apply some long-needed adult supervision, and it’s great. There are rules now, literally.
 

This gem was tucked away in the modestly titled “Upgrading to Sitecore 9” session at Sitecore Symposium 2017 (#SitecoreSYM). For a Sitecore tech geek like me, this was a major revelation. Sitecore configuration in most implementations has been a mix of customized Sitecore files, Sitecore patch files and a number of custom files, mixed in with the multitude of Sitecore’s out-of-the-box configuration files. Especially in a multi-tiered architecture, managing configuration has been difficult.

With Sitecore 9, however, the company has gone back to basics and redesigned configuration management with organization, simplicity and real-world business requirements in mind. Here are some of the changes:

Configuration Roles and Rules

Managing configuration in a typical multi-system environment is key. The settings you want available on your front-end content delivery nodes may not be ones you  want on your internal content management system, for example. Generally, this has been handled with scripts, hand-edits or multiple sets of configuration files. Now, Sitecore has provided a standard set of roles for the following:

  • ContentManagement
  • ContentDelivery
  • Processing
  • Reporting
  • Standalone

In addition to the roles Sitecore provides, you may need to create your own. For example, you would likely want roles for your implementation environments, like EnvPROD, EnvQA and so on.  After all, a given system can have multiple roles. An installation might be in QA (EnvQA) and be a Content Management system (ContentManagement).

The roles above can be combined with a variety of standard rules as well:

  • AND - “ContentManagement AND EnvPROD” Apply this setting to a content management system, but only if it’s in the production environment.
  • OR - “Standalone OR ContentManagement” Apply this setting to Standalone or Content Management.
  • NOT - “!ContentManagement” Apply this setting to every system except Content Management.
  • Grouping - “ContentDelivery AND (EnvQA OR EnvPROD)” Apply this setting to every Content Delivery system, but only when deployed to QA or PROD environments.

These roles, combined with a straightforward rules syntax, allow you to do things like the following:

<setting name="Counters.Enabled" role:require="ContentManagement OR ContentDelivery">

  <patch:attribute name="value">false</patch:attribute>

</setting>

Above we’re showing both the roles and rules feature for changing a value for a standard Sitecore setting. In this case, leaving Counters enabled on an active system that’s not in testing is a performance issue, so I added a role requirement to disabled that in my ContentManagement OR my ContentDelivery environment. This formulation can be applied to any setting in any of Sitecore’s configuration files.

Layering

We won’t get into the details here, another great feature is the capability to tell Sitecore the order to load (or layer) configuration files. Depending on how your configuration is configured, the order of loading can impact the final result. Loading something too early or too late can break your expected configuration. In prior Sitecore releases, files were loaded alphabetically, which resulted in admins resorting to clever file-naming schemes to get loading right. Now there’s no guesswork. You tell Sitecore the order you want and that’s that.

Administration

Sitecore’s done a good job of integrating new administration functionality. The Sitecore installer allows you to choose role settings at the start. The standard Sitecore ShowConfig tool has several new options allowing you to preview and test the new options and display how the configuration would look for each role or role combination.

It’s been a long time coming, but these Sitecore 9 updates are a big step forward in making Sitecore administration simpler, more predictable and more organized.

About the author

Ryan Bennett

Ryan Bennett is a web content management and web engagement solutions architect. He is the co-founder of San Francisco-based consulting firm Cylogy, Inc.