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 -
The discussion revolves around an issue with a Discourse installation where users are unable to log in suddenly. The error is shown in screenshots provided by Shashikant_Sharma.
david suggests checking for plugins and ensuring the latest version of Discourse is installed. Shashikant_Sharma confirms only one plugin is installed and the issue started after rebuilding the Docker image.
david recommends rebuilding from the command line, which doesn’t resolve the issue. Shashikant_Sharma shares the log file, and david identifies the problem as a failed database migration.
Tarek_Khalil suggests the migration might have started but was halted due to a fault, resulting in the ignored_users table already existing. david recommends dropping the ignored_users table and then running the migration.
david guides Shashikant_Sharma on how to access the database, and Shashikant_Sharma confirms the migration has run but not been recorded.
david suggests restoring from a backup as the best solution. Shashikant_Sharma requests steps to resolve the issue and restore the database from a .bak file, citing the urgency of the situation due to live users being affected.
Do you have any plugins installed? Are you running the latest version of Discourse?
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.
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?
Interesting! No, I haven’t David unfortunately ![]()
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.
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;
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
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.
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.