Unable to login as admin after enabling read only mode


(Gulshan Kumar) #1

My site says “Login is disabled while the site is in read only mode?” so I cannot log in:


(Bhanu Sharma) #2

Visit yoursite.com/u/admin-login i.e. help.gulshankumar.net/u/admin-login and then try to log in if that works?


(Gulshan Kumar) #3

Hi,

Thanks for the response. I tried, it says -

{"errors":["The site is in read only mode. Interactions are disabled."],"error_type":"read_only"}


(Bhanu Sharma) #4

Depending upon how you enabled the read only mode, here is some help:


or


(Gulshan Kumar) #5

I had enabled read-only mode from admin area from where we do backup.


(Bhanu Sharma) #6

Second option I suggested above should work for you. Please do not log out the next time you put your forum into read only mode.

Ps: Try searching before posting a new query, You may find your solution into a similar question asked by someone else.


(Gulshan Kumar) #7

Sorry, I couldn’t understand above written steps. Do I need to edit any code? :thinking:


(Bhanu Sharma) #8

You don’t have to edit anything. Just ssh into your discourse server and do the following:

cd /var/discourse
./launcher enter app
rails c
Discourse.disable_readonly_mode(Discourse::USER_READONLY_MODE_KEY)


(Gulshan Kumar) #9

I hope everything is fine.


(Bhanu Sharma) #10

Try again, You may have entered the commands incorrectly. It should return like this:
Screenshot%20from%202018-04-15%2014-13-47


(Gulshan Kumar) #11

I replicated above steps. Still, site is showing in the read-only mode.

image


(Gulshan Kumar) #12

Discourse.disable_readonly_mode
Not working.

Discourse.disable_readonly_mode(Discourse::USER_READONLY_MODE_KEY)
Working.

Thanks a lot. Now I am able to login.