Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Richard Read 16 posts 47 karma points c-trib
    Apr 01, 2021 @ 08:29
    Richard Read
    0

    uSync Publisher - with horizontally scaled website

    Hello,

    I wonder if anyone has any knowledge on this? I'm currently running a website that utilises uSync Publisher, and pushing content / media between a 'admin' site through to a public facing site. Each site has their own independent database and are kept seperate for security reasons.

    What I would like to know is whether it's feasible to continue using uSync Publisher if the public facing site was horizontally scaled? I'm conscious that this isn't like a traditional flexible load-balancing setup, so in that sense if I 'published' from an admin site, that would instruct all the public facing slave instances to refresh their cache and be in sync. As I'm using seperate databases, and I think when uSync publisher pushes updates to the public site, it's only instructing the first server it encounters from Azure's load-balancer. This would result in only one of the public facing instances having updated content.

    Is this correct? Has anyone else encountered this scenario or seen any way to work with this kind of setup?

    Many thanks

    Rick

  • Kevin Jump 2309 posts 14673 karma points MVP 7x c-trib
    Apr 01, 2021 @ 09:14
    Kevin Jump
    0

    Hi Richard,

    you are right in that in its currenty form publisher is publishing to the one site when you publish (and then if it was load balanced - that would replicate between servers)

    if you wanted to publish to multiple separate sites in a single 'publish' action then publisher could probably be made to do this (with some custom code) and we could probably accommodate it somehow - but it would have to have an element of customization because its very much an implementation specific thing.

    but i am not sure this would be the best way. If all the sites are essentially acting like a big load balanced site, but you can't have a shared database i would be really tempted to look into database replication and refreshing caches in Umbraco. So when one 'master' site was published - something else would replicate database changes between sites, and then trigger Umbraco to refresh (that is in simple terms how the load balancing works)

    you mention azure so i am not sure maybe Azure geo-replication would be something to look at ?

    Not to say you couldn't do this with publisher - you really could. it would just need a bit of work.

  • Steve Crook 26 posts 158 karma points
    Nov 15, 2021 @ 06:48
    Steve Crook
    0

    Hi Kevin,

    I'm currently looking into uSync to do what Rick was asking about - i.e. having multiple publish targets in different locations when pushing changes from a staging site. Our DBAs have looked at replicating database changes and seem to think it's all too hard, plus we'd need to copy media and all other files around, so uSync Publisher seems like a possible all-in-one solution.

    How much work would this be to implement? Do you have any advice on where to begin, or is it something you'd need to build into uSync itself?

    Thanks Steve

  • Vasco Horta e Costa 18 posts 119 karma points
    Sep 13, 2022 @ 16:20
    Vasco Horta e Costa
    0

    Hello,

    Did you get this done?

    I Have a similar situation, where we want to publish from staging to multiple upper environments at once.

    Thanks,

  • Steve Crook 26 posts 158 karma points
    Sep 16, 2022 @ 02:24
    Steve Crook
    0

    Hi Vasco,

    I asked Kevin about this via email and got this reply, I'm sure he won't mind if I post it here:

    Hi Steve,

    In short, not out of the box (and IMO Database and File replication would be way easier than this!)

    I think what you want is the publishing process to happen automatically ?

    The main problem is it's quite complex - there are multiple steps and requests when you publish and a lot of them are paged (e.g if you publish 100 pages, the process will do them in pages of 25.

    I think there might be some possibilities, you would have to have code that mimicked the whole publication process (and didn't do the report bit - as you would want no interaction)

    it might be possible to write a new Publisher - the default one is the SyncRealTimePublisher,

    In theory (am sorting thinking as i go)

    • if you had a publisher that inherited from the SyncRealtimePublisher you could alter the push actions, to not do the report elements
    • You could implement your own endpoint / controller that started the process on ContentPublished
    • if would need to get the list of actions from the publisher, and then work through each one in turn (including handling any paging - you could in theory say make page size super big, and have it a little simpler).

    for info the Push Action in the SyncRealTimePublisher looks like this

     var pushActions = new List<PublisherAction>()
                {
                    new PublisherAction("config", "config", _publisherFolder + "push.html"), // show config
                    actionPushLang, // show lang choice
                    actionPushExport, // do export
                    actionPushReport, // show report
                    actionPushImport, // do import
                    actionPushResults // show results
                };
    

    underneath each of these actions there are a LOT of steps but i think removing the report stuff and UI actions might work

    var pushActions = new List<PublisherAction>()
    {
          actionPushExport, // do export
         actionPushImport, // do import
    };
    

    but you would then need to ensure you called the actions and steps (each of these actions has quite a few steps) in the correct way.

    you might be able to call the existing uSyncPublisherApiController -> PeformAction method (multiple times) - this is the thing that processes the actions (and steps, and checks for errors / completeness).

    you would in essence have to have some c# code somewhere that emulated the login in the uSync.Publisher/Components/uSyncPublishingActionCompotent.js file

    The main process loop does this for the UI.

    function performAction(process) {
    
                vm.showPickServer = false; 
    
                updateState(process);
    
                var request = makePublishRequest(process);
    
                uSyncPublishingService.performAction(request)
                    .then(function (result) {
    
                        var response = result.data;
                        if (response.success) {
    
                            process = updateProcess(process, response);
    
                            if (response.processComplete) {
                                console.log('end ?');
                            }
                            else if (response.actionComplete) {
                                getAction(process);
                            }
                            else {
                                performAction(process);
                            }
                        }
                        else {
                            showError(response.error, request);
                        }
                    });
            }
    

    The main thing i would say is uSync.Complete is built to help when sites are naturally out of sync (e.g stage and live) if you want to keep them realtime in sync then Umbraco load balancing or DB replication can do that, and some form of shared file replication would be the other bit, appreciate that might not be super easy - but the above process would be quite complicated to achieve the same thing.

    or possibly plain old uSync file copy ?

    you might be able to do something less realtimy with uSync / uSync.Content edition that writes files to disk, you could for example have a batch job to copy the uSync (and media, and views, etc) directly from one server and put it onto ther other servers (via file copy / ftp) and then trigger an uSync import on those servers to keep them in sync. not realtime, but something a lot less complicated ?

    Kevin

    I still haven't got around to implementing, but my plan was to do what Kevin suggested in the last paragraph, triggering an import on all other servers whenever an export was done from the staging server. Seems like it should work.

Please Sign in or register to post replies

Write your reply to:

Draft