The discussion focuses on the implementation and usage of Discourse’s read-only mode, a feature requested by supermathie for scenarios like database failovers, migrations, and upgrades. While the team acknowledged the need, zogstrip revealed that the feature was already implemented, accessible via the Admin UI or CLI commands like script/discourse enable_readonlycite. The mode is controlled by a Redis flag and broadcasts via MessageBus, though it currently affects only single sites rather than multisite setups cite.
Troubleshooting arose when illspirit accidentally locked themselves out and encountered a thor library error. riking and zogstrip provided alternative methods to disable the mode, including SSHing into the container and using the Rails console. Additionally, trident suggested a temporary workaround by installing the missing gem.
Beyond functionality, Sailsman63 highlighted a critical security concern: users cannot log out of public kiosks when read-only mode is active, leaving sessions persistent. codinghorror confirmed the banner displays correctly, and zogstrip noted that significant client-side polish is still needed to handle errors gracefully, as many requests currently fail with 500 errors when the database is read-only.
Speaking of, what happens if Discourse notices that the postgres to which it’s connected is operating in read-only mode? Will it set readonly? Will it behave nicely? Or is that FINR?
So for sites in a multisite setup, I’ll need to iterate over each site and disable it for each? OK, can do.
I got stuck in read only mode and I’m logged out, I tried just running script/discourse disable_readonly but I believe I’m doing it wrong. Where do I type the command?
I hate to bump this but I can’t access my website.
Yep, I did that and I’m getting this error message
/usr/local/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- thor (LoadError)
from /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from script/discourse:3:in `<main>'
One piece of client-side behavior that might be a little more vital than “polish:”
Here on meta last night I noticed that I cannot log out when the site is set to read-only. The logged in session persisted between browser restarts. This did not inconvenience me, as I was using my own device and internet connection, however not all forum users will be in that position.
If we assume that a user is at a public internet kiosk of some sort, (Public library, Internet cafe, etc.) The only way to prevent the user’s account from being compromised if he needs to leave is:
Hope the user is savvy enough to clear his cookie cache before leaving.
Hope the access point automatically does so between users.
In an ideal world, both of these would be true. In our world…
If you are already aware of this, sorry for the duplication. Just thought it might be worth mentioning.