Thursday, July 16, 2020

Sitecore XP 9.3 (Scaled) environment installation with XC 9.3 (Diff roles).

The third time, I got a requirement to set up the infrastructure for my current project, this time the requirement was to go with in-house VMs.


Here are the installation steps and road blockers.

First of all, just wanted to let you know there is no OOTB script available for the XC scaled environment which can mitigate this requirement.

Now, we have two options.

1. Install complete XC setup on CM, CD1 and CD2 and remove all roles other than shop from the CD1 and CD2.

2. Install all roles on CM and only install required roles on CD1 and CD2.

We had a discussion with the Sitecore team and found there is no OOTB script but after some time we got below link for the reference.

https://github.com/CommerceMinion/Sitecore-Commerce-v9.3-Distributed-Installation

If you see the above link, basically it's installing all the modules and removing a few roles based on the roles explicitly.

After checking the above script, and based on my understanding, I have decided to go with the full installation and remove the roles accordingly.

here is my journey now :)

1. Install CM (XP and XC) -  I pointed DB to a diff server and Solr to a diff server as mention in the above diagram.

Install SSL certificate of your company ( in my case it was wild card certificate) get the thumbprint and all update all scaled environment script.

Add Solr host entity to your CM server so that you can access it.

Here are quick steps -


# Change the TLS version

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12


# Install Nuget provider(if not installed Visual Studio)

Install-PackageProvider -Name NuGet


# Trust the PSGallery (Skip this)

# Set-PSRepository PSGallery -InstallationPolicy Trusted


# Register the SitecoreGallery

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


# Install the SIF

Install-Module -Name SitecoreInstallFramework -Repository SitecoreGallery -RequiredVersion 2.2.0


# Run Prerequisites

Install-SitecoreConfiguration –Path "D:\Sitecore\SitecoreInstaller\Prerequisites.json"


# Download .net framework 4.7.1 developer pack

# Download .net framework 4.7.2 developer pack

# Restart server


# Run the query on DB server

EXEC sp_configure 'contained', 1;

RECONFIGURE;

# Run the Sitecore installation for CM/CD

# Identity Server

Install-SitecoreConfiguration –Path "D:\Sitecore\SitecoreInstaller\IdentityServer.json"


# Only for CM Server

Install-SitecoreConfiguration –Path "D:\Sitecore\SitecoreInstaller\sitecore-XP1-cm.json"


# Only for CD Server

Install-SitecoreConfiguration –Path "D:\Sitecore\SitecoreInstaller\sitecore-XP1-cd.json"


# Common

Install-SitecoreConfiguration –Path "D:\Sitecore\SitecoreInstaller\sitecore-XP1-prc.json"

Install-SitecoreConfiguration –Path "D:\Sitecore\SitecoreInstaller\sitecore-XP1-rep.json"

Install-SitecoreConfiguration –Path "D:\Sitecore\SitecoreInstaller\xconnect-xp1-collection.json"

Install-SitecoreConfiguration –Path "D:\Sitecore\SitecoreInstaller\xconnect-xp1-collectionsearch.json"

Install-SitecoreConfiguration –Path "D:\Sitecore\SitecoreInstaller\xconnect-xp1-MarketingAutomationReporting.json"

Install-SitecoreConfiguration –Path "D:\Sitecore\SitecoreInstaller\xconnect-xp1-MarketingAutomation.json"

Install-SitecoreConfiguration –Path "D:\Sitecore\SitecoreInstaller\xconnect-xp1-ReferenceData.json"

Install-SitecoreConfiguration –Path "D:\Sitecore\SitecoreInstaller\xconnect-xp1-CortexProcessing.json"


========================

POints CORS in identity Server

*XConnectEnvironment in xp1-collection

"DefaultValue": "Development",


XConnectEnvironment in xp1-collectionsearch

"DefaultValue": "Development",


XConnectEnvironment in xp1-marketing

"DefaultValue": "Development",

All the above steps will install the XP on the CM server,  now to install the XC, I have followed below steps.

Download the XC 9.3 script and update all required parameters, Make sure to point to Solr URL and SQL credential appropriately.

As the SQL is on remote (diff) machine we have to explicitly change the SIF script.

  • SIF\Configuration\Commerce\SitecoreBizFx\SitecoreBizFx.Install.json
  • SIF\Configuration\Commerce\CommerceEngine\CommerceEngine.Instance.Deploy.json 

      {

              "Name": "GlobalDatabaseUserName",

              "Value": "[concat(parameter('UserDomain'), concat('\\\\', parameter('UserName')))]"

            },


        {

              "Name": "SharedDatabaseUserName",

              "Value": "[concat(parameter('UserDomain'), concat('\\\\', parameter('UserName')))]"

            },

   "UserName": "[concat(parameter('UserDomain'), concat('\\', parameter('UserName')))]"


Install the self-signed certificate to the trusted root,  otherwise, you will get below errors 



 Install-SitecoreConfiguration : Cannot validate argument on parameter 'Signer'. The argument is null, empty, or an element of the argument collection contains a null  
 value. Supply a collection that does not contain any null values and then try the command again.  
 At D:\InstallationMaster\Sitecore\SitecoreCommerce\SIF\installProd.ps1:295 char:5  
 +   Install-SitecoreConfiguration @deployCommerceParams -Verbose *>&1 ...  
 +   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
   + CategoryInfo     : NotSpecified: (:) [Write-Error], WriteErrorException  
   + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Install-SitecoreConfiguration  
 [TIME] 00:00:47  
 Invoke-NewSignedCertificateTask : Cannot validate argument on parameter 'Signer'. The argument is null, empty, or an element of the argument collection contains a null  
 value. Supply a collection that does not contain any null values and then try the command again.  
 At C:\Program Files\WindowsPowerShell\Modules\SitecoreInstallFramework\2.2.0\Public\Install-SitecoreConfiguration.ps1:641 char:47  
 +             & $entry.Task.Command @paramSet | Out-Default  
 +                        ~~~~~~~~~  
   + CategoryInfo     : InvalidData: (:) [Invoke-NewSignedCertificateTask], ParentContainsErrorRecordException  
   + FullyQualifiedErrorId : ParameterArgumentValidationError,Invoke-NewSignedCertificateTask  
 PS D:\InstallationMaster\Sitecore\SitecoreCommerce\SIF>  

Setup the SMO - otherwise you will get this error -


Sometime, You may need to update the SIF scrip to replace https instead of HTTP explicitly.

And the final steps to remove the unnecessary role and add the correct URL, I go the reference from above scripts, Here are the details for each role.

  { "id", "xc_ma" } {  
     Remove-Item "C:\inetpub\wwwroot\XP1.sc\XConnectFiles" -Recurse -Force -ErrorAction SilentlyContinue  
   }  
   "cd" {  
     Remove-Item "$($Env:SYSTEMDRIVE)\inetpub\wwwroot\XP1.XConnect" -Recurse -Force -ErrorAction SilentlyContinue  
     Remove-Item "$($Env:SYSTEMDRIVE)\Program Files\Redis" -Recurse -Force -ErrorAction SilentlyContinue  
     WorkAround-Replace-In-File -filePath "$($Env:SYSTEMDRIVE)\inetpub\wwwroot\XP1.cd\App_Config\Include\Y.Commerce.Engine\Sitecore.Commerce.Engine.Connect.config" -find "<shopsServiceUrl>https://localhost:5000/api/</shopsServiceUrl>" -replace "<shopsServiceUrl>https://commerceshops.sc9.com/api/</shopsServiceUrl>"  
     WorkAround-Replace-In-File -filePath "$($Env:SYSTEMDRIVE)\inetpub\wwwroot\XP1.cd\App_Config\Include\Y.Commerce.Engine\Sitecore.Commerce.Engine.Connect.config" -find "<commerceOpsServiceUrl>https://localhost:5000/commerceops/</commerceOpsServiceUrl>" -replace "<commerceOpsServiceUrl>https://commerceops.sc9.com/commerceops/</commerceOpsServiceUrl>"  
     WorkAround-Replace-In-File -filePath "$($Env:SYSTEMDRIVE)\inetpub\wwwroot\XP1.cd\App_Config\Include\Y.Commerce.Engine\Sitecore.Commerce.Engine.Connect.config" -find "<commerceMinionsServiceUrl>https://localhost:5000/commerceops/</commerceMinionsServiceUrl>" -replace "<commerceMinionsServiceUrl>https://commerceminions.sc9.com/commerceops/</commerceMinionsServiceUrl>"  
     WorkAround-Replace-In-File -filePath "$($Env:SYSTEMDRIVE)\inetpub\wwwroot\XP1.cd\App_Config\Include\Y.Commerce.Engine\Sitecore.Commerce.Engine.Connect.config" -find "<sitecoreIdentityServerUrl>https://sxastorefront-identityserver/</sitecoreIdentityServerUrl>" -replace "<sitecoreIdentityServerUrl>https://xp1.identityserver/</sitecoreIdentityServerUrl>"  
     WorkAround-Replace-In-File -filePath "$($Env:SYSTEMDRIVE)\inetpub\wwwroot\XP1.cd\App_Config\Include\Y.Commerce.Engine\Sitecore.Commerce.Engine.Connect.config" -find "<enforceSsl>true</enforceSsl>" -replace "<enforceSsl>false</enforceSsl>"  
   }  
   "cm1" {  
     Remove-Item "$($Env:SYSTEMDRIVE)\inetpub\wwwroot\XP1.XConnect" -Recurse -Force -ErrorAction SilentlyContinue  
     Remove-Item "$($Env:SYSTEMDRIVE)\Program Files\Redis" -Recurse -Force -ErrorAction SilentlyContinue  
     WorkAround-Replace-In-File -filePath "$($Env:SYSTEMDRIVE)\inetpub\wwwroot\XP1.cm\App_Config\Include\Y.Commerce.Engine\Sitecore.Commerce.Engine.Connect.config" -find "<configuration>localhost,defaultDatabase=1,allowAdmin=true,syncTimeout=3600000</configuration>" -replace "<configuration>localhost,defaultDatabase=1,allowAdmin=true,abortConnect=false,syncTimeout=3600000</configuration>"  
   }  
   "cm2" {  
     Remove-Item "$($Env:SYSTEMDRIVE)\inetpub\wwwroot\XP1.XConnect" -Recurse -Force -ErrorAction SilentlyContinue  
     Remove-Item "$($Env:SYSTEMDRIVE)\Program Files\Redis" -Recurse -Force -ErrorAction SilentlyContinue  
     WorkAround-Replace-In-File -filePath "$($Env:SYSTEMDRIVE)\inetpub\wwwroot\XP1.cm\App_Config\Include\Y.Commerce.Engine\Sitecore.Commerce.Engine.Connect.config" -find "<shopsServiceUrl>https://localhost:5000/api/</shopsServiceUrl>" -replace "<shopsServiceUrl>https://commerceshops.sc9.com/api/</shopsServiceUrl>"  
     WorkAround-Replace-In-File -filePath "$($Env:SYSTEMDRIVE)\inetpub\wwwroot\XP1.cm\App_Config\Include\Y.Commerce.Engine\Sitecore.Commerce.Engine.Connect.config" -find "<commerceOpsServiceUrl>https://localhost:5000/commerceops/</commerceOpsServiceUrl>" -replace "<commerceOpsServiceUrl>https://commerceops.sc9.com/commerceops/</commerceOpsServiceUrl>"  
     WorkAround-Replace-In-File -filePath "$($Env:SYSTEMDRIVE)\inetpub\wwwroot\XP1.cm\App_Config\Include\Y.Commerce.Engine\Sitecore.Commerce.Engine.Connect.config" -find "<commerceMinionsServiceUrl>https://localhost:5000/commerceops/</commerceMinionsServiceUrl>" -replace "<commerceMinionsServiceUrl>https://commerceminions.sc9.com/commerceops/</commerceMinionsServiceUrl>"  
     WorkAround-Replace-In-File -filePath "$($Env:SYSTEMDRIVE)\inetpub\wwwroot\XP1.cm\App_Config\Include\Y.Commerce.Engine\Sitecore.Commerce.Engine.Connect.config" -find "<sitecoreIdentityServerUrl>https://sxastorefront-identityserver/</sitecoreIdentityServerUrl>" -replace "<sitecoreIdentityServerUrl>https://xp1.identityserver/</sitecoreIdentityServerUrl>"  
     WorkAround-Replace-In-File -filePath "$($Env:SYSTEMDRIVE)\inetpub\wwwroot\XP1.cm\App_Config\Include\Y.Commerce.Engine\Sitecore.Commerce.Engine.Connect.config" -find "<enforceSsl>true</enforceSsl>" -replace "<enforceSsl>false</enforceSsl>"  
   }  
   "prc" {  
     Remove-Item "$($Env:SYSTEMDRIVE)\inetpub\wwwroot\XP1.XConnect" -Recurse -Force -ErrorAction SilentlyContinue  
     Remove-Item "$($Env:SYSTEMDRIVE)\Program Files\Redis" -Recurse -Force -ErrorAction SilentlyContinue  
   }  
   { "ce_post", "bizfx", "sf" } {  
     Remove-Item "$($Env:SYSTEMDRIVE)\inetpub\wwwroot\XP1.sc" -Recurse -Force -ErrorAction SilentlyContinue  
     Remove-Item "$($Env:SYSTEMDRIVE)\inetpub\wwwroot\XP1.xconnect" -Recurse -Force -ErrorAction SilentlyContinue  
     Remove-Item "$($Env:SYSTEMDRIVE)\solr-8.1.1" -Recurse -Force -ErrorAction SilentlyContinue  
     Remove-Item "$($Env:SYSTEMDRIVE)\Program Files\Redis" -Recurse -Force -ErrorAction SilentlyContinue  
   }  
After that, I changed the Redis under the LB for the HA.

Let me know if you have any questions. 

Happy Sitecore XP + XC installation on the production.

Monday, June 1, 2020

Sitecore XC 9.3 - Fix for Request URL: GetCatalogMappings(environmentName='')

 Recently, We found below error during the development -

      Message: Access to the registry key 'Global' is denied.  
 8516 10:01:25 INFO Cache created: 'DeviceDictionaryCache' (max size: 100MB, running total: 3908MB)  
 18808 10:01:40 INFO [Path Analyzer](.) Map EnsureAllDeployed started.  
 18808 10:01:40 INFO [Path Analyzer](.) Map EnsureAllDeployed complete.  
 18808 10:02:40 INFO [Path Analyzer](.) Map EnsureAllDeployed started.  
 18808 10:02:40 INFO [Path Analyzer](.) Map EnsureAllDeployed complete.  
 14936 10:02:47 ERROR Commerce.Connector - Request URL: GetCatalogMappings(environmentName='') - Exception: System.AggregateException: One or more errors occurred. ---> System.Threading.Tasks.TaskCanceledException: A task was canceled.  
   --- End of inner exception stack trace ---  
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)  
   at Sitecore.Commerce.Engine.Connect.DataProvider.CommerceRepository.InvokeHttpClientGet(String serviceCallUrl, Boolean useCommerceOps, Boolean raiseException, String language, String environment, IDictionary`2 headers)  
 ---> (Inner Exception #0) System.Threading.Tasks.TaskCanceledException: A task was canceled.<---  
 Exception: System.AggregateException  
 Message: One or more errors occurred.  
 Source: mscorlib  
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)  
   at Sitecore.Commerce.Engine.Connect.DataProvider.CommerceRepository.InvokeHttpClientGet(String serviceCallUrl, Boolean useCommerceOps, Boolean raiseException, String language, String environment, IDictionary`2 headers)  
 Nested Exception  
 Exception: System.Threading.Tasks.TaskCanceledException  
 Message: A task was canceled.  
Investigation details -

We noticed it was because of deployment, As few dlls were missing, After a full deployment this issue has been resolved.

Saturday, May 9, 2020

Sitecore XC - Not showing selected Catalogs.

 Recently, I found an issue that Sitecore catalogs is not showing any catalogs in the list.

After a quick investigation, I noticed this is because of IIS of commerce authoring was stopped while doing the debugging,

I had restarted the authoring and that resolved the issue.

Friday, May 8, 2020

Sitecore EXM configuration options and steps.

Here is my experience with EXM configuration - I got a requirement to configure the EXM.

I initially did through the SMTP and it worked fine but later on, we came to know to update it to use Sitecore email cloud.

I faced a few issues and here are the details -

Integration options -



I followed this document  - https://kb.sitecore.net/articles/947205 to configure the cloud but found a few issues.

The first

I used the same configuration, 



When I changed the URL to EU - As mentioned below.

 Geo-location     URL  
 EU     https://sparkpost-eu.cloud.sitecore.net  
 US     https://sparkpost.cloud.sitecore.net  

I got below error.


Finally, I came to know that for the cloud it would need an additional license- Ref - https://doc.sitecore.com/users/exm/100/email-experience-manager/en/index-en.html


We had also discussed to Sitecore support team and they also confirmed that it's related to licensing.







Thursday, May 7, 2020

Fix for Sitecore XP and commerce- The password for the account has expired.



Recently, We got this issue on one of the VM where we had Sitecore XP, and Sitecore XC installed.

After a quick investigation, were able to resolve it, here are the details for the quick fix.

The issue was because we had recently updated the password for a local user XX which we used to connect with the local machine with the VM services.

After resetting the password and grating the permission, We were able to resolve this issue.

Easy fix :)

Fix for Sitecore XP and commerce- Sitecore Experience Commerce - Shop CommerceEngineDefaultStorefront does not exist


I recently found this error while browsing the Sitecore commerce catalog item. After a quick investigation, I was able to fix it; below are the quick steps.


Make sure under this commerce settings - you have the same store name which had configured in the site group settings.

/sitecore/Commerce/Commerce Control Panel/Storefront Settings/Storefronts

Under this, the item name (Storefront name) should match with one of the site grouping name here.



Easy fix  :) 

Fix for Sitecore XP and commerce- Could not find and method - AddDataProvider (type: Sitecore.Data.DefaultDatabase)


Recently, I got this issue with the latest commerce local deployment. After a quick investigation, I was able to fix it, here is the step and fix details.

I checked the logs in both Sitecore XP and XC authoring and found below error (XC authoring)

00001 14:07:48 INFO Application startup exception
System.IO.FileLoadException: Could not load file or assembly 'System.IO.Compression, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'System.IO.Compression, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
   at System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes)
   at System.Reflection.RuntimeAssembly.GetExportedTypes()
   at Sitecore.Framework.Configuration.Strategies.TypeStrategy`1.<>c.<Resolve>b__0_1(Assembly x)
   at System.Linq.Enumerable.<SelectManyIterator>d__17`2.MoveNext()
   at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Sitecore.Framework.Configuration.Strategies.Filters.TypeEnvironmentFilter.Filter(IEnumerable`1 input)
   at System.Linq.Enumerable.Aggregate[TSource,TAccumulate](IEnumerable`1 source, TAccumulate seed, Func`3 func)
   at Sitecore.Framework.Configuration.Strategies.StrategyBuilder`1.Using[TNext](IStrategy`2 next)
   at Sitecore.Framework.Runtime.SitecoreBootstrapConfigurationBuilder..ctor(String environmentName)
   at Microsoft.Extensions.DependencyInjection.RuntimeSitecoreServicesConfigurationExtensions.Bootstrap(ISitecoreServicesConfiguration sitecore, IServiceProvider hostServices, String environmentName, Action`1 config)
   at Sitecore.Commerce.Engine.Startup.ConfigureServices(IServiceCollection services)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection services)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices()
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.Initialize()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()


The issue was due to the wrong version of System.IO.Compression ,

I had updated the right version and that resolved the issue.

that's an easy fix :)