As a Sitecore developer you often find you need to keep Dev and Staging environments up-to-date with Production in order to aid in development and in support and maintenance – otherwise it is very hard to successfully develop and test new features or replicate an issue from Production locally.
This used to mean manually backing up and restoring databases or creating Sitecore Packages to pull content down. This process is a labour intensive and error prone as well as a pretty daunting task :-(.
Sitecore Content Migrator to the rescue
Thankfully Jeff Darchuk created Sitecore Content Migrator back in October to do just this for you.
Sitecore Content Migrator is a free tool for Sitecore Sidekick which allows you to quickly and easily sync content down from one environment to another. It’s pretty simple to install and setup and then can be used whenever you want to carry out a sync.
It uses the same underlying technology as Unicorn (Rainbow), is pretty rapid and gives you some nice updates on progress along with a preview feature – so you can check all the changes before you run the import for real.
Installing & Configuring Sitecore Content Migrator
- First you need to install Sidekick itself. You can do this with the Sidekick Sitecore Module using the Sitecore package installer (https://marketplace.sitecore.net/en/Modules/S/Sitecore_Sidekick.aspx) or instead use NuGet to install it like so from Vistual Studios Package Manager Console:
Install-Package SitecoreSidekickCore -Version 1.0.0.
Ensure you install this on all environments you wish to pull content from as well as the environments where you will use it. This is because the service used by the Content Migrator must also exist remotely.
- Once you have installed the module you should find it has also installed 4 new config patch files (zSCS.config, zSCS.Aduitlog.config, zSCS.ContentMigrator.config, zSCS.Editingcontext.config). The one you want to edit is zSCSContentMigrator.config.
Alter the servers list to include the environments you want to pull content from, in our case Production and Staging:<servers hint=”raw:BuildServerList”>
<server>https://production.yoursite.com</server>
<server>https://staging.yoursite.com</server>
</servers>
Time to Sync
- Go to an environment where you want to sync content to. Click on the Start button and open Sitecore Sidekick. Then click on ‘Content Migrator’:
- Select the server to pull content from (e.g ‘production.yoursite.com’), then browse the content node and select the content you wish to sync.
- Then check any of the following options to sync all content down and update the local site:
– ‘Migrate all children of selected item’
– ‘Overwrite all existing content with new content from the server’
– ‘If parent doesn’t exist locally add that too’
– ‘Make local content tree mirror the remote content tree’ – Note: Jeff confirmed to me on Slack that this maintains the existing Sitecore IDs. So this is great if you use Unicorn and don’t want to mess up Dev content IDs.
– ‘Run using the event disabler’
– ‘Run using the bulk update context’
Further information on these options and what they do can be found here: Sitecore Content Migrator
- Click the ‘Preview’ button
- Check that everything looks ok
- Click the ‘execute this operation’ button.
- Monitor the import and check that it completes successfully – look under the ‘Currently Running Operations’ section.
- Publish the site
- Test the site works as expected in your environment
- Rejoice as not having had to do much
Suggested Improvements
- It would be really good to support automated scheduled syncs either by setting this up in config or saving an migration config. – I’ve already suggested this to Jeff and he’s logged it as a feature request.
- It would also be cool to be able to sync multiple root nodes, e.g content and media library items at once.
All in all this is a great tool for making content syncs a whole lot simpler and allowing you to concentrate on development instead of manually keeping your environments in sync.
Nice article !
I have following question –
My CM server does not have default sitecore password.
Do i need to do any separate changes for this updated password, or will it work just by giving CM server url in server tag ?
No worries. In newer versions there is now an authentication key. You should generate a key and update this in the config and this is what is used to communicate with your CM server. You can read more about this here: http://www.flux-digital.com/blog/upgrading-sitecore-content-migrator-and-scheduling-content-syncs/
Hi
I has question on the ”: Is this the list of CM servers only and not the CD servers?
Yes the list is just the CM servers as it Syncs to the Master database, you can then review and publish the content as required to your CD Servers. It does not automatically publish to the CD Servers.
I has question on the ”: Is this the list of CM servers only and not the CD servers?
Also does the ‘Pull’ function pull the content into master only and I have to manually publish into CD/s or does it to that automatically?
I has question on the raw:BuildServerList: Is this the list of CM servers only and not the CD servers?
Also does the ‘Pull’ function pull the content into master only and I have to manually publish into CD/s or does it to that automatically?
Please see my reply above. It is just the CM Servers. Regarding Auto-publishing this is not support as far as I’m aware, I did ask Jeff about this a while ago but I don’t think he’s built in support for it yet. What I have done before though is use Sitecron to auto-publish specific items at a certain time each day: https://www.akshaysura.com/2015/06/25/smart-and-incremental-publish-using-sitecron-for-sitecore/. I presented at the Manchester SUG about this and you can find my slides here: https://www.slideshare.net/AdamSeabridge/automating-content-syncs-using-content-migrator/AdamSeabridge/automating-content-syncs-using-content-migrato. You could do this after the auto-sync job has run (this is supported out of the box) or you could also use the SPE module to auto-run the sync of content before the Sitecron Job runs instead of using the auto-sync job: https://github.com/JeffDarchuk/SitecoreSidekick/tree/master/Scripting.