Error installing the discourse jwt plugin


(Jose Patricio Villarreal) #1

Hi I tryied to install the plugin discourse-jwt and got this error:

Error:

I, [2018-01-11T04:53:49.160065 #14]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate'
160:M 11 Jan 04:54:04.088 * 10 changes in 300 seconds. Saving...
160:M 11 Jan 04:54:04.089 * Background saving started by pid 765
765:C 11 Jan 04:54:04.178 * DB saved on disk
765:C 11 Jan 04:54:04.179 * RDB: 10 MB of memory used by copy-on-write
160:M 11 Jan 04:54:04.190 * Background saving terminated with success
rake aborted!
**NoMethodError: undefined method `jwt_secret' for GlobalSetting:Class**
/var/www/discourse/plugins/discourse-jwt/plugin.rb:18:in `register_middleware'
/var/www/discourse/config/initializers/009-omniauth.rb:10:in `block (2 levels) in <top (required)>'
/var/www/discourse/config/initializers/009-omniauth.rb:9:in `each'
/var/www/discourse/config/initializers/009-omniauth.rb:9:in `block in <top (required)>'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/builder.rb:55:in `instance_eval'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/builder.rb:55:in `initialize'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/omniauth-1.6.1/lib/omniauth/builder.rb:6:in `initialize'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/stack.rb:35:in `new'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/stack.rb:35:in `build'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/stack.rb:99:in `block in build'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/stack.rb:99:in `each'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/stack.rb:99:in `inject'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/stack.rb:99:in `build'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/engine.rb:508:in `block in app'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/engine.rb:504:in `synchronize'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/engine.rb:504:in `app'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/application/finisher.rb:45:in `block in <module:Finisher>'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `instance_exec'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `run'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:59:in `block in run_initializers'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:58:in `run_initializers'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/application.rb:353:in `initialize!'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/railtie.rb:185:in `public_send'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/railtie.rb:185:in `method_missing'
/var/www/discourse/config/environment.rb:5:in `<top (required)>'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block in require'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/application.rb:329:in `require_environment!'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/application.rb:445:in `block in run_tasks_blocks'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rake-12.1.0/exe/rake:27:in `<top (required)>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
I, [2018-01-11T04:54:06.221991 #14]  INFO -- : gem install discourse-omniauth-jwt -v 0.0.2 -i /var/www/discourse/plugins/discourse-jwt/gems/2.4.2 --no-document --ignore-dependencies
Successfully installed discourse-omniauth-jwt-0.0.2
1 gem installed

I, [2018-01-11T04:54:06.222460 #14]  INFO -- : Terminating async processes
I, [2018-01-11T04:54:06.222559 #14]  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/9.5/bin/postmaster -D /etc/postgresql/9.5/main pid: 45
I, [2018-01-11T04:54:06.222658 #14]  INFO -- : Sending TERM to exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 160
2018-01-11 04:54:06.223 UTC [45] LOG:  received fast shutdown request
2018-01-11 04:54:06.224 UTC [45] LOG:  aborting any active transactions
1602018-01-11 04:54:06.227 UTC [52] LOG:  autovacuum launcher shutting down
:signal-handler (1515646446) Received SIGTERM scheduling shutdown...
2018-01-11 04:54:06.232 UTC [49] LOG:  shutting down
160:M 11 Jan 04:54:06.294 # User requested shutdown...
160:M 11 Jan 04:54:06.294 * Saving the final RDB snapshot before exiting.
2018-01-11 04:54:06.330 UTC [49] LOG:  database system is shut down
160:M 11 Jan 04:54:06.404 * DB saved on disk
160:M 11 Jan 04:54:06.405 # 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 732 exit 1>
Location of failure: /pups/lib/pups/exec_command.rb:108:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"bundle_exec", "cmd"=>["su discourse -c 'bundle install --deployment --verbose --without test --without development --retry 3 --jobs 4'", "su discourse -c 'bundle exec rake db:migrate'", "su discourse -c 'bundle exec rake assets:precompile'"]}
6fa0fa9adef9e90adaa4a505f0205de0a4a37ec8e60d37b62f54c4a0e2d36337
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one

Any ideas?


Install a Plugin
(Jay Pfaffman) #2

@eviltrout, is this plugin supported? It hasn’t been updated if a long time.

The readme mentions seeing some values in discourse.conf, @jospeato, did you do that?

What are you trying to do with the plugin


(Robin Ward) #3

@pfaffman yes the plugin is supported. It hasn’t changed in a while because it’s quite simple and hasn’t needed any tweaks!


#4
Add the following settings to your  `discourse.conf`  file:

* `jwt_secret`
* `auth_url`

As @pfaffman said it looks as though the jwt secret has not been set

I am not sure exactly of the format in how it should be set however.


(Rafael dos Santos Silva) #5

You need to set it as ENV variables, on the app.yml in the form of DISCOURSE_JWT_SECRET and so on.


(Jose Patricio Villarreal) #6

Thanks all you guys (@Falco, @mikechristopher and Robin Ward and Jay Pfaffman) that worked !!!


(Jose Patricio Villarreal) #7

Hi, we got the JWT module working on our web app and backend, and want to do the single sing-on between our web app at (https://app.linkaform.com) and our discourse located at (http://faq.linkaform.com). How do we pass the token, between domains?

Do we have to change the domain of discourse to https://app.linkafomrm.com/faq?

Or what options do we have ? How do we need to configure this to achieve the SSO?