Wednesday, October 3, 2012

Sitecore Courier - Effortless Packaging


The first question many Sitecore developers ask when they start thinking about deploying changes with Sitecore is – “How to track item changes?” The deal is - you cannot simply deploy the updated site from version control system (VCS), because production site also holds content items, being constantly edited by content editors, and you need to merge it.

The most straightforward (if not only) solution – is to use Package Designer, but… I want packages to be generated automatically, when I change the template, add a new field to the item, etc. – it is extremely hard to keep track of all these bits.  And another important thing is field changes – if I change just __Presentation field – how do I deploy it to production without overwriting the other ones?

The solution is in the Sitecore.Update.dll, where you can find the code needed to generate “.update” packages. And you can do it automatically, by comparing serialized trees with the module I’ve just created and called Sitecore Courier.

The module can be installed as a Sitecore package, or used in build system with simple .exe runner.

Suggested usage workflow

After you deploy the initial version of your website to production, you should:
  1. Serialize all items you want to move between the servers (usually, all custom items in Core and Master databases). Check the latest Serialization Guide here.
  2. Create a TAG from it in a version control system
  3. Keep doing changes in TRUNK, serialize changed items, commit them, etc.
And packages will be generated automatically, by comparing serialization from TAG (source) to the TRUNK (target). Incremental package will contain only changed items.

Web Runner of the module should be mostly used for quick testing, here's the UI:


Web UI lets you analyze the differences between the folders and select the changes you want to include into the package.
And .exe runner can be used in your build system - it accepts 3 parameters (I've also added sample paths):

/source:F:\serialization1\
/target:F:\serialization2\
/output:C:\Package.update

Here's how the resulting package looks from within:


The module allows to use the full power of Sitecore serialization feature, that includes but not limited to:


  • No more manual packages - allows automated continuous deployment
  • Keep track of every single bit of content created by developers - use VCS to store items
  • Easily backup / rollback / revert items 
  • Only changed fields are packaged - extremely quick installation
  • Use rock-solid Sitecore feature. Some guys serialize gigabytes of data


Current feature set is just a proof of concept, the plans include:

  • Integration with Sitecore Rocks
  • Tools for Continuous Deployment 
  • and more! (let me know what you'd like to see)

So, download the module here (you might want to build exe runner from sources), share your feedback, and enjoy!

33 comments:

  1. Hey alexander, would this work for sitecore 6.6 i tried testing but many methods in DiffGenerator returns null, like (Factory.Instance.GetSourceDataManager()), with some configuration error. its a fresh clean 6.5 install

    ReplyDelete
    Replies
    1. Thanks, i think an easy fix and something that should be part of the soloution was a include config file... And you can always record a video on your issue and post it on tiktok, where a large number of userd could see it and give an advise how to solve this problem. Don`t forget to buy tiktok followers and quickly boost their number.

      Delete
  2. Hi, I'll check it. The module should work on all versions of Sitecore.

    ReplyDelete
  3. well here are my steps compiled the code, threw it in the bin folder, aspx page in admin folder.

    i just tried against the recommended 6.5 clean install wouldnt work either.

    error is like this:
    [ArgumentNullException: Value cannot be null.
    Parameter name: key]
    System.Collections.Generic.Dictionary`2.FindEntry(TKey key) +14167413
    System.Collections.Generic.Dictionary`2.ContainsKey(TKey key) +9
    Sitecore.Update.Utils.ConfigurationUtils.GetConfiguration(ConfigReader reader) +69
    Sitecore.Update.Utils.ConfigurationUtils.CreateObject(String configPath, String[] parameters, ConfigReader reader) +124
    Sitecore.Update.Configuration.Factory.GetSourceDataManager() +44
    Sitecore.Courier.DiffGenerator.GetDiffCommands(String sourcePath, String targetPath) in D:\projects\sitecore shared\trunk\Sitecore.Courier\Sitecore.Courier\DIffGenerator.cs:23
    Sitecore.Courier.WebRunner.PackageGenerationWizard.Analyze_Click(Object sender, EventArgs e) in D:\projects\sitecore shared\trunk\Sitecore.Courier\Sitecore.Courier.WebRunner\PackageGenerationWizard.aspx.cs:35
    System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +155

    ReplyDelete
  4. Did you update the web.config file as described in installation package? There is a readme page when you install it using Installation Wizard.

    ReplyDelete
  5. Brilliant, no i didnt because i just grabbed the code :), i should have seen the app.config in the console app i was wondering how that worked without a sitecore context,

    and i also figured it was a missing section but was unable to find it in last few versions of sitecore so gave up on it :)

    i think an easy fix and something that should be part of the soloution was a include config file :)

    thank you for helping, and nice job with some articles and options relating to a largely undocumentet area :)

    ReplyDelete
  6. Ecorptrainings.com provides sitecore in hyderabad with best faculties on real time projects. We give the best online trainingamong the sitecore in Hyderabad.
    Classroom Training in Hyderabad India

    ReplyDelete
  7. Hi Alexander,

    We're looking at using Courier to try and implement a fully automated deployment process. We hit an issue with path lengths exceeding 256 characters which we were able to overcome by using the Serialization.SerializationFolderPathMaxLength setting in Sitecore. As this setting results in file path's being Hex encoded, would this affect our ability to use Courier ?

    Thanks

    ReplyDelete
  8. Hex-encoded paths is not a problem, Courier will handle them. If you encounter any issues - please let me know.

    I would not recommend to change and folder path length-related settings, as this limit is actually enforced by Windows OS.

    ReplyDelete
  9. Hi Alexander, i installed the module and check the differences with the web gui. But when i generated the file, i don't get the package.zip. Who i get the package.zip?

    thanks and kind regards,
    Andy

    ReplyDelete
  10. This comment has been removed by the author.

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
  11. Hi, i get now the zip-file, but when i install this, i don't see the changed or new items. I changed in the packagegenerationwizard.aspx.cs the filename:
    SitecoreCourier_{0}.update to Item_Updates_{0}.zip

    when i install the package, the installer runs through in a few seconds - questions about existing items to merg/overwrite.

    thanks and kind regards,
    andy

    ReplyDelete
  12. Please check the contents of your zip file. If possible - also provide source and target serialization - will check them out.
    Thanks!

    ReplyDelete
  13. Thanks, Experience with various technologies and businesses this is generally helpful.
    Still, I followed step-by-step your method in this
    selenium online training
    selenium certification

    ReplyDelete
  14. We provide best Selenium training in Bangalore, automation testing with live projects. Cucumber, Java Selenium and Software Testing Training in Bangalore.
    Online selenium training in India - KRN Informatix is a leading Selenium Training Institute in Bangalore offering extensive Selenium Training.
    Selenium corporate training
    Automation Testing Training in Marathahalli
    Selenium realtime training with projects
    Best Selenium Training in Bangalore
    Selenium Software Training in Bangalore
    Manual testing training in bangalore

    ReplyDelete
  15. This comment has been removed by the author.

    ReplyDelete
  16. This comment has been removed by the author.

    ReplyDelete
  17. You’re so interesting! I don’t believe I’ve truly read something like this before. So great to find someone with genuine thoughts on this issue. Really.. many thanks for starting this up. This website is something that’s needed on the internet, someone with some originality!

    CBSE Schools In Ahmedabad
    CBSE Schools In Surat
    CBSE Schools In Rajkot
    CBSE Schools In Visakhapatnam
    CBSE Schools In Kangra
    CBSE Schools In Shimla
    CBSE Schools In Jammu
    CBSE Schools In Solan
    CBSE Schools In Mangalore
    CBSE Schools In Mysore

    ReplyDelete
  18. This comment has been removed by the author.

    ReplyDelete
  19. nice blog thanks for sharing nice post https://snowflakemasters.in/

    ReplyDelete
  20. Wow! very nice article thank you for sharing this.visit: microsoft training online

    ReplyDelete
  21. Thanks for sharing nice blog keep posting.
    https://www.fastprepacademy.com/gmat-coaching-in-hyderabad/

    ReplyDelete
  22. This is the good website and also i love this website https://sclinbio.com

    ReplyDelete
  23. Experience the ultimate Satisfactory Game Server solution. Enhance your gaming experience with unrivaled performance and reliability.

    ReplyDelete