SDL Web 8: Migrating From Old- to New-Style Publishing (Part 2 of 3: the example script)

As mentioned in the previous post, SDL Web 8 introduced a new publishing setup using Topology Manager. Although the new model provides number of benefits, migration of an existing setup to Topology Manager requires manual steps, re-configuration, and publishing.

In order to speed up re-configuration and explain how Publication Target-based configuration map to items in Topology Manager conceptually, the SDL Web Content Manager team implemented the following sample PowerShell script Generate-Topology.ps1. This script analyses Content Manager environment and guides you through the re-configuration process.

As a technical implementer, you should review and update this script to meet the needs of your implementation. Feedback "from the field" suggest being sure of the setup before running your script (e.g. removing business process types can take a lot of steps) as well as being explicit with the Business Process Types and Purposes in your environments. Hard-coding might be appropriate for a one-off script. Similar to "content migration" projects, you may likely run the tool more than once and as such so consider optionally double-check the existence of settings unless you're completely confident of the changes.

We will post this script to GitHub to allow implementers to submit pull requests and modify it as needed.

The script has the following steps:

  1. The script analyses the Content Manager (CM) for used Publication Targets. Conversion is possible for a Publication Target that is in use (has one associated Target Type and at least one Publication in scope) with a single destination.
  2. Next it generates a Content Delivery (CD) Environment for each active Publication Target (user is asked for missing details such as the purpose of this environment or URL to the Content Delivery Discovery service). Note that the purpose should be unique for each CdEnvironment.
  3. A WebSite with root WebApplication also gets created on each CD Environment to get started. Later on, if the same environment serves multiple websites or a website has several web applications, they can be configured as well using PowerShell cmdlets.
  4. After all publication targets are migrated to CD Environments, the script creates a CD Topology Type with all purposes. Here we assume that the combination of CD environments with all unique purposes will constitute a complete stack used for publishing (typically, it will be a combination of two environments: Staging and Live).
  5. Next, on the Content Manager server, the script creates a Business Process Type (BPT) in the root publication using the Topology Type that was created previously. Having a single BPT created in root publication allows you to reuse it in publications on lower levels, where publishing is typically performed. In order to enable publishing through a Business Process Type, it must be linked to a publication (in the publication properties screen). Note that having a BPT on a higher level of BluePrint does not automatically allow publishing from all over the BluePrint, you must first link it to a specific publication first to make it active. Also note that the script copies security settings from original Target Types to a new Target Types created as part of the Business Process Type.
  6. Having all previous steps successfully done, the script configures publishing for each publication where it was configured via migrated Publication Targets. For each such publication script does following actions:
    1. Assigns shared BPT to a publication to enable publishing via that Business Process Type.
    2. Sets PublicationUrl on a publication properties to empty string. The PublicationUrl is a deprecated concept in the new-style publishing as server-relative URL gets derived from a combination of WebApplication.ContextUrl and Mapping.RelativeUrl. It is possible to configure different server-relative URLs on a publication for different purposes (e.g. content might get published to http://contoso.de on a CD Environment with Live purpose and to http://staging/de/ on staging environment).
    3. Creates mapping between current publication and a CD Environment with specific purpose for each Publication Target active in that publication (e.g. if publication had publishing configured both to Staging and Live Content Delivery instances, two mappings will be created to a respective CD environments in Topology Manager).
    4. Re-purposes publish states. In the Publication Target-based publishing, content gets published to a Publication Target and that information was stored in the Content Manager. With a Topology Manager-based publishing, content gets published to an environment with a specific purpose which is represented in CM as a Target Type in Business Process Type. In order to skip re-publishing of the content after changing a configuration, it is possible to just update publish states stored in the Content Manager and link published items to a new Target Type, instead of outdated Publication Target.
  7. After all re-configuration are done, the script reports changes done to both Topology Manager and Content Manager for review and as a future references on what else needs to be done for migrating publishing configuration.

Here is a sample output script produces:

====================== Script execution result ======================

Items created in the TopologyManager:

CdEnvironments:
1) Id = 'CdEnvLive'; EnvironmentPurpose = 'Live'
2) Id = 'CdEnvStaging'; EnvironmentPurpose = 'Staging'

Websites:
1) Id = 'LiveSite'; BaseURL = 'http://10.91.5.176'
2) Id = 'StagingSite'; BaseURL = 'http://10.91.5.176:82'

WebApplications:
1) Id = 'LiveSite_RootWebApp'; ContextURL = '/'
2) Id = 'StagingSite_RootWebApp'; ContextURL = '/'

CdTopologyType:
1) Id = 'GeneralTT'

Mappings:
1) Id = 'tcm0_115_1_Live'; WebApplicationId = 'LiveSite_RootWebApp'; PublicationId = 'tcm:0-115-1'; RelativeUrl = '/LU/'
2) Id = 'tcm0_115_1_Staging'; WebApplicationId = 'StagingSite_RootWebApp'; PublicationId = 'tcm:0-115-1'; RelativeUrl = '/LU/'
3) Id = 'tcm0_116_1_Live'; WebApplicationId = 'LiveSite_RootWebApp'; PublicationId = 'tcm:0-116-1'; RelativeUrl = LU_mob'
4) Id = 'tcm0_116_1_Staging'; WebApplicationId = 'StagingSite_RootWebApp'; PublicationId = 'tcm:0-116-1'; RelativeUrl = 'LU_mob'
5) Id = 'tcm0_118_1_Live'; WebApplicationId = 'LiveSite_RootWebApp'; PublicationId = 'tcm:0-118-1'; RelativeUrl = /EU/'
6) Id = 'tcm0_118_1_Staging'; WebApplicationId = 'StagingSite_RootWebApp'; PublicationId = 'tcm:0-118-1'; RelativeUrl = '/EU/'


Content Manager changes:

Created Business Process Types:
1)'Bpt_GeneralTT' (Id = 'tcm:2-15685-4096') in Publication '00_Empty' (Id = 'tcm:0-2-1')

Business Process Types associated with Publications:
1) Publication: 'Desktop LU-fr' (Id = 'tcm:0-115-1'); Business Process Type: 'Bpt_GeneralTT' (Id = 'tcm:115-15685-4096')
2) Publication: 'Mobile LU-fr' (Id = 'tcm:0-116-1'); Business Process Type: 'Bpt_GeneralTT' (Id = 'tcm:116-15685-4096')
3) Publication: 'EU-da' (Id = 'tcm:0-118-1'); Business Process Type: 'Bpt_GeneralTT' (Id = 'tcm:118-15685-4096')

Publish states of published items repurposed from Publication Targets to new Target Types:
1) Publication: 'Desktop LU-fr' (Id = 'tcm:0-115-1'); Publication Target: 'FTP_UAT1_WS01_PEP' (Id = 'tcm:0-17-65537'); Target Type: 'Cloned_Live_UAT PEP' (Id = 'tcm:0-31-65538')
2) Publication: 'Desktop LU-fr' (Id = 'tcm:0-115-1'); Publication Target: 'UAT local' (Id = 'tcm:0-26-65537'); Target Type: 'Cloned_Staging_UAT Local' (Id = 'tcm:0-32-65538')
3) Publication: 'Mobile LU-fr' (Id = 'tcm:0-116-1'); Publication Target: 'FTP_UAT1_WS01_PEP' (Id = 'tcm:0-17-65537'); Target Type: 'Cloned_Live_UAT PEP' (Id = 'tcm:0-31-65538')
4) Publication: 'Mobile LU-fr' (Id = 'tcm:0-116-1'); Publication Target: 'UAT local' (Id = 'tcm:0-26-65537'); Target Type: 'Cloned_Staging_UAT Local' (Id = 'tcm:0-32-65538')
5) Publication: 'EU-da' (Id = 'tcm:0-118-1'); Publication Target: 'FTP_UAT1_WS01_PEP' (Id = 'tcm:0-17-65537'); Target Type: 'Cloned_Live_UAT PEP' (Id = 'tcm:0-31-65538')
6) Publication: 'EU-da' (Id = 'tcm:0-118-1'); Publication Target: 'UAT local' (Id = 'tcm:0-26-65537'); Target Type: 'Cloned_Staging_UAT Local' (Id = 'tcm:0-32-65538')

Publications updated with empty 'PublicationUrl' property:
1)'Desktop LU-fr' (Id = 'tcm:0-115-1')
2)'Mobile LU-fr' (Id = 'tcm:0-116-1')
3)'EU-da' (Id = 'tcm:0-118-1')


Detected problems:

Skipped Publication Targets:
1)Publication Target: 'FTP_STAGE_WS01_PEP' (Id = 'tcm:0-6-65537'); Reason: 'Current Publication Target does not have associated Target Types.'
2)Publication Target: 'FTP_PROD_WS01_PEP' (Id = 'tcm:0-10-65537'); Reason: 'Current Publication Target does not have associated Target Types.'
3)Publication Target: 'FTP_DEV1_WS01_PEP' (Id = 'tcm:0-14-65537'); Reason: 'Current Publication Target does not have associated Target Types.'
4)Publication Target: 'FTP_PREPROD_WS01_PEP' (Id = 'tcm:0-23-65537'); Reason: 'Current Publication Target does not have associated Target Types.'
5)Publication Target: 'Staging Local' (Id = 'tcm:0-24-65537'); Reason: 'Current Publication Target does not have associated Target Types.'
6)Publication Target: 'DEV local' (Id = 'tcm:0-25-65537'); Reason: 'Current Publication Target does not have associated Target Types.'
7)Publication Target: 'FTP_DEV2_WS02_PEP' (Id = 'tcm:0-27-65537'); Reason: 'Current Publication Target does not have associated Target Types.'
8)Publication Target: 'FTP_DEV3_WS03_PEP' (Id = 'tcm:0-28-65537'); Reason: 'Current Publication Target does not have associated Target Types.'
9)Publication Target: 'FTP_UAT2_WS02_PEP' (Id = 'tcm:0-29-65537'); Reason: 'Current Publication Target does not have associated Target Types.'
10)Publication Target: 'FTP_UAT3_WS03_PEP' (Id = 'tcm:0-30-65537'); Reason: 'Current Publication Target does not have associated Target Types.'
Generate-Topology.zip