Unable to login into discourse suddenly

Hi,

We have been using the discourse for 4 months with no issues. Today suddenly none of our team members is able to login into it with or without SSO.

Here is the screenshot of the error we are facing -

Do you have any plugins installed? Are you running the latest version of Discourse?

1 Like

Hi @david,

We have only one plugin installed i.e discourse-chat-integration. And nothing else. It was working until yesterday. I think when I rebuild the docker image it will automatically fetch the latest version of the discourse right?

It looks like you might be missing some recent database migrations. I would suggest trying to rebuild from the command line again

cd /var/discourse
./launcher rebuild app

and see whether the problem is resolved. If not, please can you share the info and backtrace information from the logs.

3 Likes

Hi @david,

It didnt worked. Here is the log file attached.
logs.txt (228.7 KB)

Ok, it looks like the rebuild is failing during the database migrations. I would expect that to take your site offline, so I’m not sure how it is still running. You are missing all the database migrations since 20190225133654 (there are lots!)

The migration is getting stuck on PG::DuplicateTable: ERROR: relation "ignored_users" already exists

Have you seen this before @Tarek_Khalil? I expect it’s not actually related to the ignore users feature, but just want to check if you’ve seen the same error when working on it?

1 Like

Interesting! No, I haven’t David unfortunately :slightly_frowning_face:

Though, I have seen cases outside of Discourse where this happen (maybe you experienced it before).

The migration started, reached a particular step, executed that step but then some fault caused a halt. At this point, the migration version number wouldn’t be written to the DB but the migration step would be executed.

4 Likes

That would explain it! So I guess the best solution is to manually drop the ignored_users table (after taking a backup). Then the migration should be able to run successfully.

@Shashikant_Sharma are you using a standard installation from our install guide? If so, please try running

cd /var/discourse
./launcher enter app
su -c 'psql discourse' postgres

Then run

SELECT version, name, created_at from schema_migration_details ORDER BY created_at DESC LIMIT 10;
2 Likes

@david:

su -c 'psql discourse' postgres

point is - Error response from daemon: Container 5e50b5e604a1ccce34cbedd9802a2cab765a1a2ed337acf9077ef52e9fc57336 is not running

Try running ./launcher start app first:

cd /var/discourse
./launcher start app
./launcher enter app
su -c 'psql discourse' postgres
1 Like

@david;

su -c 'psql discourse' postgres

What is the password for this?

There shouldn’t be a password, assuming you followed the standard installation guide.

Hi @david
Got it.

I think that confirms what @Tarek_Khalil suspected. The migration has run, but rails hasn’t recorded it in the scheme_migration_details table.

Do you have any backups from before 2018-04-22 05:23? Restoring from a backup would probably be the best thing for the integrity of the database.

2 Likes

@david, @Tarek_Khalil

Kindly let me know steps-how do I resolve this. Our live users are getting affected because of this. We have to find a workaround for this on an immediate basis. I have old backup .bak file, Let me know command to restore it.