Pages

11 September, 2023

XM Cloud: Sync Content between Environments

To sync content between XM Cloud Environments, SCS (Sitecore Content Serialization) is the preferred way when compared to old way of moving content using Sitecore Content Packages. In this article, we will move content from one environment to another by an easy way. 

Scenario: 

Two environments: DEV and PROD
Content Sync: Copy from PROD to DEV or Copy from PROD to Local
Content to be copied:

  • /sitecore/content/samplesite/samplesite/Home
  • /sitecore/content/samplesite/samplesite/Data

Sitecore Content Serialization (SCS) is a system for serializing, sharing, and deploying content items, as well as keeping them in version control.

Ref: https://doc.sitecore.com/xmc/en/developers/xm-cloud/sitecore-content-serialization.html

The flow is to connect to PROD, DEV and Local (if planning to sync it to local) environment using CLI connect command and then use CLI serialization command to pull from source Environment to target Environment. 


Step 1: Connect to Environments

Before we connect to XM Cloud Environments, it is important that Sitecore CLI with plugins are installed. XM Cloud Environment IDs are needed to connect. Use CLI connect command with --allow-write flag to enable read/write access for environments. 

PROD ID: 1rg2Cn4Nz9HlMvJDoMlp0R
DEV ID: 5uQrDqtEeitxTlNdOCTmwM

Step 2: Add Serialization Module to Content Sync Purpose

In order to sync only a specific set of content, it is optional to create a separate serialization module json file. In our scenario, we are pulling only the pages and the data folder. Create a module json with the below includes. 

Step 3: Pull Content from Source Environment

Using CLI Serialization command, pull the content by targeting only our content sync module. 

Step 4: Push Content to Target Environment


That's it. 

Every data is pulled and pushed via APIs. Copying huge number of items or bigger size media files may delay the sync process. 

No comments:

Post a Comment

blockquote { margin: 0; } blockquote p { padding: 15px; background: #eee; border-radius: 5px; } blockquote p::before { content: '\201C'; } blockquote p::after { content: '\201D'; }