# Site automatically exits read-only mode when enabled by 'discourse enable\_readonly'

**URL:** <https://meta.discourse.org/t/site-automatically-exits-read-only-mode-when-enabled-by-discourse-enable-readonly/296844>\
**Category:** Development\
**Tags:** read-only\
**Created:** [February 27, 2024, 5:27am UTC](https://meta.discourse.org/t/site-automatically-exits-read-only-mode-when-enabled-by-discourse-enable-readonly/296844 "2024-02-27T05:27:12Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![RhysGoodwin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rhysgoodwin/32/195363_2.png) [@RhysGoodwin](https://meta.discourse.org/u/RhysGoodwin)\
**Post date:** [February 28, 2024, 10:53pm UTC](https://meta.discourse.org/t/site-automatically-exits-read-only-mode-when-enabled-by-discourse-enable-readonly/296844/9 "2024-02-28T22:53:55Z")

</div>

Thanks JammyDodger! The info and link were very helpful. I’m not sure what constitutes a container restart - as far as I know my container is not restarting every ~1:30 which is as long as the RO mode stays enabled when using `discourse enable_readonly` i.e. `Discourse.enable_readonly_mode(Discourse::READONLY_MODE_KEY)`

I can confirm however that `Discourse.enable_readonly_mode(Discourse::USER_READONLY_MODE_KEY)` “sticks” indefinitely, which is what I was trying to achieve 👍

---

_[View the full topic](https://meta.discourse.org/t/site-automatically-exits-read-only-mode-when-enabled-by-discourse-enable-readonly/296844)._
