Deploy the Commerce Engine
Compile the Commerce Engine
To compile the Commerce Engine:
- Install the Sitecore Commerce SDK by unzipping the
Sitecore.Commerce.SDK.1.x.xxxx.zip
file, located at the root of the Sitecore Commerce release package. - Open a command prompt and run the restore command from the SDK root
folder:
dotnet restore
Note: By default, thedotnet.exe
is installed underc:\Program Files\dotnet
if the path has not been added automatically. - Run the publish command to create a build of the Sitecore Commerce Engine in a
local folder. For example:
dotnet publish .\Sitecore.Commerce.Engine -o c:\Deploy\Sitecore.Commerce
Note: Make sure that the installed version of the .NET Framework is the DevPack/SDK edition, not the Runtime edition. Thedotnet publish
command will fail if only the Runtime edition is installed.
Create the Commerce Server databases
- Open SQL Server Management Studio.
- Run the
CommerceServicesDbScript.sql
script (located in the Sitecore SDK directory).
Install the Commerce Engine service
To install the Commerce Server Engine service:
- Open IIS Manager.
- Create a new Application Pool called CommerceAuthoring and set the
following:
- Select No Managed Code for the .NET CLR Version of the App Pool.
- Select Integrated for Managed pipeline mode.
- Set the Identity to use the same
CSFndRuntimeUser
that you used for Commerce Server as the identity.
- Create a new IIS Site called CommerceAuthoring:
- Keep the default binding settings with the exception of the port, which is set to 5000.
- Set the Application Pool to the application pool you created in step 2.
- Create a new folder in
C:\inetpub
calledCommerceAuthoring
and set the Physical Path to this new folder.
- Copy the contents of the
c:\Deploy\Sitecore.Commerce
folder (created when you compiled the Commerce Server Engine) to the new physical directory you created in step 3. - Verify that you can retrieve metadata from the Commerce Engine service via the following URL: http://localhost:5000/api/$metadata.
Configure web payment functionality for the site
Create a Braintree sandbox account to incorporate web payment functionality into your storefront site.
To create a Braintree sandbox account:
- Go to https://www.braintreepayments.com/sandbox.
- Enter the required information in the Sign up for the sandbox pane, and click Try the sandbox.
- Follow the instructions to activate and log in to your Braintree sandbox account.
- Get the MerchantID, Public Key and Private Key information from the Braintree sandbox website.
- Use the information from step 4 to fill in the corresponding section inside the
PlugIn.Habitat.CommerceAuthoring-1.0.0.json
file under the wwwroot\data\Environments folder (in the IIS site folder you created when you installed the Commerce Engine service).- Search for
"$type": "Plugin.Sample.Payments.Braintree.BraintreeClientPolicy, Plugin.Sample.Payments.Braintree"
inside thePlugIn.Habitat.CommerceAuthoring-1.0.0.json
file - Make sure the key values are contained by quotation marks. For
example:
"MerchantId": "hmkcvh546n4h4875", "PublicKey": "6mr6yhpxfdm9dw23", "PrivateKey": "e94bbef4a521c344f47e2a8c26f7e89d",
- Search for
Bootstrap and initialize the Commerce Server environment
The Bootstrap process loads the environments from the data/environments directory in the physical location of the IIS service to the Commerce Engine service.
The Habitat catalogs and inventory (located under
wwwroot\data\Catalogs
) are imported during the bootstrap
process. You can verify that all catalogs and inventory are imported through the
Catalog Manager. If they are not present, you must import them manually.
Make sure that the application pool identity for the Commerce Authoring site
((.\CSFndRuntimeUser)
) has the proper permissions for the
Catalog web service in the Windows Authorization Manager.
- Open a browser and run http://localhost:5000/commerceops/Bootstrap(). The URL is
case-sensitive.
When the Bootstrap process finishes, you can view new rows inside the "CommerceEntities" and "CommerceLists" tables of the SitecoreCommerce_Global database.
If the Bootstrap process does not finish as expected, check the
CommerceAuthoring\wwwroot\logs
for possible errors. - Run the Initialize Environment process to initialize the following
environments for the Commerce Authoring Service. Note that the following
URLs are case-sensitive; if you copy the URLs from this topic, make sure
there are no invisible formatting characters for the quotation marks.
- Open http://localhost:5000/commerceops/InitializeEnvironment(environment='AdventureWorksShops') in a browser to initialize the Adventure Works environment.
- Openhttp://localhost:5000/commerceops/InitializeEnvironment(environment='HabitatAuthoring') in a browser to initialize the Habitat Authoring environment.
When the initialization process finishes, you can view new rows inside the "CommerceEntities" and "CommerceLists" tables of the
SitecoreCommerce_SharedEnvironments
database.If the initialization process does not complete as expected, check theCommerceAuthoring\wwwroot\logs
for possible errors.Note: If you need to run the initialization process again, you must clear all rows in the "CommerceEntities" and "CommerceLists" tables and restart the CommerceAuthoring site to clear the cache. - If you need to run the Minion services automatically for post-order
processing, make sure the
EnvironmentName
attribute in the\CommerceAuthoring\wwwroot\config.json
file is set to "HabitatMinions". - Restart the CommerceAuthoring IIS service to complete activation.