THIS IS ARCHIVED DOCUMENTATION

Configuring Coveo for Sitecore With the Legacy Sitecore Azure Module

This article describes how an administrator can configure Coveo for Sitecore to work with the Sitecore Azure module.

Even if Coveo for Sitecore can run in such a setup, be aware that it’s not an officially supported use of the product.

Configuring the Deployment Manager

The Deployment Manager (DM) is responsible for maintaining the delivery farm within Azure. Follow these steps to complete the prerequisites for the farm:

  1. Read Understanding Coveo for Sitecore Infrastructure With the Legacy Sitecore Azure Module.

  2. Install and configure the Sitecore instance that you will use as the Deployment Manager (DM).

  3. Install Coveo for Sitecore on the Deployment Manager (see Installing Coveo for Sitecore).

  1. Read Understanding Coveo for Sitecore Infrastructure With the Legacy Sitecore Azure Module.

  2. Install and configure the Sitecore instance that you will use as the Deployment Manager (DM).

  3. You should have installed and configured an Azure cloud service with the following Coveo back-end components:

    1. Coveo Enterprise Search (CES)

    2. Coveo Admin Service

    3. Coveo Search API

    4. RabbitMQ

  4. Install Coveo for Sitecore on the Deployment Manager (see Installing Coveo for Sitecore).

Unlike the Sitecore on-premises environments with Content Manager (CM) and Content Delivery (CD) instances, the files used by Coveo for Sitecore don’t need to be copied manually to every CM and CD instance. When deploying to Windows Azure, the Sitecore Azure module takes care of copying the files to the other instances.

Performing the Initial Indexing

Once Coveo for Sitecore has been installed and configured on the Deployment Manager (DM), it’s time to build the indexes for the first time.

The initial build creates various resources in CES, such as the sources, fieldsets, security provider, and user identity.

  1. In the Coveo.SearchProvider.Custom.config file, set the farm name (see Assigning a Farm Name to Coveo for Sitecore Resources)

  2. If not done already, publish the whole site to the web database.

  3. Rebuild the indexes (see Coveo for Sitecore Indexing Guide).

At this point, every Sitecore item should have been indexed by CES. You can validate that the index contains the expected documents using the CES Administration Tool.

At this point, every Sitecore item should have been indexed by the Coveo Platform. You can validate that the index contains the expected documents using the Coveo Cloud Content Browser.

Preparing Configuration for CDs

The following steps requires that you edit and add nodes to the Coveo Search Provider configuration files. Always make such changes in the Coveo.SearchProvider.Custom.config file. Don’t modify the Coveo.SearchProvider.config as this file is overwritten during the upgrade process and all changes will be lost.

Now that the DM instance is working, the configuration files can be modified to allow CDs to be deployed (see Coveo for Sitecore Scaling Guide).

Step 1: Creating the CD Farm

  1. Open the Sitecore Azure management panel.

  2. Select Development [Staging] or Development [Production] from the Environment Type dropdown menu. A dialog window should present a world map showing the available datacenters.

  3. Click a datacenter to see farms or to create new ones.

    Here is the datacenter color code:

    Gray: No farm in the datacenter.

    Blue: A farm exists, but the site isn’t deployed yet.

    Yellow: Site is being deployed.

    Green: Site has been deployed successfully.

    Red: An error occurred or the cloud service is suspended.

  4. Deploy a Delivery farm. You can expect the deployment to last anywhere between 10 and 15 minutes for a cloud-based deployment manager or 30 to 40 minutes for an on-premises DM.

Step 2: Creating a New Index for the CDs Database

Since the deployment manager can be installed on-premises, the CDs won’t share the same databases as the DM. When deploying the CDs, the core and web databases are copied in the cloud and become Azure databases in the process. Then, a publishing target is added to the DM, allowing content authors to publish new content directly to the delivery farm.

In the previous step, you added a new database for the CDs. However, there are no indexes configured to crawl its content. A new search index definition must be added to the DM configuration file.

  1. Find the CDs database name:

    1. Open the App_config/ConnectionStrings.config file.

    2. Find the database entry that matches the delivery farm.

    3. Copy the database name from the name attribute.

  2. Edit the Coveo.SearchProvider.Custom.config file.

    1. Duplicate the Coveo_web_index index definition.

    2. Update the index name. For example, you can set it to Coveo_web_cd_index.

    3. Update the database name in both the crawler and strategy elements.

    4. The new index definition should look like this.

       <index id="Coveo_web_cd_index" type="Coveo.SearchProvider.ProviderIndex, Coveo.SearchProvider">
         <param desc="p_Name">$(id)</param>
         <configuration ref="coveo/defaultIndexConfiguration" />
         <locations hint="list:AddCrawler">
           <crawler type="Coveo.SearchProvider.CoveoItemCrawler, Coveo.SearchProviderBase">
             <database>the_Azure_database_name</database>
             <root>/sitecore/content</root>
             <stopOnError>true</stopOnError>
           </crawler>
           <crawler type="Coveo.SearchProvider.CoveoItemCrawler, Coveo.SearchProviderBase">
             <database>the_Azure_database_name</database>
             <root>/sitecore/media library/files</root>
             <stopOnError>true</stopOnError>
           </crawler>
         </locations>
         <strategies hint="list:AddStrategy">
           <strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/onPublishEndAsync"/>
         </strategies>
         <propertyStore ref="contentSearch/indexConfigurations/databasePropertyStore" param1="$(id)"/>
       </index>
      
  3. Rebuild the new index.

Step 3: Freezing the Source Name for the CD

The last thing left to do is to ensure that the CD instances will target the search index that was added in the previous step. This is an important step, as the search index content must match the Sitecore instance content. If a CD instance uses a content database and a search index tied to another database, then it might return wrong results or even break the whole site.

On the deployment server, there are the following databases and indexes:

Database
Search index
master Coveo_master_index
web Coveo_web_index
the_Azure_database_name Coveo_web_cd_index

However, the CD instances are slightly different from the DM. Not only do they not have the master database, but their web database targets an Azure database instead of the original web database.

What you want for the CD is to have a Coveo_web_index that uses the same Coveo source as the DM. In other words, the source name must be explicitly set on the CM to match the source created for the Coveo_web_cd_index on the DM. To do so, you can use a Sitecore include file to alter the SourceName setting. It’s possible to add include files that are applied only when deploying Azure farms. Include files should work as usual.

When deploying the instance, the Sitecore Azure module simplifies the configuration files by merging all the include files together as usual. Then, it breaks the whole configuration element into smaller include files again. This means that the settings that were set in a specific file on the DM are in another file on the CDs. For example, the settings defined in the Coveo.SearchProvider.config and Coveo.SearchProvider.Custom.config files are moved to contentSearch.config in the CD package.

There’s also a special folder that must be used to apply specific settings when deploying a farm to Azure. The folder location is C:\inetpub\\wwwroot\<your Sitecore instance>\Website\AzureOverrideFiles. As the folder name suggests, files put into this folder override the website files.

Here is a sample file showing you how to set the source name of the Coveo_web_index for the CDs.

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <contentSearch>
      <configuration type="Coveo.SearchProvider.Configuration.CoveoSearchConfiguration, Coveo.SearchProvider">
        <indexes hint="list:AddIndex">
          <index id="Coveo_web_index" type="Coveo.SearchProvider.ProviderIndex, Coveo.SearchProvider">
            <strategies hint="list:AddStrategy">
              <patch:delete />
            </strategies>
            <sourceName>Source name for the_Azure_database_name</sourceName>
          </index>
          <index id="Coveo_master_index" type="Coveo.SearchProvider.ProviderIndex, Coveo.SearchProvider">
            <patch:delete />
          </index>
          <index id="Coveo_web_cd_index" type="Coveo.SearchProvider.ProviderIndex, Coveo.SearchProvider">
            <patch:delete />
          </index>
        </indexes>
      </configuration>
    </contentSearch>
  </sitecore>
</configuration>

When deploying a delivery farm, the Sitecore Azure module generates an Azure package in the sitecore instance\Data\AzurePackages folder. You might want to verify the package content to ensure that the effective CD configuration matches the expected configuration.

At this point, the delivery farm can be safely deployed to target the right index source. Publishing to the CDs database will also rebuild the appropriate search index, keeping the search results synchronized with the CDs content.

Preparing Configuration for CDs

The following steps requires that you edit and add nodes to the Coveo Search Provider configuration files. Always make such changes in the Coveo.SearchProvider.Custom.config file. Don’t modify the Coveo.SearchProvider.config as this file is overwritten during the upgrade process and all changes will be lost.

Now that the DM instance is working, the configuration files can be modified to allow CDs to be deployed (see Coveo for Sitecore Scaling Guide).

Step 1: Creating the CD Farm

  1. Open the Sitecore Azure management panel.

  2. Select Development [Staging] or Development [Production] from the Environment Type dropdown menu. A dialog window should present a world map showing the available datacenters.

  3. Click a datacenter to see farms or to create new ones.

    Here is the datacenter color code:

    Gray: No farm in the datacenter.

    Blue: A farm exists, but the site isn’t deployed yet.

    Yellow: Site is being deployed.

    Green: Site has been deployed successfully.

    Red: An error occurred or the cloud service is suspended.

  4. Deploy a Delivery farm. You can expect the deployment to last anywhere between 10 and 15 minutes for a cloud-based deployment manager or 30 to 40 minutes for an on-premises DM.

Step 2: Updating the Hostnames

Since the CD doesn’t reside in the same cloud service as CES, it’s mandatory that host names are correctly set. You need to edit the Coveo.SearchProvider.custom.config to update the paths included in the following nodes:

  1. Open Coveo.SearchProvider.custom.config in your preferred text editor.
  2. Change the following paths:
    1. Locate the <adminServiceConfiguration> node, in the <adminServiceURI>, change the path to match the location of the Admin Service:

       <adminServiceUri>https://<ADMIN_SERVICE_HOST_NAME>/AdminService</adminServiceUri>
      
    2. Locate the defaultIndexConfiguration node, in the queueUri node, change the path to match the location of RabbitMQ:

        <queueUri>amqp://<RABBITMQ_HOST_NAME>/</queueUri>
      
  3. Add the following paths:
    1. Locate the defaultIndexConfiguration node, and add the following lines under the node:

       <searchServiceUri>https://<CES_SEARCH_SERVICE_HOST_NAME>:52810/7.0/CoveoSearchService</searchServiceUri>
       <serverUrl>http://<SITECORE_HOST_NAME></serverUrl>
      

Step 3: Creating a New Index for the CDs Database

Since the deployment manager can be installed on-premises, the CDs won’t share the same databases as the DM. When deploying the CDs, the core and web databases are copied in the cloud and become Azure databases in the process. Then, a publishing target is added to the DM, allowing content authors to publish new content directly to the delivery farm.

In the previous step, you added a new database for the CDs. However, there are no indexes configured to crawl its content. A new search index definition must be added to the DM configuration file.

  1. Find the CDs database name:

    1. Open the App_config/ConnectionStrings.config file.

    2. Find the database entry that matches the delivery farm.

    3. Copy the database name from the name attribute.

  2. Edit the Coveo.SearchProvider.Custom.config file.

    1. Duplicate the Coveo_web_index index definition.

    2. Update the index name. For example, you can set it to Coveo_web_cd_index.

    3. Update the database name in both the crawler and strategy elements.

    4. The new index definition should look like this.

       <index id="Coveo_web_cd_index" type="Coveo.SearchProvider.ProviderIndex, Coveo.SearchProvider">
         <param desc="p_Name">$(id)</param>
         <configuration ref="coveo/defaultIndexConfiguration" />
         <locations hint="list:AddCrawler">
           <crawler type="Coveo.SearchProvider.CoveoItemCrawler, Coveo.SearchProviderBase">
             <database>the_Azure_database_name</database>
             <root>/sitecore/content</root>
             <stopOnError>true</stopOnError>
           </crawler>
           <crawler type="Coveo.SearchProvider.CoveoItemCrawler, Coveo.SearchProviderBase">
             <database>the_Azure_database_name</database>
             <root>/sitecore/media library/files</root>
             <stopOnError>true</stopOnError>
           </crawler>
         </locations>
         <strategies hint="list:AddStrategy">
           <strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/onPublishEndAsync"/>
         </strategies>
         <propertyStore ref="contentSearch/indexConfigurations/databasePropertyStore" param1="$(id)"/>
       </index>
      
  3. Rebuild the new index.

Step 4: Freezing the Source Name for the CD

The last thing left to do is to ensure that the CD instances will target the search index that was added in the previous step. This is an important step, as the search index content must match the Sitecore instance content. If a CD instance uses a content database and a search index tied to another database, then it might return wrong results or even break the whole site.

On the deployment server, there are the following databases and indexes:

Database
Search index
master Coveo_master_index
web Coveo_web_index
the_Azure_database_name Coveo_web_cd_index

However, the CD instances are slightly different from the DM. Not only do they not have the master database, but their web database targets an Azure database instead of the original web database.

What you want for the CD is to have a Coveo_web_index that uses the same Coveo source as the DM. In other words, the source name must be explicitly set on the CM to match the source created for the Coveo_web_cd_index on the DM. To do so, you can use a Sitecore include file to alter the SourceName setting. It’s possible to add include files that are applied only when deploying Azure farms. Include files should work as usual.

When deploying the instance, the Sitecore Azure module simplifies the configuration files by merging all the include files together as usual. Then, it breaks the whole configuration element into smaller include files again. This means that the settings that were set in a specific file on the DM are in another file on the CDs. For example, the settings defined in the Coveo.SearchProvider.config and Coveo.SearchProvider.Custom.config files are moved to contentSearch.config in the CD package.

There’s also a special folder that must be used to apply specific settings when deploying a farm to Azure. The folder location is C:\inetpub\\wwwroot\<your Sitecore instance>\Website\AzureOverrideFiles. As the folder name suggests, files put into this folder override the website files.

Here is a sample file showing you how to set the source name of the Coveo_web_index for the CDs.

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <contentSearch>
      <configuration type="Coveo.SearchProvider.Configuration.CoveoSearchConfiguration, Coveo.SearchProvider">
        <indexes hint="list:AddIndex">
          <index id="Coveo_web_index" type="Coveo.SearchProvider.ProviderIndex, Coveo.SearchProvider">
            <strategies hint="list:AddStrategy">
              <patch:delete />
            </strategies>
            <sourceName>Source name for the_Azure_database_name</sourceName>
          </index>
          <index id="Coveo_master_index" type="Coveo.SearchProvider.ProviderIndex, Coveo.SearchProvider">
            <patch:delete />
          </index>
          <index id="Coveo_web_cd_index" type="Coveo.SearchProvider.ProviderIndex, Coveo.SearchProvider">
            <patch:delete />
          </index>
        </indexes>
      </configuration>
    </contentSearch>
  </sitecore>
</configuration>

When deploying a delivery farm, the Sitecore Azure module generates an Azure package in the sitecore instance\Data\AzurePackages folder. You might want to verify the package content to ensure that the effective CD configuration matches the expected configuration.

At this point, the delivery farm can be safely deployed to target the right index source. Publishing to the CDs database will also rebuild the appropriate search index, keeping the search results synchronized with the CDs content.