Meerkat - Compare Sitecore instances over HTTP
When working on Sitecore projects I’ve often found it cumbersome working with Sitecore items and keeping various instances in sync.
We have various tools and source control to facilitate continous delivery of our system centric Sitecore items, but there are still times when we have to manually push content centric Sitecore items between instances.
For example, you may have content in an authoring environment and you need to pull these items back into your local environment for testing. You may be working on an upgrade where a content freeze is not an option and you have to get all the changes since you started the upgrade. Again, there are tools available, but I wanted to have a free tool that would sit inside Sitecore and be a simple case of pressing a button to see all the changes. So I came up with Meerkat.
So what is it exactly?
Ok, it’s based upon Sitecore Courier, but instead of working with serialised items, the items are compared over http using a WCF service.
To make comparing work you have to have a Meerkat WCF setup on the same machine as your Sitecore instance. The service is a simple OData WCF Data Service setup to respond in the Atom format. Entity framework is then used to access the Sitecore items directly rather than using the Sitecore api. The service can be hosted using IIS or the simple console app that I have provided with the project.
This a basic aspx page that sits in your Sitecore instance. You enter the options in the form for specifying what instances you are synchronising. You need to supply the URL and port of a Meerkat service and the full file path of the Sitecore webroots of the instances.
The client makes use of SignalR to carry out the comparing and handle the long running process of comparing items whilst still providing feedback to the user.
Here’s a demo of the tool in action.
Firstly, we have to make sure the service is running. So fire up the Meerkat Service using the Meerkat.Sitecore.Selfhost Console App. When running the application you can specify the URL you want to use for the service and the port - I’ve used 8081 in this example.
With the service running, you can now start using the Meerkat Client.
Once you’ve installed the client in your Sitecore instance, go to /Meerkat.aspx in your browser.
For this demo, I’m only comparing my two Sitecore instances - IanTest and IanTest2 on one machine in the Sitecore instance IanTest, but the Sitecore instances can both be remote instances as long as there is a connection available and a Meerkat service running on the ports specified.
Once you have filled in the details of the instances, click the “Test connection” button.
If anything fails here, check you can access the URL in a separate browser - it will most likely be Firewall issues.
All being well, you will get the message back from the server.
At this point you will know that Meerkat will be able to carry out a compare.
The tool uses a date range to compare the instances, you may think this is strange.
The reason for this is if you compared two entire Sitecore trees the tool would run for a very long time. The tool could be adapted to do this, but for this first phase the Sitecore history table in the source instance is analysed to get all the modifications between certain dates.
Choose a date range where you know there have been some changes and click the “Analyse Differences” button to see it do it’s work.
The tool will go through all the changes made to the source instance and find out what items need to be added, changed and deleted to sync the target instance. The path of the items found are then added to a list as it finds them.
Once every item has been processed, you can then modify this list by unticking any items that you don’t want in the target instance.
When you’re happy with the items you need, click “Generate Package”. An update package will be created that you can use in the UpdateInstallationWizard.aspx page in your target instance.
At the moment I would descibe the tool as a proof of concept and there’s definitely room for enhancements. Some ideas for the future could include:
- Porting the .aspx page to the SPEAK interface
- Comparing entire branches
- Improving performance with Web API and json.
- Updating the target instance from the tool If you want to get involved, just fork it on GitHub: https://github.com/ianjohngraham/Meerkat.Sitecore.
Get the Meerkat.Sitecore.Client Sitecore Package here: Meerkat Client Sitecore package
To get the service running - download the solution from GitHub and compile and run the Meerkat.Sitecore.Selfhost Console App.
- This tool is a proof of concept and is not a commercial product. Use at your own risk.
- Please use the readme files before installing the package.
- Be aware of security implications of opening firewall ports.
- Always backup Sitecore databases before running update packages. Any questions you can get me at @ianjohngraham