Image Placeholder

Hosting Multiple Versions of SXC: A simple solution

The other day I installed SXC 9.0.1, i.e. 2018.03-2.1.55, and discovered to my dismay that the following directories of my previous Sitecore 9.1 install had just been deleted and over-written:

  1. CommerceAuthoring_Sc9
  2. CommerceMinions_Sc9
  3. CommerceOps_Sc9
  4. CommerceShopts_Sc9
  5. SitecoreBizFx

Why did this happen? Because the name of these directories does not differ between SXC versions. 

Additionally, there are two databases whose name doesn't change between versions of SXC:

  1. SitecoreCommerce9_SharedEnvironments
  2. SitecoreCommerce9_Global

Therefore innocent developers may very easily destroy previous Sitecore installations.

I've a simple approach to deal with this issue: Create a sub directory under C:\inetpub\wwroot to host your SXC installation.

Following is how I went about it, in my SXC 9.0.1 XP0 installation, but this should work in Sitecore 9.1 as well (I've not had the pleasure to wrestle with the Sitecore 9.2 install yet):

  1. Uninstall your SXP 9.0.1 installation.

  2. Search your SXP 9.0.1 installation directory for "wwwroot". You should find two files:

    1. ./sitecore-XP0.json
    2. ./xconnect-XP0.json

    Each of the above files contains an "Site.PhysicalPath" element:

    // The sites full path on disk"Site.PhysicalPath": "[joinpath(environment('SystemDrive'), 'inetpub', 'wwwroot', parameter('SiteName'))]"
    

To each file, simply add the desired target directory's name to elements' value:

// The sites full path on disk"Site.PhysicalPath": "[joinpath(environment('SystemDrive'), 'inetpub', 'wwwroot', 'MyAwesomeSite', parameter('SiteName'))]"
  1. Run the DeployXP0-9.0.1.ps1 script again.
    When the script completes, you'll see a new directory: C:\inetpub\wwwroot\MyAwesomeSite\ Inside of which your new SXP directories are hosted.
  2. Explode the SIF.Sitecore.Commerce.1.1.4.zip directory
  3. Search the SIF.Sitecore.Commerce.1.1.4 directory for "wwwroot". Here's what I found:
    1. .\Configuration\Commerce\CommerceEngine\CommerceEngine.Deploy.json
    2. .\Configuration\Commerce\CommerceEngine\CommerceEngine.Initialize.json
    3. .\Configuration\Commerce\CEConnect\InitializeCommerce.json
    4. .\Configuration\Commerce\SitecoreBizFX\SitecoreBizFx.json
    5. .\Configuration\Commerce\SitecoreIdentityServer\SitecoreIdentityServer.json
    6. .\Modules\DeployCommerceContent\Deploy-Sitecore-Commerce.ps1
    7. .\Modules\InitializeCommerce\InitializeCommerce.psm1
    8. .\Modules\ManageCommerceService\ManagaeCommerceService.psm1
    9. .\Deploy-Sitecore-Commerce.ps1
  4. In each of the files above, append the name of the wwwroot subdirectory you wish to install to.
    For example, in .\Configuration\Commerce\CEConnect\InitializeCommerce.json, you'll find:

Again, simply add the name of your desired directory:

Append your new directory name after "wwwroot" anywhere you should find it. 7. In the Deploy-Sitecore-Commerce.ps1 script, modify the CommerceServicesDbName and CommerceServicesGlobalDbName values:

  1. CommerceServicesDbName = "MyAwesomeSite_SitecoreCommerce9_SharedEnvironments"
  2. CommerceServicesGlobalDbName = "MyAwesomeSite_SitecoreCommerce9_Global"
  3. If this is not your first SXC install, you'll need to modify the SXC port numbers as well.
    These are defined by the following variables in your SXC install script:
    1. CommerceOpsServicesPort = "5015"
    2. CommerceShopsServicesPort = "5005"
    3. CommerceAuthoringServicesPort = "5000"
    4. CommerceMinionsServicesPort = "5010"
    5. SitecoreBizFxPort = "4200"
  4. Run the Deploy-Sitecore-Commerce.ps1 script again
  5. When the script completes, you'll find your entire SXC installation under C:\wwwroot\inetpub\MyAwesomeSite

Now, if you'll excuse me, I have to reinstall the rest of my local development sites.