Any plans to update for V8 yet?

Written by @marcemarc on Friday, 12 April 2019

With Umbraco v8 fresh out of the release traps like a hungry greyhound, never can it be said that I don’t surf the bleeding edge of new things in Umbraco… as in the last few weeks, I’ve released not one, but two Umbraco Healthchecks for ummm V7, totally taking advantage of the whole V8 release thing to bury the news, …,, (sorry ok!,  I have a bit of a backlog and I’m working through it in order… clearly, I’m only about two years behind the curve…. but hey who can hardly wait for the content apps I must be gestating ready for release in 2021?)

Anyways Healthchecks…  been around for a bit ain’t they?, and although they’ve become the ‘must run’ thing for a new launch, probably because their ‘origin story’ stems back to the old ‘go live checks’ dashboard - I find there are lots of checks for specific configuration - but not so many checking the ongoing health of an Umbraco site - or if there are (I can’t find them!)...

… Paul Seal is curating a collection of community checks here https://our.umbraco.com/packages/backoffice-extensions/ourumbracohealthchecks/ and I’ve contributed a check to keep track of content versions - which I’ve blogged about here on the Moriyama site.  

undefined

Be nice if there were more checks for stuff that can go wrong over time… but that’s for another post, probably circa 2020…

You said two healthchecks - what’s the other one?

The other healthcheck is a bit of a diagnostic one… and it’s for checking Flexible Load Balancing configuration - I’m sure if you’ve ever read the documentation on Flexible Load Balancing, you’ve immediately, read it again. Slowly, line by line… and said “does that mean that the master election server needs to have an umbracoApplicationUrl… help”... 

https://our.umbraco.com/Documentation/Getting-Started/Setup/Server-Setup/Load-Balancing/flexible 

The irony of the complication of flexible load balancing is that ‘it just works’ - if you don’t put firewalls in the way or have weird Url rewriting rules in place, or multiple domains, staging environments sharing live database, it just works, Umbraco guesses everything, and it works - and out of the box that’s quite a nice achievement. 

Anyway for your weird setup scenarios there are a few advanced techniques, implementing in code IServerRegistrar2…  to enable you to have full control specifying each server’s Role, and even setting the UmbracoApplicationUrl… and I’m not blogging here about how to set this up, it’s in the documentation, (https://our.umbraco.com/Documentation/Getting-Started/Setup/Server-Setup/Load-Balancing/flexible-advanced ) you just have to read it twice, the second time a little bit more slowly. 

What I’m blogging about here is when you start down this route, testing whether you’ve got it right...it can be a pain. 

Not least because when you are making changes like this in code, you’ve usually got to push them out to your load balanced servers to test, and hey, you’ve probably only noticed it’s ‘not working’ after the 'go live', so well, you’re probably trying to frantically get this to work in a live environment, because someone in Marketing has published a page, and it was all ok, but an hour later it’s reverted back to the old version, but it’s still ok in Umbraco etc and hand-on-heart, there are sooo many contributing factors, which you don’t quite fully comprehend yet, ...even after a third read through - and you just want this to work, it’s meant to ‘just work’, why won't it 'just work'? - it seems unjust! - you are even trying again things you know you've already tried, in pure hope, that somehow the 'passage of time' will resolve the problem. 

Well, I don’t mind telling you dear reader, I’ve found myself in that frustrating situation on a number of occasions, and I HAVE remembered to recycle the app pool, before you ask...and if you find yourself agreeing, well I don't think you are in the minority…regardless of how many people you might hear saying "yeah you 'just' blah de blah de blah" etc 

On a particular occasion, last year, the situation was compounded by assisting in the troubleshooting of a Flexible Load Balancing scenario on a client’s site, without access to servers or source control, and only able to ask questions of the developer, like a Victorian parlour game and because the answers did not fit with what we were observing and my knowledge of Flexible Load balancing setup, I was not necessarily 100% sure that the answers were, well, correct - What is the UmbracoApplicationUrl set to? Right, but in /config/umbracoSettings/web.routing what is the value of the setting umbracoApplicationUrl=”” … are you there, Moriarty?

 it all should have ‘just worked’ but as we were getting nowhere, and getting frustrated, going through the multiple things over and over, I put together some code to response.write out on each server instance, what Umbraco was using as the umbracoApplicationUrl, and how it had been set - to stop us going through the ritual of asking the same questions again and again, but mainly to prove I was right. 

… but I wasn’t right … 

It wasn’t ‘just working’… but it was all configured correctly! 

Desperately looking through the source code I found this: 

//by default we'll use the db server registrar unless the developer has the legacy
// dist calls enabled, in which case we'll use the config server registrar
if (UmbracoConfig.For.UmbracoSettings().DistributedCall.Enabled)
 {
ServerRegistrarResolver.Current = new ServerRegistrarResolver(new ConfigServerRegistrar());
}
else if ("true".InvariantEquals(ConfigurationManager.AppSettings["umbracoDisableElectionForSingleServer"]))
{
ServerRegistrarResolver.Current = new ServerRegistrarResolver(new SingleServerRegistrar());
}
else
{
ServerRegistrarResolver.Current = new ServerRegistrarResolver(
 new DatabaseServerRegistrar(
new Lazy<IServerRegistrationService>(() => ApplicationContext.Services.ServerRegistrationService),
new DatabaseServerRegistrarOptions()));
}

ooh a hidden feature, I like a hidden feature, they make you seem clever if you know about them - but just what is this mysterious umbracoDisableElectionForSingleServer setting?

Well it’s used on Umbraco Cloud, as you can’t flexible load balance on Umbraco Cloud, there is no need to make an initial database request at startup to see what servers are registered in the flexible load balancing pool, so turning off the election process for Umbraco sites makes a good amount of sense across the entire cloud, saves 1 database call per site, so this setting is present by default on all Cloud sites… but the client is on Azure - the site had been migrated from Umbraco Cloud (in order to take advantage of more flexible scalability of Azure in their niche circumstance) - but the darn setting remained in their solution! 

Removing the secret setting allowed everything to ‘just work’! 

We’ve added details of the setting to the docs - https://our.umbraco.com/Documentation/Reference/Config/webconfig/ 

But it made me think you are not going to search for that if you don’t know it exists, the documentation doesn’t necessarily need to mention it, as it’s not part of setting up flexible load balancing, what we need is some sort of troubleshooting guide / diagnostics for Flexible Load Balancing that can check everything…. So I spent a Saturday morning and put what I had into a healthcheck and made a PR to the core, and it was nearly considered for a sprint! 

undefined

But this was pre-PR team, and so my PR along with others became lost in backlog purgatory - but in a way that is a little like natural selection, only the strongest and fittest PRs survive! 

Anyway over the year I’ve used it a few times to quickly get to the bottom of a flexible load balancing issue or two - so it sort of has it’s uses - and when I came across the old PR a few weeks ago and messaged to close, there was still interest but it turned out nobody really knew if my health check was checking the right things, in the right way, or providing the right information to diagnose problems...  But fortunately, there is one person who does know… Jeavon Leopold to the rescue! 

Jeavon runs the popular official Umbraco Training Course: https://umbraco.com/training/book-courses/load-balancing/ you've probably thought about going on it, you should! 

And whether he believed in the idea, or just wanted to cheer me up, (I'm not quite sure which) he helped run through all the settings and of course knew a few more little things that could also be checked too, and he announced it on twitter too…

undefined

… anyway thanks to Jeavon’s input, this is now a standalone package, and if you are having difficulties troubleshooting the setup of Flexible Load Balancing, or just want to validate your setup - then you can install the package from our.umbraco or Nuget - and get some diagnostic information - do let us know how you get on and if this helps! 

undefined

The Health Check will display the value of the UmbracoApplicationUrl, and importantly how this has been determined by Umbraco. If the UmbracoApplicationUrl has been manually set that it follows the correct pattern and can be 'requested' by the server. It will check and display the values of some key Load Balancing configuration settings, eg Distributed Calls, ElectionDisabledForSingleServer, LocalTempStorage. Finally it will display the Current Server Role, Identity and if DatabaseRegistraar is in use a list of the active servers in the Flexible Load Balancing Pool.

It's in the backlog of things to update for V8... behind uCssClassNameDropdown