HomeDev GuideAPI Reference
Dev GuideAPI ReferenceLegal TermsDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

Create a Customized Commerce site and deploy

Describes an onboarding deployment scenario to create a new Customized Commerce website and deploy the application, database, and content to the Integration environment in Optimizely DXP.

📘

When is this applicable?

This is an onboarding scenario for a first-time deployment when you want to set up a site and run development in a cloud environment from the beginning. Through Visual Studio you can deploy an empty database. A new site like this does not require database restore, and the database schema will be created during initial deployment.

Before you start

This topic uses Visual Studio with the Optimizely extensions and publish profiles. However, you can also use other deployment methods.

Deployment steps

This section describes how to create a website with an Optimizely Content Management System (CMS), Customized Commerce, and Azure and deploy the code and database with content to the Integration environment in DXP. The deployment is done from the deployment API using the publishing profiles provided with your DXP setup.

🚧

Important

A Customized Commerce solution consists of two databases: one for CMS and one for Customized Commerce. So, you need to repeat some deployment steps for each site.

STEP 1. Create Optimizely project

Follow the steps in Create a starter project.

dotnet new epi-commerce-empty
  1. Go to Tools > NuGet Package Manager > Manage NuGet Packages for Solution to update the website to the latest Optimizely NuGet packages.

  2. In the NuGet Package manager:

    1. Select Updates.
    2. Select Optimizely Packages in the Package source field to locate the latest updates.
    3. Enable Select all packages.
    4. Click Update and confirm the updates.

    Update NuGet packages

  3. Add a cloud platform to the website. In the NuGet package manager:

    1. Select Browse.
    2. Enter Optimizely Azure in the search field.
    3. Select the EPiServer.CloudPlatform.Commerce package.
    4. Select your project.
    5. Click Install and confirm the installation.

    confirm the installation

  4. To configure the EPiServer.CloudPlatform.Cms package, you need to add this code in ConfigureServices method in startup.cs file.

    🚧

    Important

    AddCmsCloudPlatformSupport is required for all DXP environments because it is needed for cache events and BLOB storage.

    public class Startup {
      public void ConfigureServices(IServiceCollection services, IConfiguration configuration) {
        ...
        services.AddCmsCloudPlatformSupport(configuration);
      }
    }
    

    📘

    Note

    If you only want to add the EPiServer.CloudPlatform.Cms package to specific environments, you can run something similar to the following code to check the environment.

    public void ConfigureServices(
      IServiceCollection services,
      IConfiguration configuration IWebHostEnvironment env) {
      ...
      if (env.IsDevelopment()) {
        services.AddCmsCloudPlatformSupport(configuration);
        services.AddCommerceCloudPlatformSupport(configuration)
      }
    }
    
  5. Run the solution.

STEP 2. Publish the website to create a code package

  1. Right-click the project in Visual Studio's Solution Explorer and select Publish.

  2. In the Pick a publish target dialog box, select New Folder.

    Pick a publish target

  3. Click Next.

  4. Choose a location or keep the default.

    Choose a location or keep the default

  5. Click Finish.

  6. Zip the contents of the publish directory and rename to ProjectName.cms.app.00001.nukpg.

STEP 3. Deploy the package

Get API credentials. See Deployment API authentication.

The following sample uses PowerShell to deploy the code. Any deployment API method will work as long as you deploy a package. 

# Connect EpiCloud using credentials from portal
Connect-EpiCloud -ProjectId "projectId" -ClientKey "key" -ClientSecret "secret"

# Upload .NET Core Alloy to blob storage
$sasUrl = Get-EpiDeploymentPackageLocation
Add-EpiDeploymentPackage -SasUrl $sasUrl -Path .\AlloyNetCore.cms.app.0.1.0.nupkg

# Deploy package to environment. This will first build a docker image out of the package and then deploy it to the target environment.
Start-EpiDeployment -DeploymentPackage "AlloyNetCore.cms.app.0.1.0.nupkg" -TargetEnvironment "Integration" -DirectDeploy -Wait

STEP 4. Verify the website

  1. Go to the default access URLs for the environment, for example http://\[projectNNNNinte\].dxcloud.episerver.net.
  2. Log in as an administrator to the website.
  3. Verify that the website is working.

STEP 5. Add Search & Navigation (formerly Find)

An index is automatically set up and configured as part of DXP. In this step, you add Optimizely Search & Navigation as the default search for your solution and publish the changes to Integration.

  1. In the NuGet package manager for your project, locate the EPiServer.Find.Cms package and click Install.

    locate the EPiServer.Find.Cms package and click Install

  2. In Solution Explorer, right-click the project in Visual Studio and select Publish.

    🚧

    Caution

    In the Edit > Publish > Settings screen, ensure that Update database is not selected (deselect if needed).

  3. Click Publish.

  4. Verify that the website is working.

See also: Deploy code changes