Discourse stuck in maintenance mode

Hello, my discourse server is stuck in maintenance mode.
I have left it in maintenance mode for several months on purpose, I’ve upgraded to many versions since initially setting it to maintenance mode.

My session has expired and I’ve been logged out, now I can’t log back in.

I can SSH to the discourse server.
I have tried the following steps:

  1. SSH to discourse server
  2. navigate to /var/discourse/
  3. run: ./launcher enter app
  4. run rails c

I have tried several things to disable maintenance mode here.

[1] pry(main)> 
[2] pry(main)> 
[3] pry(main)> Discourse.disable_readonly_mode(Discourse::READONLY_MODE_KEY)
=> true
[4] pry(main)> Discourse.disable_readonly_mode
=> true

When I shift focus away from SSH and onto my web browser, I can see that the maintenance mode banner goes away.

then a few seconds it comes back again.

I’ve referenced these docs already:

please help

Someone in the first linked topic had some luck with stopping and then restarting the container. Could that be worth a try?

thanks for the suggestion. Unfortunately this hasn’t helped me :frowning:

I ran

docker ps
docker kill app
docker start app

One thing that’s interesting is I’ve also tried to manually enable read only mode:

[8] pry(main)> Discourse.enable_readonly_mode
=> true
[9] pry(main)> Discourse.disable_readonly_mode
=> true
[10] pry(main)> 

Upon doing this, I noticed the banner comes back and I can’t even click the login button because it says Login is disabled while the site is in read only mode. and I also see the banner that says:

This site is in read only mode. Please continue to browse, but replying, likes, and other actions are disabled for now.

when I call disable_readonly_mode again, the maintenance mode banner goes away, and I can click the login button. Discourse even hands me over to the authentication sso provider.

However, when I’m redirected back to discourse, I get a whole page saying “The site is in read only mode. Interactions are disabled.”

I’ve done a bit of digging and, while I haven’t landed on a fix as yet, it seems the /u/admin-login link will bypass read_only, and allow you to still login:

@41821 Can you try Discourse.disable_readonly_mode(Discourse::USER_READONLY_MODE_KEY)


Nothing I did was able to get me out of the state.
After Discourse.disable_readonly_mode(Discourse::USER_READONLY_MODE_KEY) it goes to R/W for a second and reverts back to R/O just afterwards. Nothing discernible in logs. Even flushing Redis doesn’t help. Nor clearing the redis keys by hand.

This is very likely a bug as reverting 2.8.7 to 2.8.3 (which was my previous functional version) corrected the issue.

I tried going through the code to figure out where the bug was introduced, but couldn’t actually figure it out.

Is this a self hosted site? Flushing Redis should clear everything up as the readonly logic is entirely dependent on setting the right Redis keys.