Prepare the Sitecore Content Manager for a Scaled Environment
Prepare the Sitecore Content Manager for a Scaled Environment
- Step 1: Configuring the pub Database Search Index
- Step 2: Rebuilding the Search Index for the
pubDatabase - Step 3: Configuring the Server URL on the Instance to Be Scaled
- Step 4: Configuring the
UseHostHeaderForRequestURLSetting - Step 5: Configuring the Farm Name on the Instance to Be Scaled
- What’s next?
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\Coveofolder of your Sitecore instance, open theCoveo.SearchProvider.Custom.configfile. -
Inside of your
sitecorenode, create acontentSearch/configuration/indexeselement with ahintattribute like this:<sitecore> <contentSearch> <configuration> <indexes hint="list:AddIndex"> </indexes> </configuration> </contentSearch> </sitecore> -
On
CM1, open theCoveo.SearchProvider.configfile located in theApp_Config\Include\Coveofolder for Sitecore 7 and 8 sites or in theApp_Config\Modules\Coveofolder for Sitecore 9 sites. -
Find the
indexelement that corresponds to thewebdatabase. 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.configfile, paste it before the</indexes>element.You shouldn’t modify the
Coveo.SearchProvider.configfile 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
idattribute 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:beforeattribute 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/databaseelements 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>
-
-
-
In your
sitecorenode, add the following element. This synchronizes the Top Results from yourpubdatabase.<scheduling> <agent name="CoveoSynchronizeTopResults"> <DatabasesToSynchronize>master;web;pub</DatabasesToSynchronize> </agent> </scheduling>Execute this step only for the April 2016 release. Skip this step for June 2016 and later releases.
Now that you have the
pubindex, the Coveo for Sitecore agents need to be updated.-
Locate the
sitecore/schedulingelement. It should look like this:<scheduling> <agent name="CoveoSynchronizeTopResults"> <patch:delete /> </agent> </scheduling> -
Add a section for the
CleanUpAfterRebuildAgentagent 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_indexindex 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
pubdatabase is now indexed.Your Sitecore items are indexed with clickable URI values matching a
hostNamevalue 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
|
|
Note
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.configfile. -
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).
|
|
Note
The |
Follow these steps to configure the setting on the CM1 instance:
-
Open your
web.configfile. -
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 |
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 servers (see Deploying Coveo for Sitecore on the Content Delivery Servers).