How can Admin login while Read-only mode is enabled on multisite?

AI-generated summary

winterbox encountered an issue where Read-only mode remained enabled on a secondary site within a multisite Discourse installation after a restore, despite successfully using discourse disable_readonly. zogstrip suggested entering the Rails console to run Discourse.disable_readonly_mode, but winterbox confirmed this also failed without errors. zogstrip correctly identified that the command was likely targeting the primary database instead of the specific secondary site database required for multisite setups. After winterbox verified that the standard command only affected the first site, zogstrip advised specifying the database name using the RAILS_DB environment variable. winterbox initially struggled to identify the correct database name, attempting secondforum which resulted in an error. Ultimately, winterbox resolved the issue by executing RAILS_DB=secondsite rails c followed by Discourse.disable_readonly_mode, successfully disabling Read-only mode on the restored secondary site.

I did restore on my secondsite(multisite), but Read-only mode is enabled.

How can I login? or How can I turn off Read-only mode?

I tried:

./launcher enter app
discourse disable_readonly

But nothing’s changed. (I tried ./launcher rebuild app also)

Was there any error when you tried that?

Alternatively, you could try the following

./launcher enter app
rails c
Discourse.disable_readonly_mode

No there was no error

root@localhost-app:/# discourse disable_readonly
The site is now fully operable.

Here I did your instruction:

root@localhost:/var/discourse# ./launcher enter app
WARNING: No swap limit support
root@localhost-app:/# rails c
[1] pry(main)> Discourse.disable_readonly_mode
=> true

But still same situation :confounded:

Are you sure you’re disabling readonly mode on the right site? I see you’re using multisite.

You need to do something like

./launcher enter app
RAILS_DB=<NAME_OF_THE_DB> rails c
Discourse.disable_readonly_mode

I did

root@localhost-app:/# discourse enable_readonly
The site is now in readonly mode.
root@localhost-app:/# discourse disable_readonly
The site is now fully operable.
root@localhost-app:/#

But it seems it only affects on the first site, not the second site.
(For more info: I configured multisite, and I restored with backup data. Then it happened)

Yes I am using multistite.

I tried with the name of DB ‘secondforum’:

root@localhost-app:/# RAILS_DB=<secondforum> rails c
-bash: secondforum: No such file or directory

Would you provide any example of <NAME_OF_THE_DB> ?
I followed Multisite configuration with Docker
I made it with secondforum instead of b_discourse

It finally worked with secondsite (not b_discourse nor secondforum)

./launcher enter app
RAILS_DB=secondsite rails c
Discourse.disable_readonly_mode

Thank you :grinning: