I'm trying the same for v9. I've created 2 classes implementing IServerRoleAccessor for each server role. I can't get the next part working.
"then you'll need to replace the default IServerRoleAccessor for the your custom registrars. You'll can do this by using the SetServerRegistrar() extension method on IUmbracoBuilder from a Composer or directly in your startup.cs."
I'm unable to find the extension method SetServerRegistrar on IUmbracoBuilder in a Composer or from startup.cs.
Do I need to create the extension method myself? If not can someone point me in the direction of the necessary namespace?
Has anyone got this working? If so, some example code would be appreciated.
You could set these values in a custom Composer like below.
For each server set the right value in the appsettings.json file.
using System.Linq;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.DependencyInjection;
using Umbraco.Cms.Infrastructure.DependencyInjection;
using Umbraco.Extensions.Infrastructure.ServerRoleAccessors;
namespace Umbraco.Extensions.Composers
{
public class ServerRegistrarComposer : IComposer
{
public void Compose(IUmbracoBuilder builder)
{
var config = builder.Services.BuildServiceProvider().GetService<IConfiguration>();
if (config.GetChildren().Any(item => item.Key.InvariantEquals("custom")))
{
if (config.GetValue<bool>("Custom:IsSchedulingPublisherServer"))
{
// This should be executed on your single `SchedulingPublisher` server
builder.SetServerRegistrar<SchedulingPublisherServerRoleAccessor>();
}
else
{
// This should be executed on your `Subscriber` servers
builder.SetServerRegistrar<SubscriberServerRoleAccessor>();
}
}
}
}
}
Umbraco 9 Load balancing config
Hello,
I've successfully set up load balancing for v7 & v8 websites following the guidelines here https://our.umbraco.com/Documentation/Fundamentals/Setup/server-setup/load-balancing/flexible-advanced#explicit-schedulingpublisher-server
I'm trying the same for v9. I've created 2 classes implementing IServerRoleAccessor for each server role. I can't get the next part working.
"then you'll need to replace the default IServerRoleAccessor for the your custom registrars. You'll can do this by using the SetServerRegistrar() extension method on IUmbracoBuilder from a Composer or directly in your startup.cs."
I'm unable to find the extension method SetServerRegistrar on IUmbracoBuilder in a Composer or from startup.cs.
Do I need to create the extension method myself? If not can someone point me in the direction of the necessary namespace?
Has anyone got this working? If so, some example code would be appreciated.
thanks in advance Efe
Try adding this to your C# file:
using Umbraco.Cms.Infrastructure.DependencyInjection;
Hi,
You could set these values in a custom Composer like below. For each server set the right value in the appsettings.json file.
OzoneNZ, Sander,
Thanks to both of you. You've been a massive help and between you have helped resolve the problem I was having.
thanks Efe
is working on a reply...