Page 13 of 21

Sitecore Commerce 10 Create a custom plugin project

If you want to get started and create a custom plugin for XC 9.3 here is the post for same First Steps | Sitecore Commerce Development | Create a Custom Plugin

There are few updates on how the plugins are created in XC 10.

Sitecore Commerce 10 SDK does not include Visual Studio Extension (VSIX) package for creating a plugin project.

Let’s get started and look into the steps to create a new plugin in Sitecore Commerce 10. If you have already set up your commerce development environment, please skip to step 2

Step 1 – Setup developer environment

Create a developer environment for Sitecore Commerce to run the engine from Visual Studio, can be either VS 2017 or 2019. Follow this blog post for same Setup development environment for Sitecore Commerce 10 Engine

Step 2: Download Sitecore.Commerce.Plugin.Template from Nuget Feed

  • Navigate to Official Sitecore Commerce Nuget Feed
  • Search for Sitecore.Commerce.Plugin.Template
  • Download the package for Sitecore.Commerce.Plugin.Template 6.0.4. Copy to file Sitecore.Commerce.Plugin.Template.6.0.4.nupkg desired folder.

3. Install Sitecore Commerce Plugin Template Nuget Package

  • Open Powershell in admin mode and navigate to the folder nupkg file is copied and execute following command to install package
dotnet new -i .\Sitecore.Commerce.Plugin.Template.6.0.4.nupkg
  • Run the dotnet new command and should be able to see Sitecore Commerce Sample Plugin template

4. Create a new Sitecore Commerce Plugin Project

As we have a plugin project template we should be able create a new plugin project.

Execute following command in Powershell. Navigate to the solution src folder-

dotnet new pluginsample -o Sitecore.Commerce.Plugin.SampleTest

New plugin project is created with the project name specified in command.

Include the project in Customer.Sample.Solution and compile.

Notice even though the command has project name “Sitecore.Commerce.Plugin.SampleTest” the actual project is created as “Sitecore.Commerce.Plugin.Sample”. You will have to rename this unfortunately as per your requirement.

Sharding Custom Entity in Sitecore Commerce 10

Sharding is horizontal partitioning of data in database. It is the process of breaking up large tables into smaller chunks.

Storing rows of the same table in multiple database nodes

In this blog post will see how to split the Commerce Entities table having same structure but store custom entity data in a separate table that helps to split the load that a CommerceEntities table might take if the horizontal partition is not done.

Why partioning of tables is required?

Sitecore Commerce entity data are store in following tables-

  • CommerceEntities
  • CommerceEntity
  • CommerceLists

Any custom entity been created without sharding will store data by default in tables mentioned above.

What if that data increases, there might be a performance hit once the data start expanding over months and years.

Also it wont be good idea to put the multiple custom entity data into a single table. As this might give a performance hit whilst indexing table. So, if you know data might increase over the time it is better to have it saved in a separate table as it can be a boon to high-volume data.

Partitioning data using sharding policy

I assume you know how extend Sitecore Commerce entities. Consider we have a “Organization” entity. Business Tools helps in capturing details of Organization i.e. CRUD operations. When the entity is been saved it has to be saved in different table.

This driven by the sharding policies in Commerce.

Follow these steps to enable sharding of custom entity-

Sharding Policies

The Commerce Engine implements database sharding for Commerce entity and list tables, and provides 2 types of sharding policies. One is for the operation against Commerce entities i.e. EntityShardingPolicy, and other on the Commerce lists i.e. ListShardingPolicy.

Configuration for sharding policy is kept in PlugIn.SQL.Sharding.PolicySet-1.0.0.json file and can be found in data\Environments folder of the Authoring and Shops instance.

As per Sitecore documentation sharding policies has expressions and multiple expression values can be configured based on this the table of the entity is identified to read and perform write operations. This is a bit contrary statement as the table name defined in policies are passed to the stored procedure based on this the data in table is written and read.

Below sharding policy mentions 2 tables-

OrganizationsLists for managing and reading lists of Organizations

OrganizationsEntities for managing and reading Organization entities

{
"$type": "Sitecore.Commerce.Plugin.SQL.ListShardingPolicy, Sitecore.Commerce.Plugin.SQL",
"Expressions": {
"$type": "System.Collections.Generic.List1[[System.String, mscorlib]], mscorlib",
"$values":
[
"^List-Organization.*?$"
]
},
"TableName": "OrganizationsLists"
},
{ 
"$type": "Sitecore.Commerce.Plugin.SQL.EntityShardingPolicy, Sitecore.Commerce.Plugin.SQL",
"Expressions": {
"$type": "System.Collections.Generic.List1[[System.String, mscorlib]], mscorlib",
"$values":
[
"^Entity-Organization.?$",
"^Organization-.?$"
]
},
"TableName": "OrganizationsEntities"
}

Database

To save data in different tables create Entities, Entity and Lists table prefixed with entity name in SitecoreCommerce_SharedEnvironments database

  1. Right click CommerceEntities table select Script Table as option, Create to and then New Query Editor Window. Create script for CommerceEntities table will be generated.
  2. Change the name of table to e.g.:- OrganizationsEntities. Also change the table name to set Default value to EntityVersion and Published fields
  3. Pasrse and check if you are creating a table in correct Database
  4. Execute the script. New table will be created.

Follow same for CommerceEntity table to create OrganizationsEntity and CommerceLists to create OrganizationsLists

So there are 3 tables created so far-

  • OrganizationsEntities
  • OrganizationsEntity
  • OrganizationsLists

Once you have your plugin to perform CRUD operations on Organizations entity you should be able to see the data been inserted in OrganizationEntities, OrganizationLists and OrganizationsEntity table instead of CommerceEntities and there related tables.

Asp.Net Core – Route Constraints

Routing constraints lets you restrict how the parameters in the route template are matched. It helps to filter out the input parameter and action method can accept.

For example if the URL Parameter is restricted to have int value, the route engine will match the controller action having integer value in the parameter or restrict.

How Route Constraints are applied-

  1. Using constraint parameter in the MapControllerRoute at the application startup where the endpoints are defined i.e. Inline Constraint
  2. Route attribute at the controller or action method
endpoints.MapControllerRoute(
name: "default",
pattern: "controller=Home}/{action=Index}/{id:int?}");

Route engine when matches the incoming url, it invokes the routing constraint to the the values in the url matches the pattern. In this case which is seperated by : in the above example restricts the value should be int or null.

Quick example on how the routing constraints are defined and used-

  • Inline Constraint

Inline constraint are added after the URL parameter and sperated by : (colon) with the primitive type and also defines if the parameter can be nullable. Below code see – {id:int?}

app.UseEndpoints(
endpoints =>
{
 endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id:int?}");
}
);

The int constraints checks if the parameter value sent is integer and allows to execute the action method by passing the parameter value to the matching method.

The other way to define same if to pass the default values and constraint parameter in the MapControllerRoute

 app.UseEndpoints(endpoints =>
{
    endpoints.MapControllerRoute(
name: "default",
pattern: "  {controller}/{action}/{id?}", new {Controller = "Home", action="Index"}, new {id = new IntRouteConstraint()});
}
);
  • Constraints in route attribute

You can also define the constraints in route attribute as follows-

[Route("Home/Index/{id:int?}")]
public IActionResult Index(int? id)
{
     return View();
}

Here are the list of constraints from the Microsoft doc site, try it yourself-

ConstraintDescriptionExample
alphaMatches uppercase or lowercase Latin alphabet characters (a-z, A-Z){x:alpha}
boolMatches a Boolean value.{x:bool}
datetimeMatches a DateTime value.{x:datetime}
decimalMatches a decimal value.{x:decimal}
doubleMatches a 64-bit floating-point value.{x:double}
floatMatches a 32-bit floating-point value.{x:float}
guidMatches a GUID value.{x:guid}
intMatches a 32-bit integer value.{x:int}
lengthMatches a string with the specified length or within a specified range of lengths.{x:length(6)} {x:length(1,20)}
longMatches a 64-bit integer value.{x:long}
maxMatches an integer with a maximum value.{x:max(10)}
maxlengthMatches a string with a maximum length.{x:maxlength(10)}
minMatches an integer with a minimum value.{x:min(10)}
minlengthMatches a string with a minimum length.{x:minlength(10)}
rangeMatches an integer within a range of values.{x:range(10,50)}
regexMatches a regular expression.{x:regex(^\d{3}-\d{3}-\d{4}$)}

Sitecore Commerce 10- Setup Development Environment for Business Tools – Part 1

Business Tools is extensible using pluggable framework and can extend a UI using Entity Views. Although Business Tools offers a rich set of controls you might want to create your own custom control for the best business experience.

For this you need to first setup the development environment for business tools. Once the environment is setup you should be ready to develop custom control/customize the business tools.

Prerequisites

  1. Instance of Commerce Engine deployed in development environment
  2. Install Node.js Javascript runtime
  3. Install Angular CLI tool – npm install -g @angular/cli

NPM configuration to have NPM Packages from Sitecore public feed

Sitecore BizFx SDK relies on NPM packages available on the Sitecore official public feed for NPM packages.

Open Poswershell as Administrator

Execute these 2 commands in powershell

npm config set @speak:registry=https://sitecore.myget.org/F/sc-npm-packages/npm/

npm config set @sitecore:registry=https://sitecore.myget.org/F/sc-npm-packages/npm/

This will add following line to–

C:\Users\[your user]\.npmrc

[Optional] – you may check if this lines are added

@speak:registry=https://sitecore.myget.org/F/sc-npm-packages/npm/
@sitecore:registry=https://sitecore.myget.org/F/sc-npm-packages/npm/

Setup and Install SPEAK and BizFx packages for development solution

Copy Sitecore.BizFX.SDK.4.0.8 folder to your development folder and extract the SDK zip file to folder e.g. c:\BizFXDevelopment\SitecoreBizFx

Copy below files to the folder SDK was extracted. You should find this files from the Sitecore XC release package.

  1. speak-icon-fonts-1.1.0.tgz
  2. speak-ng-bcl-2.0.0-r00116.tgz
  3. speak-styling-1.0.0-r00110.tgz

Execute the following commands where the above files were copied

​​​​​​​npm install speak-icon-fonts-1.1.0.tgz
​​​​​​​npm install speak-ng-bcl-2.0.0-r00116.tgz
npm install speak-styling-1.0.0-r00110.tgz
npm install @sitecore/bizfx

Run npm install. This should install required npm modules and add a folder node_modules

npm install

Setup the business tools config.json with your deployment configuration

Once the npm installed successfully open config.json file located in src\assets folder

Update the config to the same as the BizFx site instance except for BizFxUri. Note BizFxUri points to http in below config

{
  "EnvironmentName": "HabitatAuthoring",
  "EngineUri": "https://localhost:5000",
  "IdentityServerUri": "https://xp10.IdentityServer",
  "BizFxUri": "http://localhost:4200",
  "Language": "en",
  "ContentLanguage": "en",
  "Currency": "USD",
  "ShopName": "CommerceEngineDefaultStorefront",
  "LanguageCookieName": "selectedLanguage",
  "ContentLanguageCookieName": "selectedContentLanguage",
  "EnvironmentCookieName": "selectedEnvironment",
  "AutoCompleteTimeout_ms": 300,
  "AccessTokenUpdateInterval_ms": 300000
}

Run the development environment

Important!

Stop the SitecoreBizFx site as the site listens to 4200 port. Next step will help listen the site from the extracted SDK folder.

Execute following Powershell command –

ng server

Open browser on http://localhost:4200/ this should ask to enter the Sitecore client credentials, once provided it will throw an error

This site can’t provide a secure connection

The reason this error occurs the identity server is not configure to server BizFx site on http

Update the Sitecore Identity Server Configuration

Open the Sitecore.Commerce.Identity ServiceHost.xml from the installed Identity Server instance \wwwroot\Config\production

Add http://localhost:4200 to AllowedCorsOriginGroup1

<AllowedCorsOrigins>
<AllowedCorsOriginsGroup1>http://localhost:4200</AllowedCorsOriginsGroup1>
</AllowedCorsOrigins>

Update Commerce Engine configuration

  • Open config.json from wwwroot folder in CommerceAuthoring site
  • Update AllowedOrigins in AppSettings to have http://localhost:4200
  • Since the config is changed need to bootstrap so the changes are applied to authoring site
  • Restart IIS. Optionally you may just restart Commerce Authoring site

Run Business tool from development environment

Open browser on http://localhost:4200/

Business tools running on http and in developer mode.

References –

step-by-step instructions on how to setup and compile the Business Tools (BizFX) application using the ​Sitecore.BizFX.SDK

Stay tuned next blog will walk through on how to create a new custom control/component in Business Tools

This image has an empty alt attribute; its file name is image-43.png

Setup development environment for Sitecore Commerce Engine 10 and 10.2

Update: Below is applicable for Sitecore Commerce 10.2. Change the SDK version accordingly. Ignore the step mention for Content Hub

Sitecore Experience Commerce 10 has come up with great new features like Dynamic Bundles, Free gift with Purchase promotion and a sample Sitecore DAM to Commerce connector.

Before you start looking into this, it is important to setup the development environment to debug and test the changes you are making to engine.

Main changes I could see compared to previous versions are integration with Content Hub and Configuring the Commerce Engine using environment variables which not only helps for on-premise installation of Commerce Instance but also helps setup the Docker technology where XC solution is running in containers.

In this post I will walk you through on how to setup the development environment. This post assumes you have Sitecore Commerce Engine along with Visual Studio 2019 installed on developer workstation. If Commerce not installed no worries see this post on how to install Sitecore XC 10 step-by-step.

Step-by-step install Sitecore Commerce (XC) 10

For previous version of XC you may follow this blog post

Step-by-step – Setup development environment for Sitecore Commerce 9.3 Engine

Step 1- Extract Commerce Engine SDK

  • Copy the downloaded SDK Sitecore.Commerce.Engine.SDK.6.0.130.zip on your development folder. e.g: c:\development. Note– there is an update on 19th August where the external dependencies are removed. Download the package again if you have a version before this date.
  • If not available you may download Packages for On Premise WDP 2020.08-6.0.238. Login before you download the file.
  • Extract the commerce package and then extract Sitecore.Commerce.Engine.SDK.6.0.130.zip in your development folder

Step 2 – Setup Visual Studio Solution

  • Open the Solution, by default this is Customer.Sample.Solution.sln
  • Ensure Package Source is configured for Commerce- https://sitecore.myget.org/F/sc-commerce-packages/api/v3/index.json
  • Whilst opening solution login from slpartners.myget.org will be prompted
  • Create an account on https://slpartner.myget.org/ and login here. You may unload Plugin.Sample.ContentHub project if you dont want to integrate ContentHub and the login should not require. Also note myget account has a trial for 14 days.
  • Build the Solution. It should restore the package and build successfully.
  • (optional)Rename the Solution name. In this case I have renamed to Retail.Commerce
  • (Optional) Create Foundation and Feature projects. Build the solution again.

Step 3- Important – Commerce Engine configuration

Sitecore.Commerce.Engine project should have a config.json file in wwwroot folder. Open this file you will see the placeholders that needs to be filled in.

Instead updating config file, you should update the launchSettings.json and the placeholders in config.json will be updated on launch on commerce engine.

Similarly Global.json you can find this in wwwroot/bootstrap folder of your Sitecore.Commerce.Engine project. Again this file has the Placeholders that will be populated from launchSettings.json,

You need to update mainly following variables in launchSettings.json file for both config and global json. There are other variables apart from listed below, you may need to update those based on your site instance name etc.-

  1. COMMERCEENGINE_Caching__Redis__Options__Configuration
  2. COMMERCEENGINE_GlobalDatabaseServer
  3. COMMERCEENGINE_GlobalDatabaseUserName
  4. COMMERCEENGINE_GlobalDatabasePassword
  5. COMMERCEENGINE_SharedDatabaseServer
  6. COMMERCEENGINE_SharedDatabaseUserName
  7. COMMERCEENGINE_SharedDatabasePassword
  8. COMMERCEENGINE_AppSettings__SitecoreIdentityServerUrl
  9. COMMERCEENGINE_EngineAuthoringUrl
  10. COMMERCEENGINE_EngineShopsUrl
  11. COMMERCEENGINE_EngineMinionsUrl
  12. COMMERCEENGINE_EngineHealthCheckUrl
  13. COMMERCEENGINE_AppSettings__AllowedOrigins

Step 4 – Generate Development Certificate

Generate development certificate using script “New-DevelopmentCertificate”, so the localhost runs on SSL(https)

  1. Create a folder named “dev” in the root directory of SDK
  2. Create a folder named “Sitecore.Commerce.Engine_Dev” under “dev” folder
  3. Create a folder named “wwwroot” under “Sitecore.Commerce.Engine_Dev” folder
  4. Open powershell script and navigate to scripts folder.
  5. Change the Path($certificateOutputDirectory) if required. Certificate should be copied to \src\Project\Engine\code\wwwroot
  6. Execute New-DevelopmentCertificate script. This script should be available in script folder in SDK folder.

Step 5 – Update EngineUri in BizFx Site

  • Open config.json file. Should be in assets folder of your BizFx instance
  • Change EngineUri to https://localhost:5000
  • Change BizFxUri to https://localhost:4200
  • Restart BizFx site

Step 6- Run the Commerce Engine from Visual Studio

  • Set the Sitecore.Commerce.Engine project as Startup Project
  • Change the emulator to Engine
  • Stop the CommerceAuthoring_SC site hosted in IIS
  • Run the solution

Hope there should be nothing that should block to run the Business Tools requesting a call to Engine running from Visual Studio

Note: some places you may have to restart IIS also clear the browser cache before you start checking Business Tools is highly recommended.

Hope this post helps you setting your XC 10 development environment.

ISSUES

Request origin https://bizfx.sc.com does not have permission to access the resource

Resolution- Follow Step 5

Options to Install Sitecore (XP) and Commerce (XC) 10

If you are looking for upgrade to Sitecore 10, below are the various options you are able to install Sitecore 10.

Sitecore XP 10

Sitecore Installation Assistant (SIA)

Sitecore Installation Assistant helps guides you through the Sitecore XP Developer Workstation installation. Use this option to review system requirements, install prerequisites and complete the entire installation process. With Sitecore 10 you have a option to also install SXA with SIA.

To install Sitecore 10 using SIA follow this post- Step-by-step how to install Sitecore 10 using SIA

Sitecore Installation Framework On-Premises (SIF)

Sitecore Install Framework (SIF) is a Microsoft PowerShell module that supports local and remote installations of Sitecore Experience Platform.

SIF deploys Web Deploy Packages (WDP) by passing parameters to SIF configuration through a Microsoft PowerShell module and is fully extensible.
The Sitecore Experience Platform is designed to be secure-by-default. For developer environments all the required self-signed certificates are created automatically if you do not provide any.
In a production environment, you can provide your own certificates In a non-production environment, you can choose to have the module generate the certificates for you.

You must set up SIF before you can install Sitecore Experience Platform

To install Sitecore XP 10 using SIF follow this post – Step-by-step install Sitecore XP 10 using Sitecore Installation Framework (SIF)

Sitecore Containers

Sitecore Containers support rapid deployment and more efficient solution and team onboarding with modern Docker and Kubernetes technology.

Sitecore Experience Platform 10.0.0 uses Docker Compose as the container
orchestrator on developer workstations. Docker Compose is a simple containerdeployment tool that is bundled with Docker for Windows. Sitecore container images can be deployed with other tools but we recommend that you use Docker Compose to deploy the containers that form the Sitecore Experience Platform.

To install Sitecore XP 10 using Sitecore Containers with Docker Compose- Step-by-step install Sitecore XP 10 to developer workstation using Sitecore Containers with Docker Compose

Sitecore XC 10

Sitecore Installation Framework (SIF)

Sitecore Install Framework (SIF) is a Microsoft PowerShell module that supports local and remote installations of Sitecore Experience Platform.

The SIF.Sitecore.Commerce package contains Sitecore Installation Framework scripts and Web Deployment Packages (WDP).

To install Step-by-step install Sitecore Commerce (XC) 10

Step-by-step install Sitecore XP 10 to developer workstation using Sitecore Containers with Docker Compose

One of the highlights of newly released Sitecore Experience Platform (10.0) is that it brings support to rapid deployment and more efficient solution and team onboarding with modern Docker technology i.e. Sitecore Containers.

To know more about containers here is the official documentation from Sitecore on Containers

Lets get started to create a Sitecore XP 10 development environment using docker.

Before getting started please see Installation Guide for Developer Workstation with Containers

Topology user here will XP0 or per guide XP Workstation (XP Single)

Hardware and Networking Requirements-

Developer workstation requires 32GB RAM and 25 GB Free space with quad core or higher CPU

Required portRoleDescription
433 443TraefikHTTPS proxy
8079TraefikTraefik dashboard
8080TraefikHTTP proxy
8984SolrSolr API and dashboard
14330SQLSQL Server

IMPORTANT-

HTTPS proxy port for Traefik in guide is incorrect. As per the docker-compose.yml the Traefik is set to listen on 443 port and not 433.

Prepare/prerequisite for Sitecore XP workstation-

  • OS- Windows 10 1809 or later or Windows Server 1809 or later

Login to Azure portal to create a VM

Image – Select Image to Windows 10 Pro, Version 1809- Gen 1

Size – Standard_D8s_v3- * vcpus, 32GiB memory

Inbound ports– Select RDP, dont select HTTPS 443 as this will be used by Traefik as mentioned in previous section

  • Download and Install Docker Desktop for Windows

Download and install Docker Desktop for Windows. You can get Stable version from here

Setup should enable Hyper-V Windows Features

After installation Restart the machine, this should enable the Hyper-V feature

This should also have Docker running and should see the same in system tray

  • Switch to Windows containers

Right click on Docker icon and switch to Windows Container. See this link for more details as per guide

Download and Prepare for installation

  • Download and extract the Sitecore Container Deployment Package from the Sitecore Developer Portal and store it on your local workstation

Login to Sitecore portal before download

  • Copy and extract SitecoreContainerDeployment 10.0.0 rev. 004346-027.zip for e.g:- C:/SitecoreXPDocker

Navigate to C:/SitecoreXPDocker/ltsc2019/sitecore-xp0

  • Open .env file, we need to fill in this parameters before starting installation. You can find more details in guide for each option.
  • Download PowerShell script to initialize (init.ps1) the parameters from docker-examples. Parameter values in .env can be populated manually by individually executing the commands for required for each parameter in guide(see Appendices) but I would recommend to use init.ps1 as this is provided by Sitecore and hence tried and tested.

Folder structure should look like this-

  • Change parameter values in init.ps1 file.

Change the SitecoreAdminPassword, SqlSaPassword and host entries as per requirement. If you are changing host entries also ensure the same is updated in .env file for CM_HOST and ID_HOST parameters. Lets keep the default values.

  • Populate .env file using init command

Open PowerShell as a Administrator, navigate to the folder having init.ps1 file.

Execute init.ps1 script. You may have to set the execution rights to current user to execute the script-

Set-ExecutionPolicy -Scope CurrentUser Unrestricted
.init.ps1

Provide the path of license file

This should Install and Import SitecoreDockerTools and Populate the environment file.

Ensure to Switch to Windows Container before executing below command

Install

Execute docker compose command

docker-compose.exe up --detach

Installation complete-

Once command execution is complete, should see all the checks done and Sitecore dev. instance ready in 20 minutes

Open Docker Dashboard and should see Sitecore-XP0 running

Site listening to address- https://xp0cm.localhost/

Cleanup the workstation

To cleanup/stop workstation use following commands. You can find these in instllation guide

To stop a Docker Compose environment without removing its contents:

docker-compose.exe stop

To resume a previously stopped Docker Compose environment:

docker-compose.exe start

To remove a Docker Compose environment and all the non-mounted volumes

docker-compose.exe down

Hope this helps to install Sitecore XP 10 using Docker!!!

Step-by-step install Sitecore XP 10 using Sitecore Installation Framework (SIF)

Deployment Topology for installing Sitecore using SIF we are going to see here is XP Single Developer(XP0)

Another way to install is using Sitecore Installation Assistant (SIA). See this post to deploy using SIA

Use the Sitecore Installation Guide for hardware, OS ,database and other software requirements

Installation guide for Developer workstation

Download/Install following-

  • Windows Server 2019/2016 or Windows 10(64-bit)
  • Install Microsoft PowerShell 7.0.3 if not already installed
    1. PowerShell in installed with OS. Check version using this command
      • Get-Host | Select-Object Version
    2. Optionally install version 7.0.3 if version 5.1 or later is already installed
  • Install .Net Framework 4.8.0

Machine restart might be required whilst installation of above software’s

Step-by-step prepare and organize pre-requisite and installation files

  • Enable Contained Database Authentication

After installing SQL Server launch SQL Server Management Studio and run following-

EXEC sp_configure 'contained', 1;
RECONFIGURE;
  • Prepare the installation folder
  1. Extract downloaded XP Single Developer package to a folder e.g.:- sitecorexp10
  2. Extract XP0 Configuration files 10.0.0 rev. 004346.zip in same folder
  • Install SIF Module
  1. Open PowerShell as an administrator.
  2. Set unrestricted execution to current user
Set-ExecutionPolicy -Scope CurrentUser Unrestricted

3. Register repository

Register-PSRepository -Name SitecoreGallery https://sitecore.myget.org/F/sc-powershell/api/v2

4. Install SIF

Install-Module SitecoreInstallFramework

5. After SIF installation check if the SIF 2.3.0 is installed

Get-Module SitecoreInstallFramework –ListAvailable 

To install specific version of SIF or run multiple version of SIF see this blog

6. Execute – Install-SitecoreConfiguration -Path Solr-SingleDeveloper.json

  • Install prerequisites before installing XP 10

Switch to the sitecorexp10 folder and execute following script

Install-SitecoreConfiguration -Path .\Prerequisites.json
  • Install SOLR 8.4.0

1. Switch to sitecorexp10 folder. Open Solr-SingleDeveloper.json file

2. Change the Install Root for SOLR – DefaultValue

 "SolrInstallRoot": {
            "Type": "String",
            "Description": "The file path to install Solr. This config will add the prefix and solr version e.g C:\\Solr becomes C:\\Solr\\[SolrServicePrefix]Solr-8.4.0",
            "DefaultValue": "C:\\SOLR"
        },

3. Execute – Install-SitecoreConfiguration -Path Solr-SingleDeveloper.json

4. Check https://localhost:8983/solr/#/ if SOLR installed on SSL

Prepare and Execute script for installation

Open XP0-SingleDeveloper.ps1 file to update following-

  • $Prefix
  • $SitecoreAdminPassword
  • $SCInstallRoot – change path to the folder installers are available
  • $SolrUrl
  • $SolrRoot
  • $SolrService
  • $SqlServer
  • $SqlServer
  • $SqlAdminPassword

Copy license to the sitecorexp10 folder

Execute installation script – .\XP0-SingleDevelor.ps1

Hope the installation completes without any issues

Post Installation activities

Rebuild the search indexes and the Link database
After you install Sitecore Experience Platform, you must rebuild the search indexes and rebuild the Link databases.


To rebuild all the indexes:

  1. On the Sitecore Launchpad, click Control Panel, and in the Indexing section, click Indexing manager.
  2. In the Indexing Manager dialog box, click Select all, and then click Rebuild.

To rebuild the Link databases for the Master and Core databases:

  1. On the Sitecore Launchpad, click Control Panel, and in the Database section, click Rebuild Link Databases.
  2. Select the Master and Core databases and then click Rebuild

Step-by-step install Sitecore Commerce (XC) 10

Follow these steps to install Sitecore Commerce 10 On Premise. To successfully install refer to Installation Guide provided by Sitecore.

Login to Sitecore before starting download.

Download Installation Guide

Before installing Sitecore Commerce install Sitecore XP 10. See this blog to install Sitecore XP 10 using SIA. Say the XP site name is- sc10.sc.dev.local

Hosting Environment Requirements/ Download and Install following software-

  1. OS – Windows Server 2019/2016 or Windows 10 Pro(64-bit)
  2. Redis (Windows): 3.0.504
  3. .Net Framework – ASP.Net Core runtime 3.1.6 (Recommend to install v3.1.7 it has a security patch)
  4. Database – Microsoft SQL Server 2017 Express Edition (This should be already installed as a part of XP 10)
  5. Install Microsoft Web Deploy 3.6 if not already installed
  6. Install URL Rewrite using Web Platform Installer
  7. SOLR 8.4.0 (This should have already installed as a part of XP 10 install)
  8. Install PowerShell 6.0 or later is not already installed
  9. Web Platform Transformer (Download nuget package)

Download following Sitecore Software before XC installation

Require login before downloading the Sitecore Softwares

Sitecore Experience Platform 10.0

Sitecore Experience Accelerator (SXA) 10.0

Sitecore PowerShell Extensions 6.0 for Sitecore 10.0

Before starting the installation ensure XP 10 instance is working and indexed. If not indexed rebuild all search indexes-

Also check if the SOLR is working and running on https-

Step-by-step installation process-

  1. Create a installation folder for XC – xcinstall for e.g.:- c:\scinstall
  2. Copy Sitecore.Commerce.WDP.2020.08-6.0.238.zip file to c:\scinstall folder
  3. Extract and copy all extracted files to the c:\scinstall folder
  4. Copy Sitecore Experience Accelerator. Copy Sitecore Experience Accelerator 10.0.0.3138.zip file c:\scinstall folder
  5. Copy Sitecore.PowerShell.Extensions. Copy Sitecore.PowerShell.Extensions-6.1.1.zip file to c:\scinstall folder
  6. Extract Web Platform Transfomer nuget package and copy Microsoft.Web.XmlTransform.dll to c:\scinstall folder
  7. Extract SIF.Sitecore.Commerce.5.0.49 to c:\scinstall folder
  8. Folder structure should look like this-
  9. Open Deploy-Sitecore-Commerce.ps1 file to update the following-
    1. $SiteNamePrefix
    2. $SiteName
    3. $IdentityServerSiteName
    4. $SiteHostHeaderName
    5. $XConnectInstallDir
    6. $MergeToolFullPath – Path of the Microsoft.Web.XmlTransform.dll
  10. Update DB related configuration
    1. $SitecoreDbServer – In case of named instance ensure you set double slash between the server and instance name “SQLServerName\\SQLInstanceName”
  11. Update other DB related settings
    1. $SqlUser
    2. $SqlPass
    3. $CommerceServicesDbServer
  12. [Optional] Update Sitecore domain or keep it default-
    1. $SitecoreDomain
    2. $SitecoreUsername
    3. $SitecoreUserPassword
  13. Update SOLR details-
    1. $SolrUrl
    2. $SolrRoot
    3. $SolrService
  14. [Optional] Update local account details
    1. $UserDomain
    2. $UserName
    3. $UserPassword
  15. Create Commerce Engine Connect Client Secret for the Sitecore Identity Server
    1. Copy below script to file to scinstall/SIF.Sitecore.Commerce.5.0.49 folder example XC10SecretClientCertificate.ps1
    2. Execute the script and copy secret key
$bytes = New-Object Byte[] 32
$rand = [System.Security.Cryptography.RandomNumberGenerator]::Create()
$rand.GetBytes($bytes)
$rand.Dispose()
$newClientSecret = [System.Convert]::ToBase64String($bytes)

Write-Host $newClientSecret

16. Copy the secret key to update $CommerceEngineConnectClientSecret variable in Deploy-Sitecore-Commerce.ps1

17. Execute Deploy-Sitecore-Commerce.ps1 script to install commerce

18. Once installed successfully login to Sitecore, you shall find the Business tool in Dashboard

19. Goto content editor and navigate to item- /sitecore/content/Sitecore/Storefront/Settings/Site Grouping/Storefront to change Host Name

20. Visit site to check if the default store front site is loading

21. Login to Business Tools

Issues

  1. Error connecting Identity Server. See this blog to resolve if you receive error

2. Error whilst bootstrapping commerce ops

Resolution- Check or reset the service account credentials that are created for the app pools as part of deployment. You can find the credentials in installation script with variable name $UserName (CSFndRuntimeUser) and $Password. Try accessing the https://commerceops.sc.com site if there are any other errors.

Sitecore XP 10 identity server error – failed to start process with commandline ‘dotnet .\Sitecore.IdentityServer.Host.dll’

After installing Sitecore 10 using Sitecore Installation Assistant (see the blog here how to install Sitecore XP 10 usig SIA) you might find the Identity Server not working since it is not able to start the process with command line ‘dotnet .\Sitecore.IdentityServer.Host.dll’

You may see this error in Application logs.

You may also see Sitecore login been not redirected to identity server site instead redirects to XP login page.

To identify the problem first try manually starting the process in powershell. You can find command to start the process in error.

Navigate to the identity server site physical folder and execute this command

dotnet .\Sitecore.IdentityServer.Host.dll

This should tell the solution to the issue i.e. it needs AspNetCore version 2.1.16 to be installed.

Install SDK 2.1.804 from here, this also install Runtime 2.1.16 – https://dotnet.microsoft.com/download/dotnet-core/2.1

Execute the command dotnet .\Sitecore.IdentityServer.Host.dll

This time the Identity Server should start.

Identity Server site is working now –

This will also help whilst installing the Sitecore Commerce 10.

Hope this helps.