Install Sitecore Commerce 9.2

Sitecore Commerce provides end-to-end commerce system and highly integrated with Sitecore to leverage the analytics and marketing features. Sitecore has replaced the Commerce Server with a .Net core Commerce Engine. While we will go through the various features of commerce in later posts, this post talks about the installation of Sitecore commerce with all its associated services. Before we proceed I assume you have gone through the Installation of Sitecore 9 with SXA and SOLR. Now we will install commerce on top of previous vanilla Sitecore installation.

Pre Requisites

Sitecore Commerce Requires Basic Sitecore installation with following enabled. If you do not have the Sitecore Installation, please visit the previous post.

  1. Sitecore 9.2 installed with SXA.
  2. Sitecore Powershell Extension.
  3. SOLR 7.5 with Https enabled

Required Softwares

  1. Sitecore Commerce Installation. (Sitecore.Commerce.WDP.2019.07-4.0.165)
  2. MsBuild nuget package. (msbuild.microsoft.visualstudio.web.targets.14.0.0.3.nupkg)
  3. .NET Core SDK 2.1.7
  4. Redis ( https://github.com/microsoftarchive/redis/releases/download/win-3.0.504/Redis-x64-3.0.504.msi)

Installation Steps

Before procedding to Sitecore Commerce installation, ensure 

  1. prerequisites are met 
  2. Install .Net Core SDK and Redis.
  3. UnZip the Sitecore commerce package to "c:\deploy\commerce"
  4. You will find lots of zip files. Unzip the SIF.Sitecore.Commerce.3.0.28.zip file.
  5. Rename the Nuget Package to *.zip
  6. Unzip the content to a folder within "c:\deploy\commerce",like c:\deploy\commerce\msbuild.microsoft.visualstudio.web.targets.14.0.0.3

Step 1: Update Setup Script

Sitecore Commerce uses PowerShell script to automate the installation process, However, we must update the script with parameters w.r.t. our local instance. Go to the unzipped folder c:\deploy\commerce\SIF.Sitecore.Commerce.3.0.28. You will find the PowerShell script Deploy-Sitecore-Commerce.ps1. Before we make changes to the script, make a copy of the file for reference. Open the file in any text editor and update the following parameters accordingly.

ParamValueExample
$SiteNamePrefixSiteprefix provided during sitecore installationsc92
$SiteNamesitecore site hostnamesc92sc.dev.local
$IdentityServerSiteNameSitecore Identity Server hostnamesc92identityserver.dev.local
$skipInstallDefaultStorefronttrue if you want to install default storefront site
$SqlUsersql usersa
$SqlPasssql user password
$XCInstallRootunzipped folder path where all zip files are presentD:\deploy\setup
InstallDirSitecore installation directoryC:\inetpub\wwwroot\sc92sc.dev.local
XConnectInstallDirxconnect installation directoryC:\inetpub\wwwroot\sc92xconnect.dev.local
CommerceInstallRootCommerce installation rootC:\inetpub\wwwroot\
CommerceServicesDbServerDB ServerDESKTOP-6F0E19Q\\SQLEXPRESS
SitecoreDbServerDB ServerDESKTOP-6F0E19Q\\SQLEXPRESS
SitecoreCoreDbNameCore DB Name
SolrUrlSolr URLhttps://localhost:8983/solr
SolrRootSolr root folderC:\Solr\solr-7.5.0\solr-7.5.0
SolrServiceSolr service namesolr
RedisInstanceNameRedis service nameRedis
RedisInstallationPathRedis installation pathC:\Program Files\Redis
SitecoreDomainSitecore domain to loginSitecore
SitecoreUsernameSitecore user to loginadmin
SitecoreUserPasswordSitecore user passwordb

Review all other parameters to make sure all variables are correct. Any mistake here will create a lot of issues during installation.


Step 2: Restart Identity Server

Sitecore Commerce talks to the Identity server for authentication and authorization. So during the installation, it will update the identity server configuration to add a new client to make API calls. So, we must restart the app pool of the identity server site BUT DO NOT BROWSE THE SITE. If the site is browsed IIS will lock the files for modification and it will fail during installation. DO NOT STOP THE APPPOOL, as instal script will access the site post updating the configuration.

Step 3: Execute Script

Towards the end of Deploy-Sitecore-Commerce.ps1, you will find the install script. Open PowerShell in admin mode navigate to the folder c:\deploy\commerce\SIF.Sitecore.Commerce.3.0.28. Execute the following commands.

 Set-ExecutionPolicy Unrestricted

In the prompt provide All.

 .\Deploy-Sitecore-Commerce.ps1

 The process will execute and install Sitecore commerce. 




Once the installation completed we can browse http://sxa.storefront.com.


Troubleshooting

Many times when we install the Sitecore Commerce it fails in the first attempt. Let's understand a few common errors and how to rectify.
  1. Understand the Installation Json Files. Review all the parameters again. Majority of installation Issues are due to all parameter and properties are not carefully reviewed.
  2. Make sure all the pre requisites (Software/Hardware/Windows features) are installed.
  3. Review the Installation log file for the detailed error.
  4. Make sure IdentityServer IIS site's apppool is recycled and site is not browsed. As part of installation it will add a client configuration to the Identity Server and call its APIs.
  5. One of the common error we get, when the installation process will do an IISSTOP for the sitecore site, but unable to start it. To address this start the apppool manually and rerun installation script.

for #5 we will see the error message ike,

Install-SitecoreConfiguration: The service cannot accept control messages at this time. (Exception
from HRESULT: 0x80070425) At C:\Program Files\WindowsPowerShell\Modules\SitecoreInstallFramework
\2.1.1\Public\Install-SitecoreConfiguration.ps1:641
Before rerun the installation script make sure,
  1. In the Deploy-Sitecore-Commerce.ps1, update the log file name. Else it will overwrite previous logfile.
    Install-SitecoreConfiguration @params -Verbose *>&1 | Tee-Object "$PSScriptRoot\XC-Install.log XC-Install_1.log
  2. If as part of deployment, db changes are made. you can uninstall and start installation again. update the same script and replace the Install-SitecoreConfiguration command with following,
    UnInstall-SitecoreConfiguration @params -Verbose *>&1 | Tee-Object "$PSScriptRoot\XC-UnInstall.log"