5

I have a newly setup XP1 Sitecore 9.0 environment. It has single core, master and web databases currently.

I’m looking to create a new publishing target/CD server for staging/UAT.

I’ve seen various posts on how to create the target entry in the content editor, but it’s not totally clear if I need a new database for each target..

Do I need to create a new webUAT database as a copy of existing web database, and configure my new CD server to use this? Or does it share existing web database? Would I have a new entry in connection strings for webUAT on the CM?

1

2 Answers 2

16

Scenario

Let's say you need create a second publishing target called staging.

Steps

  • Publishing Target

You need to create an item for the new database in the content tree at the path /sitecore/system/Publishing targets. Then in the field Target Database, you enter the name like staging.

  • Database

Now, you need also to create a new database. You can just duplicate the web database and rename it. Example, from Sitecore_Instance_Web to Sitecore_Instance_Staging.

Note that you need to clear the EventQueue, PublishQueue table of the newly created database.

  • Config File

You need to create a patch for the newly created database. Below is an example of the patch you can used

<?xml version="1.0" encoding="UTF-8"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <databases>
      <database id="staging" singleInstance="true" type="Sitecore.Data.DefaultDatabase, Sitecore.Kernel">
        <param desc="name">$(id)</param>
        <icon>Images/database_web.png</icon>
        <securityEnabled>true</securityEnabled>
        <dataProviders hint="list:AddDataProvider">
          <dataProvider ref="dataProviders/main" param1="$(id)">
            <disableGroup>publishing</disableGroup>
            <prefetch hint="raw:AddPrefetch">
              <sc.include file="/App_Config/Prefetch/Common.config" />
              <sc.include file="/App_Config/Prefetch/Webdb.config" />
            </prefetch>
          </dataProvider>
        </dataProviders>
        <proxiesEnabled>false</proxiesEnabled>
        <proxyDataProvider ref="proxyDataProviders/main" param1="$(id)" />
        <archives hint="raw:AddArchive">
          <archive name="archive" />
          <archive name="recyclebin" />
        </archives>
        <cacheSizes hint="setting">
          <data>100MB</data>
          <items>50MB</items>
          <paths>2500KB</paths>
          <itempaths>50MB</itempaths>
          <standardValues>2500KB</standardValues>
        </cacheSizes>
      </database>
    </databases>
  </sitecore>
</configuration>
  • Connection String

You need to add the new database to the connectionString.config as follows

<add name="staging" connectionString="user id=sa;password=Asdcxz1++;Data Source=(local),10044;Database=Sitecore_Instance_Staging"/>

Apart from the above, you need to see into the indexing strategy for the database upon a publishing. That is, you may have a custom strategy for rebuilding indexes when publishing to staging database. Example of the patch config will be as shown below

<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <contentSearch>
      <indexConfigurations>
        <indexUpdateStrategies>
          <onStagePublishEndAsync type="Sitecore.ContentSearch.Maintenance.Strategies.OnPublishEndAsynchronousStrategy, Sitecore.ContentSearch">
            <param desc="database">staging</param>
            <CheckForThreshold>true</CheckForThreshold>
          </onStagePublishEndAsync>
        </indexUpdateStrategies>
      </indexConfigurations>
    </contentSearch>
  </sitecore>
</configuration>

Then in your index you make use of it within the strategies tag as shown below

<strategies hint="list:AddStrategy">
  <strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/onStagePublishEndAsync" />
</strategies>
2
  • when adding the index update strategy should it be done on both CM and CD? or just the CM server? and if only on the CM what should the strategy be for the index config file on CD?
    – Muradious
    Commented Dec 9, 2018 at 13:18
  • 1
    If you are using the strategy on both CM and CD, then yes you should add the patch on both servers. Commented Dec 9, 2018 at 17:22
0

Your question is bit confusing, In any case if you want to add new publishing target then you have to have replica of you web DB.

If you want to configure 2 CD server which points to 2 different Web DBs say Web and WebUAT respectively, then your CM connection string config will have 2 connection string, one is for Web(Sitecore's default) and another for WebUAT(Replica of Web), than you need to create new publishing target item at /sitecore/system/Publishing targets, You can duplicate the existing target item and update the connection string name. That is all you need to do to add new publishing target.

There are many other points you can take in consideration like search index for the new publishing target and so on, which are based on your purpose to create the new publishing target.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.