[Sitecore.HabitatHome.Commerce] – Replace localhost binding by habitathome.dev.local

If we’ve already installed Sitecore.HabitatHome.Commerce on our machine (see this post in case it’s not ready), all of Commerce Engine sites include BizFx and IdendityServer are using the localhost within its SSL Certificate as default binding. Hence, it’s impossible to have a new Sitecore Commerce site on the same machine (a.k.a. multi Sitecore Commerce instance on the same machine). In this post, I’m going to list out steps-by-steps to replace the binding of localhost by the main host name – habitathome.dev.local.

1- Add & Set binding for Commerce Sites

  • Suppose that Sitecore.HabitatHome.Utilities at D:\Sitecore\Sitecore.HabitatHome.Utilities
  • Open the Add-BindingsToCommerceSites.ps1 by any text editor; update the corresponding values in below

[string] $hostName = "habitathome.dev.local",

[string] $CertificateName = "habitathome.dev.local",

  • Open the Set-CommerceEngineHostName.ps1 by any text editor, update the following values

[string] $CertificateName = "habitathome.dev.local",

[string] $HostName = "habitathome.dev.local",

  • Open the PowerShell as administrator, then change the location to XC\install

Set-Location D:\Sitecore\Sitecore.HabitatHome.Utilities\XC\install

  • Add the new binding (i.e. habitathome.dev.local) to Commerce Sites

.\Add-BindingsToCommerceSites

  • After executing preciding, the current path is XP\install; therefore we have to go back to XC\install to do the remaining steps

Set-Location ..\..\XC\install

  • Then, set host name for Commerce Engine

.\Set-CommerceEngineHostName.ps1

  • Finally, use the script Remove-BindingsFromCommerceSites.ps1 to remove the localhost binding and its SSL Certificate from the following Commerce Sites:
    • CommerceAuthoring_habitathome
    • CommerceMinions_habitathome
    • CommerceOps_habitathome
    • CommerceShops_habitathome
    • SitecoreBizFx_habitathome
    • SitecoreIdentityServer_habitathome

2- Update commerceEngineConfiguration

sitecore-commerce-engine-config
App_Config\Include\Y.Commerce.Engine\Sitecore.Commerce.Engine.Connect.config

 

3- Update the Commerce Engine Url from Sitecore.HabitatHome.Commerce

wwwroot\data\Environments

Find and replace https://localhost:5000 by https://habitathome.dev.local:5000 in the following configuration files:

  • PlugIn.Habitat.CommerceAuthoring-1.0.0.json
  • PlugIn.Habitat.CommerceMinions-1.0.0.json
  • PlugIn.Habitat.CommerceShops-1.0.0.json

wwwroot\config.json

config-json
Sitecore.HabitatHome.Commerce\src\Project\HabitatHome\engine\wwwroot\config.json

4- Modify the script of deploying Commerce Engine from Sitecore.HabitatHome.Commerce

  • Open the deploy-commerce-engine.ps1 by any text editor, update the following parameters

[string] $engineHostName = "habitathome.dev.local"

[string] $identityServerHost = "habitathome.dev.local:5050"

  • Re-boostrapped the Commerce Engine for Sitecore.HabitatHome.Commerce by executing

.\deploy-commerce-engine.ps1 -Bootstrap -Initialize

5- Update the business tool Url form Content Editor

update-business-tool-url

6- Verify the changes

  • Verify the business tool Url from Launchpad

Launchpad - BusinessToolUrl

  • Verify the business tool still work correctly
    • Able to loginLogin-BusinessTool
    • Able to use after logged inBusinessTool - NewUrl

Summary

Now, the HabitatHome Demos and its Commerce Sites have not used localhost binding anymore, instead they’re using the specific hostname (i.e. habitathome.dev.local). Next time, I will install a second instance of Sitecore XP within Sitecore XC.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s