Sitecore #1; On Sitecore and Syncing
As part of my job, I was thrown back onto a large Sitecore project that I last built a month ago. It should be easy to get back up-and-running, right?
Wrong!
Pulling the latest code and building it wasn't enough - after all, as I found out in my work on Moosecore, items need to be built and synced over to the Sitecore instance, which runs on SQL (Sitecore can run on another databackends as well, but SQL is the most common).
TDS has a built-in function to Sync items between the code Project and Sitecore itself. From what I can gather, this process uses a clever bit of coding to setup a webservice on Sitecore that takes the serialized items that TDS generates in the code Project and compares them against the items in Sitecore, then generates a list of differences.
This process does not seem to have caching of any sort, and on large projects such as the one I'm on, will take several minutes to generate a list, and has to be regenerated each time you run it.
Once you have a list, you can mark which direction items should be synced: Sitecore -> Project, Project -> Sitecore, or Merge the differences.
Copying over files from the Project to Sitecore can fail for a number of reasons, one of which being that a required Template is missing, and has to be synced first before the item can be synced.
I didn't think this was a problem until I saw our setup: a fairly standard TDS setup of CORE, MASTER, and WEB. MASTER had the templates, so I had to cancel out of my current WEB sync, wait several minutes for MASTER to generate a differences list, sync the template, then wait several more minutes for WEB to reload a new differences list to sync that item over.
If TDS can detect that Item A needs Template B to sync, why does it not give me the option to sync both right away? If I am being forced to constantly switch between the difference lists, can I at least get some caching so it doesn't take 5 minutes each time I want to sync an item?
There are some alternatives out there that try to solve these problems:
Sitecore Unicorn is a lightweight and opensource item serializer that ensures the local copy of Sitecore is always up-to-date with the codebase by using Git and forcing merges right away. This seems like an ideal solution, but I don't thing Unicorn will play friendly with TDS, and I certainly don't have an option to switch to it. TDS has far more than item serialization to it, and more than just Unicorn would be required to replace it.
Sitecore Courier seems friendlier to use with TDS, as it looks for differences after the fact and creates a package that will install those changes to Sitecore. It's less efficient, as it doesn't seem to use the Git Diff, and therefore computes the changes itself, and it takes more steps, but it could be added to a build chain to keep your Sitecore up to date.
Sitecore Ship plays along very well with Courier - Ship lets you install Sitecore packages via HTTP request. Although less useful for local installs, Ship could simplify automation of using Courier in both local and server based Sitecore instances.
What I most want, however, is a way to just click a button that says "Sync Sitecore items from Git" that will take all of the differences between my last sync and now, then send them over to Sitecore to add them. Courier seems closest to this, but I'm not sure how well it keeps track of Git history.
Making such a tool would be a good way for me to learn how to produce Nuget packages as well as the Sitecore Item API, so I'm tempted to give it a go. If I proceed, you will find my progress and troubles here!













