Try our conversational search powered by Generative AI!

Synchronisation accross servers for migration steps



As far as I know there is no functionality in Episerver which would provide an infrastructure for migration steps aside MigrationStep, which can be only used to rename a property. Migration in my case includes setting values for new properties, copying values from one property to another (maybe on another page) and so on. Until now I used Scheduled Jobs for this, but it needs to be completely automated and run at startup.

Is there any infrastructure which I can build upon for this, aside from InitializationModule? MigrationSteps are executed on each startup, so I cannot reuse that, I need to ensure that each of my tasks are executed only once and only on one server at a time (in case of multiple servers are starting up). With the latter I am not sure how to achieve with Episerver, is there anything to synchronise across servers?

It is not purely related to CMS, I need to support Commerce Content as well, but as far as the infrastructure is concerned, it should be transparent.


Edited, Dec 10, 2020 10:44

Technically you can use IMigrationStep in Commerce, with some caveats (it's not officially public APIs, and it is not built to address multiple instances scenario) 

Dec 10, 2020 10:49

I came across that, but it seems like something which is not fully automatic, the administrator have to start it. Or is it possible to make it automatic, without user interaction?

Dec 10, 2020 10:56

It is. You can add AutoMigrateEPiServer appSettings (and value = true of course) and the migration process will be started automatically.

Dec 10, 2020 11:09

Sounds like a good idea! One problem is still how can I ensure that it (or my custom infrastructure) is not getting run parallel on multiple instances, how can I do some kind of synchronisation across instances in code? (the point is not to trust administrators to start only one instance after deployment)

Dec 10, 2020 11:18

That part is actually tricky and not builtin. You can do some custom cross-instance lock, like checking if a special value is added to a table yet, if not, add it, otherwise just wait until it is changed to complete, for example 

Dec 10, 2020 14:14

Ok, thanks for your answer and the ideas!

Dec 10, 2020 15:35

Commerce team will be looking into that as well (they are already aware it's a possible improvement), so in a future release - hopefully, you can remove the custom lock. But that'll take some time :) 

Dec 10, 2020 15:46
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.