15Jun, 2020
Help, My Sitecore Package Deployer Has Stopped Working!
One of my favourite tools in Sitecore development is the Hedgehog's Sitecore Package Deployer. Having Azure DevOps drop TDS's packages into your instances automates a complete update for you! I've covered how to implement this in my past post, Complete Guide to Deployment Automation, and it's a really reliable method unless something interrupts the process like we had happen last week. So, what happened and how do we fix it?
Finding the Problem
As with anything that is supposed to happen, and is not happening, I check the ever-important Logs. Conventionally this deployment tool runs once a minute as it checks for something to do, so I notice the following entries in that one minute frequency:
Install packages skipped because install state is WaitingForPostSteps.
So now I think I know what's wrong. We had an outage in mid-deployment, so there's something stuck in a pending state. I downloaded the source for this tool, and found that the Core database's properties are set to various states depending on what's going on. The states that are used are:
- Ready = 0
- InstallingPackage = 1
- WaitingForPostSteps = 2
- InstallingPostSteps = 3
Correcting the Problem
It's obvious the Core database is stuck in a value of 2 for this property, and we want to get things running again by setting it back to 0. Running the following command will correct this, though you'll want to view the table first to double check the machine name is right:
update dbo.properties set Value='0' where [Key]='CORE_SPD_INSTALLERSTATE_[Your Machine Name]';
After running this command (or most SQL commands for that matter) you're going to have to clear the data cache. Visit /sitecore/admin/cache.aspx, or use the shortcut found in the Sitecore control panel to clear your data cache.
Too Many Steps for Ya?
Well, there is the shortcut of using the following URL, which resets the state and executes the service:
/sitecore/admin/StartSitecorePackageDeployer.aspx?force=1
See it Running Again
You should now be seeing the following entries in your log once per minute, which indicates the service is running fine and in an idle state:
ManagedPoolThread #0 10:11:03 INFO Setting installer state to InstallingPackage ManagedPoolThread #0 10:11:03 INFO Setting installer state to Ready