Prepare the Sitecore Content Manager for a Scaled Environment
Prepare the Sitecore Content Manager for a Scaled Environment
Once you correctly built the whole Sitecore infrastructure, you may proceed to configure Coveo for Sitecore on your main Content Manager (CM1).
Step 1: Configuring the pub Database Search Index
In the Sitecore Scaling Guide, a database named pub
was added to Sitecore. Although adding a database isn’t mandatory, it’s highly recommended by Sitecore.
To index a new database, you must add a new index definition.
- On
CM1
, in theApp_Config\Include\Coveo
folder of your Sitecore instance, open theCoveo.SearchProvider.Custom.config
file. -
Inside of your
sitecore
node, create acontentSearch/configuration/indexes
element with ahint
attribute like this:<sitecore> <contentSearch> <configuration> <indexes hint="list:AddIndex"> </indexes> </configuration> </contentSearch> </sitecore>
- On
CM1
, open theCoveo.SearchProvider.config
file located in theApp_Config\Include\Coveo
folder for Sitecore 7 and 8 sites or in theApp_Config\Modules\Coveo
folder for Sitecore 9 sites. -
Find the
index
element that corresponds to theweb
database. The element should look like this:<index id="Coveo_web_index" type="Coveo.SearchProvider.ProviderIndex, Coveo.SearchProvider" patch:before = "*[2]"> ... </index>
- Select and copy the whole element, from
<index...>
to</index>
. -
In the
Coveo.SearchProvider.Custom.config
file, paste it before the</indexes>
element.You shouldn’t modify the
Coveo.SearchProvider.config
file directly, as it may cause unexpected upgrade issues and loss of configuration. - Apply the following changes to the element that you have just pasted.
-
Change the value of the
id
attribute toCoveo_pub_index
. The element should now look like this:<index id="Coveo_pub_index" type="Coveo.SearchProvider.ProviderIndex, Coveo.SearchProvider" patch:before = "*[2]">
-
Increment the number in the
patch:before
attribute value. The element should now look like this:<index id="Coveo_pub_index" type="Coveo.SearchProvider.ProviderIndex, Coveo.SearchProvider" patch:before = "*[3]">
-
Set all the
index/locations/crawler/database
elements value topub
. There should be at least two elements to update. The elements should now look like this:<database>pub</database>
-
Replace the
<strategy ref="contentSearch/indexUpdateStrategies/onPublishEndAsync"/>
node with the following nodes:<strategy name="OnPublishEndAsyncPub" type="Sitecore.ContentSearch.Maintenance.Strategies.OnPublishEndAsynchronousStrategy, Sitecore.ContentSearch" > <param desc="database">pub</param> <!-- Whether a full index rebuild should be triggered when the number of items in the EventQueue exceeds the number specified in ContentSearch.FullRebuildItemCountThreshold. --> <CheckForThreshold>true</CheckForThreshold> </strategy>
-
For Sitecore 9 deployments only, you need to ensure this
<strategy>
element is disabled on CD servers by applying the following rule based patch.- Select and copy the whole element, from
<strategy...>
to</strategy>
. - Paste the copy immediately below the original
<strategy>
element. -
Edit the second
<strategy>
element to obtain the following result:<strategy name="OnPublishEndAsyncPub" type="Sitecore.ContentSearch.Maintenance.Strategies.OnPublishEndAsynchronousStrategy, Sitecore.ContentSearch"> <param desc="database">pub</param> <!-- Whether a full index rebuild should be triggered when the number of items in the EventQueue exceeds the number specified in ContentSearch.FullRebuildItemCountThreshold. --> <CheckForThreshold>true</CheckForThreshold> </strategy> <strategy role:require="ContentDelivery" name="OnPublishEndAsyncPub" type="Sitecore.ContentSearch.Maintenance.Strategies.ManualStrategy, Sitecore.ContentSearch"> <param desc="database"> <patch:delete /> </param> <!-- Whether a full index rebuild should be triggered when the number of items in the EventQueue exceeds the number specified in ContentSearch.FullRebuildItemCountThreshold. --> <CheckForThreshold> <patch:delete /> </CheckForThreshold> </strategy>
- Select and copy the whole element, from
-
-
In your
sitecore
node, add the following element. This synchronizes the Top Results from yourpub
database.<scheduling> <agent name="CoveoSynchronizeTopResults"> <DatabasesToSynchronize>master;web;pub</DatabasesToSynchronize> </agent> </scheduling>
Coveo for Sitecore (June 2016)
Execute this step only for the April 2016 release. Skip this step for June 2016 and later releases.
Now that you have the
pub
index, the Coveo for Sitecore agents need to be updated.-
Locate the
sitecore/scheduling
element. It should look like this:<scheduling> <agent name="CoveoSynchronizeTopResults"> <patch:delete /> </agent> </scheduling>
-
Add a section for the
CleanUpAfterRebuildAgent
agent to specify to clean up the pub index as well:<scheduling> <agent name="CoveoSynchronizeTopResults"> <patch:delete /> </agent> <agent type="Coveo.CloudPlatformClient.Agents.CleanUpAfterRebuildAgent, Coveo.CloudPlatformClient"> <indexesToCleanUp>Coveo_master_index;Coveo_web_index;Coveo_pub_index</indexesToCleanUp> </agent> </scheduling>
-
- Save and close the files.
Step 2: Rebuilding the Search Index for the pub
Database
The pub
database is now properly configured and can be indexed by Coveo for Sitecore. Follow these steps to index its content:
- Log into the Sitecore Desktop.
- Access the Indexing Manager (Sitecore Start Menu > Control Panel > Indexing > Indexing Manager).
- Select the
Coveo_pub_index
index and choose Rebuild. Depending on the number of Sitecore items to index, this task may take several minutes to complete. - Choose Finish when the indexing is completed. The content of the
pub
database is now indexed.
Your Sitecore items are indexed with clickable URI values matching a hostName
value assigned to your Content Management instance. However, the clickable URI is also computed whenever a Coveo-powered search interface receives search results from the index to ensure that the intended Content Delivery instance is hit whenever a website visitor clicks a search result.
Step 3: Configuring the Server URL on the Instance to Be Scaled
Coveo for Sitecore (October 2016)
As of the October 2016 release of Coveo for Sitecore, you don’t need to configure the server URL, as the Expanded Security Provider handles the securities for you (see Upgrading to the Expanded Security Provider).
When scaling Sitecore instances, you need to ensure that the <serverUrl>
element value is the same on all the instances and is set to the public URL of the Sitecore instances farm. In general, it should be the public URL of the content management instances network load balancer (NLB). The server URL is used by the on-premises Sitecore Security Provider to call the Sitecore instances. It also affects the clickable URI of the indexed and queried Sitecore items.
Follow these steps to configure the CM1
instance:
- Open your
Coveo.SearchProvider.Custom.config
file. - Inside
coveo
/defaultIndexConfiguration
, add a node calledserverUrl
. -
Set the public URL of the Sitecore farm in plain text in the node. Remember to add the URL scheme (http or https).
<defaultIndexConfiguration> ... <serverUrl>http://PublicSitecoreFarmUrl/</serverUrl> </defaultIndexConfiguration>
- Save and close the file. Your server URL is now set.
Step 4: Configuring the UseHostHeaderForRequestURL
Setting
Under the hood, Coveo for Sitecore performs HTTP requests on its own. To ensure that these internal HTTP requests are targeting the expected endpoint, the aspnet:UseHostHeaderForRequestUrl
setting must be set properly (see ASP.NET appSettings Element for details).
The aspnet:UseHostHeaderForRequestUrl
setting must be set to true
when the Sitecore instance is deployed behind a network load balancer (NLB). Omitting this setting may cause URL-resolving issues.
Follow these steps to configure the setting on the CM1
instance:
- Open your
web.config
file. -
Inside
configuration
/appSettings
, add the following element:<add key="aspnet:UseHostHeaderForRequestUrl" value="true" />
- Save and close the file.
Step 5: Configuring the Farm Name on the Instance to Be Scaled
When scaling Sitecore instances, you need to set a farm name to ensure all the Sitecore instances share the same resources. Setting a farm name affects the names of the sources, field sets, security provider, and user identities. Instead of assigning them an individual name, you give them the same label. Follow the Assigning a Farm Name to Coveo for Sitecore Resources guide to configure the CM1
instance.
When choosing a Farm Name different from the CM1
host name, you must rebuild your Coveo indexes (see Coveo for Sitecore Indexing Guide). Some resources, like the sources, need to be rebuilt to apply the name change. Skipping the rebuild would cause naming inconsistencies that would prevent queries and components from reaching the right resources.
What’s Next?
Now that you installed Coveo for Sitecore on your first Content Manager, you may proceed either to:
-
Deploy Coveo for Sitecore on an additional Content Manager (see Deploying on Additional Content Managers).
OR
-
Deploy Coveo for Sitecore on your Content Delivery server(s) (see Deploying Coveo for Sitecore on the Content Delivery Servers).