Page 14 of 21

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.

Install Sitecore XP 10 using Sitecore Installation Assistant(SIA) in easy steps to development machine

Installing Sitecore 10 with Sitecore Installation Assistant (SIA) is quick and easy. Only manual prerequisite is to install SQL Server 2017

Please see through screens to install Sitecore 10-

Step 1- Install SQL Server 2017 and SQL Server Management Studio (SSMS)

Step 2- Download Sitecore 10 Graphical setup package for XP Single

Step 3- Extract the zip and start setup

Step 4-

Step 5- Install prerequisite. This should install SIF and Windows Server prerequisites including IIS and modules etc.

Step 6 – Once prerequisites are installed successfully yo may have to restart machine. Install Solr search service. Sitecore 10 needs SOLR 8.4

Step 7- After SOLR is installed enter the Sitecore settings along with SQL server details and SOLR details

Step 8 – Optionally select Sitecore modules (SXA)

That’s it and everything is managed by SIA to sucessfuly install Sitecore 10 on machine

How to resolve user registration error in Sitecore Commerce- “Invalid or missing value for property Domain .”,”User created but external Id was not provided”

Are you wondering why this error occurred while registering user?

You may come across this error when the engine is trying to create a customer in Commerce and the domain you have created for Storefront is not available in Commerce. The customer in commerce are mapped to the domain and if the domain is not found or matched with what is configured in Storefront this error will come.

So how to resolve this error-

Lets say your Storefront is mapped to use the default environment i.e. HabitatShops.

Follow steps below to make this work-

  • Open PlugIn.Habitat.CommerceAuthoring-1.0.0.json and find the CustomerPropertiesPolicy
  • You may see the list of Domains default been Storefront, extranet and CommerceUsers
  • Add the domain you have configured in your storefront in this list e.g.:- HabitatStorefront
  • Add the same domain to PlugIn.Habitat.CommerceShops-1.0.0.json
  • Ensure the domain is created and mapped in the Storefront correctly
  • Bootstrap Habitat Environment using Postman and now you should see the domain in the list whilst creating a customer

You should now able to see the domain in the list whilst creating a customer in business tool

Should also allow to create a customer with the new domain-

Hope this helps.

Elements of a Sitecore Commerce Plugin project template

In my previous post we saw the first step to create a new plugin by adding a new plugin project to the solution, restoring the correct binaries and reference new plugin to the Engine project.

In this post I will share what comes with the Plugin project template.

Sitecore Commerce Plugin project template creates folders and classes which helps to quick start creating a plugin, lets see what are these files –

1. Commands

To my understanding command is unit of work to perform set of actions. Commands allows to execute a pipeline and blocks within a transaction scope. Create a custom command by inheriting from CommerceCommand class. Use PerformTransaction method to run a pipeline in a transaction scope.

2. Components

If you want to extend existing or custom entities, use component. Component has attributes that support entities.

3. Controllers –

Controllers expose commerce functionality implemented in plugins. They are the api endpoints. Sitecore Commerce has various Controller type- Entity, Api, Devops and Command. Create your own controllers by inheriting from CommerceController

4. Entities-

They are the persistable unit and represent the business concept. Inherited from the CommerceEntity they has a unique identifier that helps to retrieve the entity by using a Entity controller type.

5. Models –

They are the POCO classes that are reusable in entities and components. Can be used to present data as part of command response .

6. Pipelines – They do the heavy lifting in plugin by making it possible to define the extensible behavior. Create your own pipeline and add blocks you want to execute to implement your business logic. Blocks within pipelines execute in a sequence they are registered.

7. Policies

Policies defines behavior for the functionality provided by the plugin. Its is recommended to not extend or inherit out-of-box plugins instead create your own. Plugins can be changed or created new by updating the JSON files provided in environment folder of the various roles site.

ConfigureSitecore

ConfigureSitecore class helps to register the pipeline and block definitions that a plugin defines. You can create a new plugin and AddPipeline or extend the existing pipeline by adding a block After or Before any existing blocks. ConfigureSitecore class registers pipelines every time engine loads. You can also register commands or register your custom class in this class.

ConfigureServiceApiBlock

This registers customer entities, components and controller action with ODATA model. It allows to these elements to be used when a REST API call is made and available when generating a proxy.

Enable Catalog search in business tool for Sitecore 9.1 Commerce environments

Sitecore Commerce indexes Catalogs, Categories and SellableItems to help search items in Business tools. The settings for the Search can be found in PlugIn.Search.PolicySet-1.0.0.json

These indexes has a search scope, for searching catalog and related items by default the scope is “xc910CatalogItemsScope”

So in SOLR indexed items related to catalogs are kept in core – “xc910CatalogItemsScope”

By default Sitecore will index only Habitat Environment in Sitecore Commerce 9.1. If you want to index your custom environment or AdventureWorks environment, follow these steps-

  • Open Sitecore.Commerce.Engine.Connectors.Index.Common.config file. This should be in CM Y.Commerce.Engine folder
  • In this instance for Adventureworks add “AdventureWorksAuthoring” in Environemnts element for Master Index and “AdventureWorksShops” for Web Index
  • Open Postman and Run – Full Index Minion Catalog Items
  • Check if the items are indexed correctly in SOLR.
  • Search the same keyword in Business tool for AdeventureWorks environment

First Steps | Sitecore Commerce Development | Create a Custom Plugin

In my last post, I have described the steps to set up the Sitecore Commerce development environment. In this post, I will describe how to create a custom plugin in Sitecore Commerce. I was working on version 9.3 but these steps should work with all versions of 9 series.

Sitecore Commerce provides an extensible framework which can be extended using plugins. A plugin is an independently publishable extension to the Sitecore Commerce Engine. Generally, you will find the following contained in a plugin and are used to extend the platform.

  • Entities
  • Components
  • Entity Views
  • Pipeline
  • Policies etc.

You can extend the platform or add more features using the plugins. Let’s get started and look into the steps to create a new plugin in Sitecore Commerce 9.3. 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 9.3 Engine

Step 2 – Install Visual Studio Extension for creating plugin

  1. Go to  solution root folder or SDK folder and run the Sitecore.Commerce.Plugin.vsix file. Close the Visual Studio solution if open.
  2. This should install extension on selected Visual Studio Version
create plugin1

Step 3 – Create a plugin

  1. Open your solution. Create a Feature solution folder, just to follow Helix best practice. Right click solution folder to create a new project
  2. Search Sitecore.Commerce.Plugin. Select project type and click next.
create plugin2
  1. Give the project name, location and select .Net Framework 4.7.1. Create a Project.
create plugin3
  1. Sample Folder and Files for Commands, Components, Controller etc shall be added.
create plugin4
  1. Update the Sitecore Commerce Core from 5.0.0 to 5.0.4
create plugin5
create plugin6

4. Build the project. There shouldn’t be any reason the build should fail.

Step 4 – Reference project and run engine

  1. Add Plugin project reference to your Commerce.Engine Project
  2. Run the Engine. You should be able to see the newly created plugin is now registered in Engine.

This should allow to start customizing commerce and truly use plug-gable and extendable feature of Sitecore Commerce.

create plugin9

We intentionally didn’t add any code to this plugin to keep this simple. In the next blog, we will cover the anatomy of the newly created plugin and show how to inject this plugin into Commerce Pipelines and execute some custom code.

Next understand the Elements of Sitecore Commerce Plugin project templates

Hope you enjoyed this post. Stay tuned.