# Rule-based configuration

Abstract

Sitecore uses rule-based logic to control when configuration settings are applied.

Rule-based configuration allows you to quickly set up a role without having to manually enable and disable individual configuration files. Rule-based configuration values are set in the web.config file.

Sitecore comes with the following predefined rule definitions:

• Role, which determines which Sitecore role or roles the instance runs.

• Search, which determines the search provider Sitecore is optimized for.

To set up Sitecore to perform a particular server role, for example, all you must do is change the value of the role definition.

This topic describes:

## The role rule definition

The role definition determines the server role. Sitecore ships with the following pre-configured server roles:

### Description

ContentManagement

Enables content editors to create and publish content to a website.

ContentDelivery

Processing

Extracts information from captured, raw analytics data and transforms it into a form suitable for use in reporting applications.

Reporting

Fetches reporting data from various data sources, such as the collection and reporting databases, to use in Sitecore reporting applications, for example, Experience Analytics.

Standalone

A single Sitecore instance performing all server roles.

### Note

Rule-based configuration does not support the indexing, publishing, and email dispatch server roles. You must configure these roles manually.

The values are not case sensitive. However, it is best practice to use the names as they are written in the table. The following example shows the Sitecore instance configured to fulfill the content management role only:

<add key="role:define" value="ContentManagement" />

The default value is Standalone. A standalone installation fulfills all Sitecore server roles and performs all functionality. This is not an optimal configuration for a production environment, because you cannot optimize the instance for a particular server role. Furthermore, the only way to scale the instance is to add hardware to the server that hosts the instance.

You can improve performance and scalability by adding more servers and assigning them different server roles.

### Combining roles

You can host two or more server roles on one Sitecore instance; however, we only recommend this for a specific set of combinations. The following example shows the Sitecore instance configure to fulfill the xDB Processing and xDB Reporting roles:

<add key="role:define" value="Processing,Reporting" />

### Note

You can only combine the content management and content delivery functionality on one server by using the Standalone configuration. This setup is not recommended in a production environment.

## The search rule definition

The search definition determines which Content Search provider Sitecore is optimized for. Sitecore ships with the following preconfigured definitions for search:

• Solr

• Lucene

• Azure

Solr is the default value when you use the Sitecore Installation Framework to install Sitecore. Azure is the default value when you use the Sitecore Azure Toolkit to install Sitecore.

The values are not case sensitive. However, it is best practice to use the names for the values as they are written above. The following example shows the Sitecore instance configured to use Solr as search provider:

<add key="search:define" value="Solr" />

### Important

The xDB index is part of the xConnect Search framework, not the Content Search framework. The xConnect search provider is unaffected by the search:define property and must be configured separately.

## Custom rules

To control settings in your Sitecore installation, you can define your own custom rules. For example, you can add a custom rule that specifies whether the Sitecore instance is part of a test environment or a production environment. You can then apply environment-dependent settings on each Sitecore instance by testing the value of the custom rule on that instance.