Home

Awesome

Sitecore Configuration Roles

This document describes how to configure a Sitecore instance to use one of the pre-defined server roles. After you install a Sitecore instance, the only changes you need to make are to install the module and update settings that define which server role it will have.

Available in Sitecore 9.0 out-of-box

This project has become deprecated since Sitecore 9.0.0 release, which offers same functionality with extra benefits such as:

Index

Prerequsites
How To
  1. Install NuGet Package
  2. Replace Include Configuration Files
  3. Deploy
  4. Update web.config files
  5. Verify if it works
Details
  1. Define Role Command
  2. Require Role Command
  3. Modified configuration files
Comments

Prerequsites

In this project Sitecore configuration engine was extended with two simple commands and modified configuration files that use them. It is distributed as a module which is based on the Sitecore CMS 8.1 rev. 160302 (Update-2) which now allows patching configuration engine.

How to

1. Install NuGet Package

Install the Sitecore.Configuration.Roles NuGet package:

PS> Install-Package Sitecore.Configuration.Roles

Alternatively, you can download it here and unpack to the bin folder.

2. Replace Include Configuration Files

Replace default Sitecore configuration files in App_Config/Include folder with annotated ones.

Delete entire contents of App_Config/Include folder (except DataFolder.config file and your custom files) and replace with files from one of the branches:

Go through your custom configuration files and annotate configuration nodes that must be presented only in certain kind of instances.

For example, the item saved event handlers in Customization.config file to be used only in the ContentManagement environment:

 <configuration xmlns:role="http://www.sitecore.net/xmlconfig/role/">
    <sitecore role:require="ContentManagement">
      <events>
        <event name="item:saved" role:require="ContentManagement">
          <handler type="Website.Class1, Website" method="OnItemSaved" />

3. Deploy

Deploy the files to both ContentManagement and ContentDelivery Sitecore instances:

App_Config/Include/**/*
bin/Sitecore.Configuration.Roles.dll

4. Update web.config files

Change web.config files of ContentManagement and ContentDelivery Sitecore instances so they are aware of their role.

ContentManagement

  ...
  <configSections>
    <section name="sitecore" type="Sitecore.Configuration.Roles.RoleConfigReader, Sitecore.Configuration.Roles" />
    ...
  </configSections>
  <appSettings>
    ...
    <add key="role:define" value="ContentManagement" />
  </appSettings>
  ...

ContentDelivery

  ...
  <configSections>
    <section name="sitecore" type="Sitecore.Configuration.Roles.RoleConfigReader, Sitecore.Configuration.Roles" />
    ...
  </configSections>
  <appSettings>
    ...
    <add key="role:define" value="ContentDelivery" />
  </appSettings>
  ...

5. Verify if it works

(Optional) Verify actual configuration:

Details

1. Define Role Command

The role:define command defines pipe-separated list of configuration roles the given Sitecore instance has.

The role name can be any string that matches the [a-zA-Z0-9]+ pattern, however there are several commonly used conventional role names to use:

These roles are described below.

Example

<configuration>
  ...
  <appSettings>
    ...
	   <add key="role:define" value="ContentManagement|Processing|CustomFeature1" />
  </appSettings>
  ...
</configuration>

2. Require Role Command

When role:require command is applied to a XML configuration node within Sitecore include config file the node will be ignored if the boolean expression is false. When the expression is evaluated, every configuration role that is defined by the role:define command is being transformed into "true" and all undefined role names are transformed into "false" condition.

3. Modified configuration files

The module is shipped with modified stock configuration files to make Sitecore pre-configured to serve each of these configuration roles.

Standalone

Defines Standalone role that is the same as Sitecore pre-configured out of box. It allows only single-server set up.

ContentManagement

Defines Content Management (CM) role that allows editors to use editing applications like Content Editor, Page Editor etc.

Reporting

Defines xDB Reporting (Rep) role that fetches reporting data from various data sources to use in Sitecore reporting applications. It can be enabled on the same instance with other roles or on a dedicated Sitecore instance.

Processing

Defines xDB Processing (Proc) role. It can be enabled on the same instance with other roles or on a dedicated Sitecore instance.

ContentDelivery

Defines Content Delivery (CD) role that assumes current Sitecore instance is accessed only by end-users and Sitecore administrators. It cannot be enabled on the same instance with other roles.

Examples

EXAMPLE 1 Here is an example of Sitecore solution with single Sitecore instance.

EXAMPLE 2 Here is an example of Sitecore solution with 2 Sitecore instances: one is multipurpose, another is delivery only - both serve front-end users.

EXAMPLE 3 Here is an example of Sitecore solution with 5 Sitecore instances, one content-management only, one processing and reporting and 3 delivery.