Episerver

Keep your environments in sync with Episerver DXP!

Gears

While iterating on projects it’s always a good idea to keep your lower environments in sync with the latest content and imagery from your production environment.  In some platforms this is a significant effort, but with Episerver DXP it can be easily automated!

Eric Markson from Perficient recently blogged about how to automate the orchestration of Episerver DXP.  Following in his footsteps, I’ve been able to successfully synchronize my Pre-production and Integration environments with production content and images in an automated fashion.  The process is quite simple.

First, we need to use the PromoteToEnvironment.ps1 script which you can fork or clone from here: https://github.com/ericmarkson/EpiCloud-Scripts.  If you want to learn more about this script, follow along on Eric’s blogs.  The jist of it though, is that we can call this with source and target environments with a number of switches.

In general, this script would normally be used to promote changes up.  Integration -> Pre-prod, Pre-prod -> Prod, etc.  The API also allows you to select what types of elements to promote: Code, Database, Blobs, etc.  What many people (including myself) don’t initially realize is: You can promote downward and skip the code.

This means that we can create two sets of automation:

  1. One to promote Code from Integration -> Pre-production -> Production (our standard Continuous Delivery style pipeline)
  2. A secondary to promote Database and blobs from Production -> Pre-production -> Integration
SAS IDC Episerver Commerce Guide
Delivering Customer-Centric Experiences for Digital Commerce

The IDC Technology Spotlight explores the rapidly changing commerce landscape and the top 5 benefits of a modern DXP.

Get the Guide

Setting this up is also incredibly simple within a tool like Azure Devops:

Content Migration Automation 1

In the above screenshot, I’ve created a release pipeline tied back to my application’s code base.  The application has the PromoteToEnvironment.ps1 script checked into source, which is used as an artifact on this release.  I schedule this release to run over the weekend, but really it could be executed every night if you wish.  For us, it takes about 30 minutes to execute per environment.

The job itself is quite simple as well:

Content Migration 2

 

The parameters here are also quite simple:

  • ClientKey, ClientSecret, and ProjectID: all of these are obtainable within the DXP portal.  Ours are set as variables attached to this release.
  • SourceEnvironment and TargetEnvironment: where you want to migrate to.  In this case we’re going from production to pre-production.
  • IncludeCode, IncludeBlobs, and IncludeDb: this is where the magic happens.  I don’t want to pull code from prod, because we’re using pre-production to test the latest code.  Instead, we want to pull the database and blobs, so we set these flags to 1.
  • SourceApp: for us, we’re migrating the CMS.  You could also migrate other parts of Epi as needed.

I personally thought this was really cool (borderline amazing) after working in other platforms where this type of task is nearly impossible.  It goes to show just how powerful the Episerver DXP platform really is.  Enjoy!

About the Author

I am a certified Sitecore developer, code monkey, and general nerd. I hopped into the .NET space 10 years ago to work on enterprise-class applications and never looked back. I love building things—everything from from Legos to software that solves real problems. Did I mention I love video games?

More from this Author

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Subscribe to the Weekly Blog Digest:

Sign Up