Creating a new CMS site and deploying
This topic describes a simple deployment onboarding scenario where you create a new website based on the Episerver Alloy sample site, and deploy the application, database and content to the Integration environment in Episerver Digital Experience Cloud Service.
When is this applicable?
This is an onboarding scenario for a first-time/onboarding deployment of a new site based on the Episerver sample templates, to use from start for development in a cloud environment. Through Visual Studio you can deploy an empty database. A new site like this does not require database restore, and the database schema is created during initial deployment.
Before you start
Use Visual Studio with the Episerver extensions and publish profiles. You also can use other deployment methods.
- See Requirements for recommended versions of software, tools and services to use when deploying.
- See Getting started with DXC Service for information needed to deploy.
- See Installing Episerver how to add the Episerver NuGet feed to Visual Studio.
- Update the Azure SDK to the latest version for your Visual Studio installation.
The following steps create a new website, add Azure and Find, and deploy the code and database with content to the Integration environment in DXC Service. The deployment is done from Visual Studio, using the publishing profiles provided with your DXC Service setup.
STEP 1. Create a website with Azure
- In Visual Studio, create a new project by selecting New...Project, and then EPiServer Web site. In the dialog box, select Alloy templates (MVC or Web Forms), and clear the Configure Search option. Episerver Find is added in a later step.
- Update the website to the latest Episerver NuGet packages. Right-click on References for the project and select Manage NuGet packages. Select Updates and Episerver to locate the latest updates, select all packages and click Update.
- Add Azure to the website: in the NuGet package manager for your project, locate the EPiServer.Azure package and click Install.
- Compile the solution, follow the instructions to update the database (if needed), reload and verify that the website is working.
STEP 2. Update the configuration
You need to change some configurations for the website to work with Azure. The attribute container for the BLOB provider and topic for event provider should be unique per site, within the same storage or service bus account. This means that you need to update the mapping for BLOBs and event providers.
Note: Do not skip this step! If you do, assets are stored locally, and will not deploy properly to the Azure Blob storage.
- In Visual Studio, open web.config and add the following configuration under the episerver.framework section.
Note: Do not change the values for connectionStringName, as these will be overwritten with the correct environment-specific values during deployment. Optionally, you can change the container and topic names "mysitemedia" and "MySiteEvents" to names of your choice.
<blob defaultProvider="azureblobs"> <providers> <add name="azureblobs" type="EPiServer.Azure.Blobs.AzureBlobProvider,EPiServer.Azure" connectionStringName="EPiServerAzureBlobs" container="mysitemedia"/> </providers> </blob> <event defaultProvider="azureevents"> <providers> <add name="azureevents" type="EPiServer.Azure.Events.AzureEventProvider,EPiServer.Azure" connectionStringName="EPiServerAzureEvents" topic="MySiteEvents"/> </providers> </event>
- Compile the solution. Your local site displays an error message because the site is pointing to Azure after the configuration changes. This is corrected when you publish the project to Azure.
Note: When you deploy a website, you may want settings in the deployed application's web.config to be different from your local development web.config. Instead of changing these settings for your local installation as done here, you can apply a transformation of the web.config file when you deploy to Azure. This way you can avoid breaking your local site.
STEP 3. Publish code and database with content
- Right-click on the project in Visual Studio and select Publish.
- Click Import to browse and select the publish profile for the Integration environment, import the settings from the publish profile and click Next.
- Connection should display the imported publish profile settings; no changes are required here. Click Next (not Publish).
- In the Settings step, enter the remote connection string to SQL Database by selecting it under the EPiServerDB section.
- Enable Update database, click Configure database updates and then clear the [Auto schema update] option.
- Click Add SQL Script and browse to the EPiServer.CMS.Core NuGet packages (located in [SolutionDir]\packages\EPServer.CMS.Core.N.N.N\tools\ and select EPiServer.Cms.Core.sql. Click Close when done.
- Click Publish to publish the website and database. The website opens in a browser when finalized. Otherwise, you can access it with the default URL for the environment. It may take up to one hour before the CDN is available for usage, the site may display an error message during this time.
Note: Episerver has a bootstrap feature for deploying content. If there is an export package located in [SolutionDir]\App_Data\DefaultSiteContent.episerverdata, then that package is imported during initialization and a site with content is created. The bootstrap is applied only if the site does not have any existing content, as in this scenario.
- Go to the default access URLs for the environment, for example http://[projectNNNNinte].dxcloud.episerver.net.
- Log in to the website using the administrator user provided.
- Verify that the website is working.
Note: If you do not have a provided password, you can create and upload an aspx file to your web app, and let it create an administrator account. See these example files for ASP.NET Membership and ASP.NET Identity, select the appropriate one depending on your provider.
When the site is started after the publishing, you might receive a temporary missing license notification, until the cloud license is retrieved.
STEP 5. Add Find
Add Episerver Find as default search for your solution, and a Find index is automatically set up and configured as part of DXC Service.
- In the NuGet package manager for your project, locate the EPiServer.Find.Cms package and click Install.
- Compile the solution.
- Publish the solution again as in STEP 3 above, but skip sub-step 5 and 6 to ensure that "Update database" is not selected.
- Verify that the website is working.