Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more

Synchronisation accross servers for migration steps

Vote:
 

Hi,

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.

Zsolt

#241040
Edited, Dec 10, 2020 10:44
Vote:
 

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) 

#241041
Dec 10, 2020 10:49
Vote:
 

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?

#241042
Dec 10, 2020 10:56
Vote:
 

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

#241043
Dec 10, 2020 11:09
Vote:
 

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)

#241044
Dec 10, 2020 11:18
Vote:
 

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 

#244748
Dec 10, 2020 14:14
Vote:
 

Ok, thanks for your answer and the ideas!

#244749
Dec 10, 2020 15:35
Vote:
 

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 :) 

#244750
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.