Skip to content
September 29, 2019 / kiranpatils

Sitecore Package Deployer (SPD) learnings

Challenge:

We love automation, I hope you too! If you/your company culture, don’t have time to automate then following is a good read:

https://97-things-every-x-should-know.gitbooks.io/97-things-every-programmer-should-know/content/en/thing_78/

Image result for we are busy

As you know in Sitecore eco system, Templates/Layouts/Rendering/Items are as critical and important as your code files.

There are few ways to automate Sitecore Items deployment. We have been relying on SPD – Sitecore Package Deployer.

It just works! But recently we faced two nice challenges with it and this post is about those challenges and our approach towards solving it.

Eager to know more about it? Let’s read:

Solution:

Package installation order

Generally, we generate 3 update packages out of our 3 TDS solution:

  1. TDS.Core : Core DB related item updates.
  2. TDS.Master : Master DB related item updates, Excluding Content section.
  3. TDS.Master.Content : Master DB related item updates, Only Content section.

During deployment, we used to face one challenge that at times, TDS.Master.Content update package will install before TDS.Master update package. In other words, Item will be installed first it’s template.

Unfortunately, there is no easy way to control this using SPD. We tried options and out of that following solution has worked for us:

With the help of SPD Team, we learnt that SPD installs packages in alphabetical order.

We used that learning to solve our challenge. We prefixed “A”, “B”, “C” for our TDS packages in TDS’s Update Package configuration.

TDS Update Package Configuration

After above configuration, TDS Update package names were:

  1. A.TDS.Core.update
  2. B.TDS.Master.update
  3. C.TDS.Master.Content.update

During our research we also came across, Package bundling : http://hedgehogdevelopment.github.io/tds/chapter4.html#package-bundling – This is something we haven’t tried. But this should also solve problem. Will leave this for your brevity to try this!

And that fixed our ordering issue! 🙂 But wait – Is life that easy? It’s not – We faced another challenge. Which is mentioned below.

Sync Package Installation :

We have XP Scaled environment, Where CM and CD is isolated and our Octopus deployment has following steps:

  1. Deploy TDS Update packages on CM Environment : Deploys update package on CM Environments under SPD folder.
  2. Wait for TDS Update package installation : There is no easy way to monitor update package installation. So, there was some configured wait time in power shell before going to next step.
  3. Perform Sitecore publish : Triggers Sitecore publish.

Above process works perfectly fine for few items. But as items grew it was hard to configure accurate “Wait time” for step#2. At times, Sitecore publish used to get triggered even step #2 was not completed.

We did a quick search to solve this problem and we found this post : https://sitecorerap.wordpress.com/2017/09/26/synchronous-deployments-with-sitecore-package-deployer/

As you can see from above post, it suggests updating few core DLLs. Which we wanted to avoid.

After some research we came up with following option:

  1. We disabled this agent : “<agent type=”Hhogdev.SitecorePackageDeployer.Tasks.InstallPackage, Hhogdev.SitecorePackageDeployer” method=”Run” interval=”00:01:00″/> “ which will not install package automatically.
  2. We added a octopus step which does following things:
    1. It triggers Update package install using this URL : [YourSite]/sitecore/admin/StartSitecorePackageDeployer.aspx [You can also call it with force parameter : [YourSite]/sitecore/admin/StartSitecorePackageDeployer.aspx?force=1] – This post explains this nicely : https://prcode.blog/2018/08/08/quick-tips-for-the-sitecore-package-deployer/ – At times we have been noticing failure. So, we used force parameter and it helped us make this process stable!
    2. SPD generates “JSON” file for each update package. As soon as package installation is done. And adds status “success”/”failure”. Our PS Script monitors this and it will keep monitoring till all packages are installed and their respective JSON files are created. If all are success then it proceeds to next step, which is Sitecore publishing else it aborts Octopus deployment process.[Credits : https://twitter.com/vyas_manglesh]

Above solutions helped us stabilize our Sitecore item deployment process. Hope it does for you as well! You do it differently and more efficiently? Why don’s share with world? Blog it!

Happy Deployment! [Go home, your loves ones are waiting for you!]

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: