SaaS CMS has officially launched! Learn more now.

Can we set database mode read-only programmatically without application recycling?

Vote:
 

Can we set database mode read-only programmatically without application recycling? I don't want to use appsettings.

https://world.optimizely.com/documentation/Items/Developers-Guide/Episerver-CMS/9/Deployment/database-mode/

#281097
May 30, 2022 15:33
Vote:
 

Hi, have you checked could you implement your own IDatabaseMode  (as the interface defines the DatabaseMode property as only get) and inheriting the default implementation and adding on top of that your own custom logic?

#281277
Jun 02, 2022 16:09
Vote:
 

The question is a bit ambiguous. Technically, it is possible. It's just a value reading from appsettings. The internal DatabaseModeService class registered as singleton service does the actual job. In the real scenario, how would you prevent the current running application being interrupted or impacted while changing the value programmatically during the runtime?

#281313
Edited, Jun 03, 2022 3:15
Vote:
 

Thanks, both for your responses.

Of course, I don't want to change app settings at runtime, as that means an application recycles but I want to achieve all the below functionalities. DatabaseModeService returns the status back but doesn't do the actual functionality.

In the ReadOnly mode, the application can only load data from the database. The following modules and functions are affected in the ReadOnly mode:

  • Scheduler Service is disabled.
  • Model synch is disabled.
  • Indexing of content is disabled.
  • User, role and claims synch are disabled.
  • Automatic database updating throws exception if updating is needed.
  • Statistics Logger is disabled.
  • Saving web.config file into database is disabled.
#281321
Jun 03, 2022 15:09
Vote:
 

If I don't misunderstand your question, unfortunately, the IDatabaseMode is only used to fetch the static value from what I can see through ILSpy. Each functional areas you mentioned above has injected IDatabaseMode interface and program against the static value. E.g. the screenshot below is the Scheuler service-disabled function. 

#281430
Jun 06, 2022 5:39
Vote:
 

:) my question is can we move/set EPi to read-only mode while the site is up & running without any disruption or recycling.

#281433
Jun 06, 2022 7:58
* 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.