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:
- refactored configuration files (stock
App_Config/Include/**
contents was moved toApp_Config/Sitecore
) - pre-configured roles (
App_Config/Sitecore.config
is annotated as well as/App_Config/Sitecore/**
) - search engine support (
Lucene
,Solr
,Azure
) - custom prefixes (you can add as many
something:define="option1"
andsomething:require="option2"
as you want) - layers of configuration via
App_Config/Layers.config
(addedApp_Config/Environment
andApp_Config/Modules
)
Index
Prerequsites
How To
- Install NuGet Package
- Replace Include Configuration Files
- Deploy
- Update web.config files
- Verify if it works
Details
Comments
Prerequsites
- Sitecore CMS 8.1 rev. 160302 (Update-2)
- Sitecore CMS 8.1 rev. 160302 (Update-3)
- Sitecore CMS 8.2 - all releases
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:
- Sitecore 8.1 Update-3 - configuration/8.1.3
- Sitecore 8.2 Initial Release - configuration/8.2.0
- Sitecore 8.2 Update-1 - configuration/8.2.1
- Sitecore 8.2 Update-2 - configuration/8.2.2
- Sitecore 8.2 Update-3 - configuration/8.2.3
- Sitecore 8.2 Update-4 - configuration/8.2.4
- Sitecore 8.2 Update-5 - configuration/8.2.5
- Sitecore 8.2 Update-6 - configuration/8.2.6
- Sitecore 8.2 Update-7 - configuration/8.2.7
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:
- navigate to the
/sitecore/admin/showconfig.aspx
page of theContentDelivery
instance - make sure that the definition of the
sitecore_master_index
index configuration element is not presented on the page
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:
- Standalone
- ContentManagement
- Reporting
- Processing
- ContentDelivery
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.
- SRV-01: Standalone
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.
- SRV-01: ContentManagement|Processing|Reporting
- SRV-02: ContentDelivery
EXAMPLE 3 Here is an example of Sitecore solution with 5 Sitecore instances, one content-management only, one processing and reporting and 3 delivery.
- SRV-01: ContentManagement
- SRV-02: Processing|Reporting
- SRV-03: ContentDelivery
- SRV-04: ContentDelivery
- SRV-05: ContentDelivery