Production and Staging environments

Sitefinity Cloud provides customers with Continuous Delivery (CD) setup consisting of two isolated environments - Production and Staging. This way code changes are first deployed to the Staging environment, where stakeholders verify the project and new functionality is working as expected and will not affect the production website. Once verified, the new functionality can be promoted to the Production environment. Promoting code to Production is made possible while maintaining the public website availability.

Production environment

In the Production environment, content editors are able to author content in an efficient and secure fashion, utilizing the Sitefinity content editing capabilities and content approval workflow. Website visitors can access the public content via the website public URL. The Production environment scales automatically to ensure optimal performance and high availability.

Deploying new functionality to Production is done via preconfigured deployment pipelines available in the Management Portal.

The following diagram visualizes the production environment workflow:

ProdEnv

Staging environment

This environment is used by website stakeholders from the customer and partner teams, including business users and technical team like development and QAs. The environment is separated from Production and is designated for user acceptance testing (UAT). Unlike Production, which scales automatically, Staging consists of a static number of instances.

Deploying new functionality to Staging and then to Production is done via preconfigured deployment pipelines available in the Sitefinity Cloud Management Portal.StgEnv

Use different website configurations for different environments

Your Sitefinity Cloud website is configured in a Continuous Delivery (CD) pipeline setup. This way, code changes get deployed to Staging, and then to Production. In such setup, the code base does not change, however your website configurations might need to vary to reflect different environment settings, like connection strings, SMTP settings, and so on. Sitefinity Cloud enables you to leverage Continuous Delivery pipelines environment variables to easily define and manage the transformations for each environment. For more information see the Manage configurations in a CD pipeline article from the Sitefinity CMS documentation.

In case different configurations should be applied on the different environments, there are two options to do that, depending on the value type of the configuration itself. 

Sensitive information needs to be transformed

In this case, Sitefinity Cloud enables you to leverage Continuous Delivery pipelines environment variables to easily define and manage the transformations for each environment. Desired values should be entered as key-value pair in the variable group designated for the specific environment: 

  • Staging: _CUSTOMER_Staging_Variables 
  • Production: _CUSTOMER_Production_Variables 

src4

src3

Variable values can be marked as secret:

src5

During deployment pipeline searches the web.config for the input key and replaces its value with the value from the pipeline variable for the specific environment. As a prerequisite, you should add these configurations in your web.config:

Example:
<appSettings> 
    <!-- Notification Settings -->
    <add key="sf-env:notificationsConfig/profiles/Default:username" value="" />
    <add key="sf-env:notificationsConfig/profiles/Default:password" value="" /></appSettings> 

Non-sensitive information needs to be transformed

In Visual Studio, Staging and Production configurations should be added through the Configuration manager for the solution.

src6

After that you add config transform to the web.config:

src8 

Set the build action to Content to both Staging and Production transforms, in order to be included in the deployment package.

src9

Example:

Web.config:

  <appSettings> 
    <!-- My custom configurations -->
    <add key="sf-env:myCustomConfig:testMode" value="true" />    
  </appSettings>

Web.Production.config

<appSettings>
    <!-- My custom configurations -->
    <add xdt:Locator="Match(key)" xdt:Transform="SetAttributes" key="sf-env:myCustomConfig:testMode" value="false"/>    
  </appSettings>

During deployment Staging and Production transforms will be applied to the web.config. 

For more information, see https://docs.microsoft.com/en-us/aspnet/web-forms/overview/deployment/visual-studio-web-deployment/web-config-transformations


 

Was this article helpful?