./launcher rebuild app fails hard 'bundle exec rake db:migrate' possible issue with github/master repo removal of auth/oath2_authenticator

Hello all, this is a call for help…

I’ve tried to dig and find the complete source of problem on my long running Ubuntu 20.x ec2’s with Discourse. These are all on AWS and have been running perfectly for close to 3 years now. All of a sudden none of them will rebuild. I have tapered down my app.yml to pretty bare bones… searched endlessly… My present install in Postgres 13, Discourse 2.9.0 Beta 4 (I always stay up to date.) and am running the very vanilla container/docker based install without anything fancy (no separate containers nor standalone installs of any other softwares. This is just one of many many guesses but I noticed that recently in the Discourse code base they removed/renamed auth/oauth2_authenticator to “ManagedAuthenticator and UserAssociatedAccount”

as can be seen at: DEV: Deprecate OAuth2Authenticator and OAuth2UserInfo (#15427) · discourse/discourse@78d0ec3 · GitHub
Comments in the repo about this commit :
DEV: Deprecate OAuth2Authenticator and OAuth2UserInfo (#15427)

These have been superseded by ManagedAuthenticator and UserAssociatedAccount. For more information, see Adding a new 'managed' authentication method to Discourse

Here are my logs near the end before the fail (and yes have run discourse-doctor that pretty much gives me the same thing… I am also not running NGINX which I have seen this be a common problem):

I, [2022-05-17T21:26:52.663629 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'LOAD_PLUGINS=0 bundle exec rake plugin:pull_compatible_all'
I, [2022-05-17T21:26:54.697333 #1]  INFO -- : discourse-chat-integration is already at latest compatible version
discourse-rss-polling is already at latest compatible version
discourse-assign is already at latest compatible version
discourse-azure-ad is already at latest compatible version
discourse-solved is already at latest compatible version
discourse-knowledge-explorer is already at latest compatible version
docker_manager is already at latest compatible version

I, [2022-05-17T21:26:54.697677 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate'
rake aborted!
LoadError: cannot load such file -- auth/oauth2_authenticator
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:15:in `require'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:15:in `require'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/zeitwerk-2.5.4/lib/zeitwerk/kernel.rb:35:in `require'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/dependencies/require_dependency.rb:21:in `require_dependency'
/var/www/discourse/lib/require_dependency_backward_compatibility.rb:18:in `require_dependency'
/var/www/discourse/plugins/discourse-azure-ad/plugin.rb:7:in `activate!'
/var/www/discourse/lib/plugin/instance.rb:679:in `instance_eval'
/var/www/discourse/lib/plugin/instance.rb:679:in `activate!'
/var/www/discourse/lib/discourse.rb:279:in `block in activate_plugins!'
/var/www/discourse/lib/discourse.rb:276:in `each'
/var/www/discourse/lib/discourse.rb:276:in `activate_plugins!'
/var/www/discourse/config/application.rb:222:in `block in <class:Application>'
/var/www/discourse/lib/plugin.rb:6:in `initialization_guard'
/var/www/discourse/config/application.rb:221:in `<class:Application>'
/var/www/discourse/config/application.rb:81:in `<module:Discourse>'
/var/www/discourse/config/application.rb:80:in `<top (required)>'
/var/www/discourse/Rakefile:7:in `require'
/var/www/discourse/Rakefile:7:in `<top (required)>'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
/usr/local/bin/bundle:25:in `load'
/usr/local/bin/bundle:25:in `<main>'
(See full trace by running task with --trace)
I, [2022-05-17T21:26:55.807801 #1]  INFO -- :
I, [2022-05-17T21:26:55.808466 #1]  INFO -- : Terminating async processes
I, [2022-05-17T21:26:55.808709 #1]  INFO -- : Sending INT to HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/13/bin/postmaster -D /etc/postgresql/13/main pid: 44
I, [2022-05-17T21:26:55.808935 #1]  INFO -- : Sending TERM to exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 105
2022-05-17 21:26:55.808 UTC [44] LOG:  received fast shutdown request
105:signal-handler (1652822815) Received SIGTERM scheduling shutdown...
2022-05-17 21:26:55.810 UTC [44] LOG:  aborting any active transactions
2022-05-17 21:26:55.815 UTC [44] LOG:  background worker "logical replication launcher" (PID 53) exited with exit code 1
2022-05-17 21:26:55.816 UTC [48] LOG:  shutting down
2022-05-17 21:26:55.851 UTC [44] LOG:  database system is shut down
105:M 17 May 2022 21:26:55.894 # User requested shutdown...
105:M 17 May 2022 21:26:55.894 * Saving the final RDB snapshot before exiting.
105:M 17 May 2022 21:26:55.940 * DB saved on disk
105:M 17 May 2022 21:26:55.941 # Redis is now ready to exit, bye bye...


FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 654 exit 1>
Location of failure: /usr/local/lib/ruby/gems/2.7.0/gems/pups-1.1.1/lib/pups/exec_command.rb:117:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"db_migrate", "cmd"=>["su discourse -c 'bundle exec rake db:migrate'"]}
bootstrap failed with exit code 1
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.
./discourse-doctor may help diagnose the problem.
c961e72970eba95a26f294e0f123987c40da1c350a4b1fe9621edf0bd665720c
1 Like

But it looks like it hasn’t been updated in two years? (or maybe I looked at the wrong one?) So this is likely your problem. I suspect that there is now some other solution.

1 Like

Right, the azure-ad plugin is not maintained, and has been archived on GitHub. The best alternative is probably

(Azure AD instructions are at the bottom of that post)

4 Likes

This is extremely helpful so thank you but also extremely disappointing as this has been already used and rolled out with many many users. This plugin was simple to use and due to the plugin being non 3rd party I felt fairly confident this would be at least a semi supported solution into the future. It looks like had they not just yanked/renamed the auth/oauth2_authenticator out of the repo instead of just adding a new file or two and going from there I wouldn’t be having this issue.

Of course I will look into using the OpenID Connect Authentication Plugin but it will be a huge bit of work to implement it.

1 Like

Even official code can be retired, this sounds like more of an issue with your release processes than anything relating to Discouse.

If you have ‘many many users’ you should probably consider running all updates through a staging copy of your site. Blindly upgrading a production server without first proving the process is incredibly risky.

Thanks, I wasn’t going to blindly upgrade my production server ;). I have quite a few environments to test thoroughly first.

It’s more about communicating changes after testing and being super thorough about looking for differences in the new setup.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.