Greenlight: Greenlight 2.6.2

Created on 29 May 2020  路  20Comments  路  Source: bigbluebutton/greenlight

Dear All
I already upgrade and still have the same issue

  1. I Update
root@top:~/greenlight# git merge upstream/v2
Already up-to-date.

  1. Made a user at my console
root@top:~/greenlight# docker-compose up -d
Creating network "greenlight_default" with the default driver
Creating greenlight_db_1 ... done
Creating greenlight-v2   ... done
root@top:~/greenlight# systemctl restart nginx
root@top:~/greenlight# docker exec greenlight-v2 bundle exec rake user:create["Abu","[email protected]","xxx","user"]
Account succesfully created.
Email: [email protected]
Password: xxx
Role: user
  1. At admin panel there is no show abu this member
    https://img.ciberindo.net/uploads/error/greenlight/29052020-A.png

  2. Try to login into User Panel

Try to lost password and change password https://img.ciberindo.net/uploads/error/greenlight/29052020-C.png
Login with user and pass error 500 https://img.ciberindo.net/uploads/error/greenlight/29052020-B.png

  1. At log that said user already login

Here is the log file

INFO: [6760b817-ac83-459c-ae9d-c1abb73a9fe5] method=GET path=/b/password_resets/new format=html controller=PasswordResetsController action=new status=200 duration=42.39 view=31.07 db=1.66 host=greenlight
INFO: [0cc00e02-bb39-4820-b1fb-0dfb90c2a214] Sent mail to [email protected] (3509.2ms)
INFO: [0cc00e02-bb39-4820-b1fb-0dfb90c2a214] method=POST path=/b/password_resets format=html controller=PasswordResetsController action=create status=302 duration=3548.82 view=0.00 db=8.39 location=https://top.etamu.id/b/ host=greenlight
INFO: [aefd6dc2-1bbe-4063-8581-7d047b1c0127] method=GET path=/b/ format=html controller=MainController action=index status=200 duration=31.12 view=23.23 db=1.07 host=greenlight
INFO: [70bf6451-d3c6-415f-be71-95eeabeb74a9] method=GET path=/b/password_resets/4berAqj3wYGJ5ijy31NA2g/edit format=html controller=PasswordResetsController action=edit status=200 duration=34.05 view=23.59 db=1.42 host=greenlight
INFO: [25c10214-e883-4bc4-8aee-089ea37285e6] method=PATCH path=/b/password_resets/4berAqj3wYGJ5ijy31NA2g format=html controller=PasswordResetsController action=update status=302 duration=406.52 view=0.00 db=3.41 location=https://top.etamu.id/b/ host=greenlight
INFO: [fd74c105-4cec-4a8c-8ad0-fb1a42fecf9f] method=GET path=/b/ format=html controller=MainController action=index status=200 duration=36.48 view=23.64 db=0.98 host=greenlight
INFO: [03d00ad7-f821-45f6-ab99-00f0fc681874] method=GET path=/b/admins format=html controller=AdminsController action=index status=200 duration=99.86 view=82.26 db=5.46 host=greenlight
INFO: [681342ae-06ad-4b05-8aaa-0f22e5006e9a] method=GET path=/b/admins format=html controller=AdminsController action=index status=200 duration=75.68 view=59.79 db=4.17 host=greenlight
INFO: [91d830f0-498c-4341-8173-d10382532209] method=GET path=/b/signin format=html controller=SessionsController action=signin status=200 duration=30.98 view=22.21 db=1.29 host=greenlight
INFO: [13c2979d-1b41-436e-9e6a-810ec67cba4d] Support: [email protected] is attempting to login.
INFO: [13c2979d-1b41-436e-9e6a-810ec67cba4d] Support: [email protected] has successfully logged in.
INFO: [13c2979d-1b41-436e-9e6a-810ec67cba4d] method=POST path=/b/u/login format=html controller=SessionsController action=create status=500 error='NoMethodError: undefined method `get_permission' for nil:NilClass' duration=411.72 view=0.00 db=2.05 host=greenlight
FATAL: [13c2979d-1b41-436e-9e6a-810ec67cba4d]    
FATAL: [13c2979d-1b41-436e-9e6a-810ec67cba4d] NoMethodError (undefined method `get_permission' for nil:NilClass):
FATAL: [13c2979d-1b41-436e-9e6a-810ec67cba4d]    
FATAL: [13c2979d-1b41-436e-9e6a-810ec67cba4d] app/controllers/concerns/authenticator.rb:49:in `check_email_verified'
[13c2979d-1b41-436e-9e6a-810ec67cba4d] app/controllers/concerns/authenticator.rb:32:in `login'
[13c2979d-1b41-436e-9e6a-810ec67cba4d] app/controllers/sessions_controller.rb:94:in `create'
INFO: [13c2979d-1b41-436e-9e6a-810ec67cba4d] method=POST path=/b/500 format=html controller=ErrorsController action=internal_error status=500 error='ActionView::Template::Error: undefined method `get_permission' for nil:NilClass' duration=29.32 view=0.00 db=0.48 host=greenlight 

This is a fresh install BBB + Greenlight for second server. I do not know where is wrong can you help me

Regards
KurJay

Most helpful comment

Yeah it looks like your migration failed, which is what is causing all of these issues. Try manually migrating your database

docker exec -it greenlight-v2 bash
bundle exec rake db:migrate

All 20 comments

root@top:~/greenlight# git merge upstream/v2
Already up-to-date.

You need to do a fetch before the merge

i get the same error after upgrading from 2.5.5 to 2.6.2

 INFO: [0b118f341d1c67ae05cb840bc78d924f] Support: myuser@domain is attempting to login.
 INFO: [0b118f341d1c67ae05cb840bc78d924f] Support: myuser@domain has successfully logged in.
 INFO: [0b118f341d1c67ae05cb840bc78d924f] method=POST path=/u/login format=html controller=SessionsController action=create status=500 error='NoMethodError: undefined method `get_permission' for nil:NilClass' duration=294.99 view=0.00 db=5.01 host=greenlig
 FATAL: [0b118f341d1c67ae05cb840bc78d924f]
 FATAL: [0b118f341d1c67ae05cb840bc78d924f] NoMethodError (undefined method `get_permission' for nil:NilClass):
 FATAL: [0b118f341d1c67ae05cb840bc78d924f]
 FATAL: [0b118f341d1c67ae05cb840bc78d924f] app/controllers/concerns/authenticator.rb:49:in `check_email_verified'
 [0b118f341d1c67ae05cb840bc78d924f] app/controllers/concerns/authenticator.rb:32:in `login'
 [0b118f341d1c67ae05cb840bc78d924f] app/controllers/sessions_controller.rb:94:in `create'
 INFO: [0b118f341d1c67ae05cb840bc78d924f] method=POST path=/500 format=html controller=ErrorsController action=internal_error status=500 error='ActionView::Template::Error: undefined method `get_permission' for nil:NilClass' duration=18.47 view=0.00 db=0.0
   /var/www/greenlight/app/helpers/application_helper.rb:61:in `home_page'
 Error during failsafe response: undefined method `get_permission' for nil:NilClass

reverting to 2.5.5 was no problem

@sebastianfischer How was the user created?

getting same error after upgrading from 2.5.5 to 2.6.2

INFO: [e087915d-afbc-4146-86ca-c4f1d84a2a77] method=POST path=/b/u/login format=html controller=SessionsController action=create status=500 error='NoMethodError: undefined methodget_permission' for nil:NilClass' duration=390.18 view=0.00 db=3.31 host=greenlight
FATAL: [e087915d-afbc-4146-86ca-c4f1d84a2a77]
FATAL: [e087915d-afbc-4146-86ca-c4f1d84a2a77] NoMethodError (undefined method get_permission' for nil:NilClass): FATAL: [e087915d-afbc-4146-86ca-c4f1d84a2a77] FATAL: [e087915d-afbc-4146-86ca-c4f1d84a2a77] app/controllers/concerns/authenticator.rb:49:incheck_email_verified'
[e087915d-afbc-4146-86ca-c4f1d84a2a77] app/controllers/concerns/authenticator.rb:32:in login' [e087915d-afbc-4146-86ca-c4f1d84a2a77] app/controllers/sessions_controller.rb:94:increate'
INFO: [e087915d-afbc-4146-86ca-c4f1d84a2a77] method=POST path=/b/500 format=html controller=ErrorsController action=internal_error status=500 error='ActionView::Template::Error: undefined method get_permission' for nil:NilClass' duration=51.41 view=0.00 db=6.35 host=greenlight

@manish-yadav How and when was the user created?

I'm seeing the same issue - the user was created using SAML authentication from PR #1334 ...

ERROR: [592fc73c-d887-4436-8217-9ad0a916d53d] Error authenticating via omniauth: undefined method `get_permission' for nil:NilClass 
INFO: [592fc73c-d887-4436-8217-9ad0a916d53d] method=POST path=/b/auth/saml/callback format=html controller=SessionsController action=omniauth status=302 duration=31.20 view=0.00 db=13.68 location=https://bbbtest.zdv.uni-mainz.de/b/ host=greenlight 
INFO: [37974c71-012e-4477-ac35-816596ae187c] method=GET path=/b/ format=html controller=MainController action=index status=500 error='ActionView::Template::Error: undefined method `get_permission' for nil:NilClass' duration=32.12 view=0.00 db=3.62 host=greenlight 
FATAL: [37974c71-012e-4477-ac35-816596ae187c]    
FATAL: [37974c71-012e-4477-ac35-816596ae187c] ActionView::Template::Error (undefined method `get_permission' for nil:NilClass): 
FATAL: [37974c71-012e-4477-ac35-816596ae187c]     16: <div class="header py-4">
[37974c71-012e-4477-ac35-816596ae187c]     17:   <div class="container">
[37974c71-012e-4477-ac35-816596ae187c]     18:     <div class="d-flex">
[37974c71-012e-4477-ac35-816596ae187c]     19:       <%= link_to (current_user ? home_page : root_path), class: "header-brand" do %>
[37974c71-012e-4477-ac35-816596ae187c]     20:         <% begin %>
[37974c71-012e-4477-ac35-816596ae187c]     21:           <%= image_tag(logo_image, class: "header-brand-img", alt:"") %>
[37974c71-012e-4477-ac35-816596ae187c]     22:         <% rescue %> 
FATAL: [37974c71-012e-4477-ac35-816596ae187c]    
FATAL: [37974c71-012e-4477-ac35-816596ae187c] app/helpers/application_helper.rb:61:in `home_page'
[37974c71-012e-4477-ac35-816596ae187c] app/views/shared/_header.html.erb:19:in `_app_views_shared__header_html_erb__4235332607428087611_47224362085620'
[37974c71-012e-4477-ac35-816596ae187c] app/views/layouts/application.html.erb:62:in `_app_views_layouts_application_html_erb__919813597194641321_47224362506240' 
INFO: [37974c71-012e-4477-ac35-816596ae187c] method=GET path=/b/500 format=html controller=ErrorsController action=internal_error status=500 error='ActionView::Template::Error: undefined method `get_permission' for nil:NilClass' duration=29.39 view=0.00 db=0.07 host=greenlight 

@moschlar Was the user create before the update or after the update to 2.6.2?

Before the update!
Do you need some database content for debugging?

Yes that would be helpful. Just to confirm:

  • User was created in a version 2.5.6 or earlier
  • You updated to 2.6.2
  • User could no longer sign in

Can you give me the output of the following commands?

docker exec -it greenlight-v2 bash
bundle exec rails c
User.find_by(email: "USERS_EMAIL").roles.pluck(:name, :priority)
User.find_by(email: "USERS_EMAIL").role

2.6.2

Loading production environment (Rails 5.2.4.3)
irb(main):001:0> User.find_by(email: "[email protected]").roles.pluck(:name, :priority)
=> [["admin", 0], ["user", 2]]
irb(main):002:0> User.find_by(email: "[email protected]").role
=> nil

2.5.6

Loading production environment (Rails 5.2.3)
irb(main):001:0> User.find_by(email: "[email protected]").roles.pluck(:name, :priority)
=> [["admin", 0], ["admin", 0], ["admin", 0], ["admin", 0], ["admin", 0], ["admin", 0], ["admin", 0], ["admin", 0], ["user", 2], ["user", 2], ["user", 2], ["user", 2], ["user", 2], ["user", 2], ["user", 2], ["user", 2]]
irb(main):002:0> User.find_by(email: "[email protected]").role
Traceback (most recent call last):
        1: from (irb):2
NoMethodError (undefined method `role' for #<User:0x000055a809677da0>)

Wow that's super weird. Can you give me the output of this as well please?
(after bundle exec rails c)

Role.joins("INNER JOIN users_roles ON users_roles.role_id = roles.id").where("users_roles.user_id = '#{User.find_by(email: "[email protected]").id}'")&.min_by(&:priority)
Loading production environment (Rails 5.2.4.3)
irb(main):001:0> Role.joins("INNER JOIN users_roles ON users_roles.role_id = roles.id").where("users_roles.user_id = '#{User.find_by(email: "[email protected]").id}'")&.min_by(&:priority)
=> #<Role id: 2, name: "admin", priority: 0, can_create_rooms: false, send_promoted_email: false, send_demoted_email: false, can_edit_site_settings: false, can_edit_roles: false, can_manage_users: false, colour: "#f1c40f", provider: "greenlight", created_at: "2020-04-10 15:06:20", updated_at: "2020-04-10 15:06:20">

Oh - erm, sorry - a probable reason for the weirdness might be that there are three users for this email address!
User.find_by(email: only finds the first of those!

See:

irb(main):006:0> User.find_by(email: "[email protected]").id
=> 2
irb(main):005:0> User.find_by(id: 36).email
=> "[email protected]"

However, the role resulting in your join query from above is the same, when I use the other user id directly:

irb(main):004:0> Role.joins("INNER JOIN users_roles ON users_roles.role_id = roles.id").where("users_roles.user_id = '36'")&.min_by(&:priority)
=> #<Role id: 2, name: "admin", priority: 0, can_create_rooms: false, send_promoted_email: false, send_demoted_email: false, can_edit_site_settings: false, can_edit_roles: false, can_manage_users: false, colour: "#f1c40f", provider: "greenlight", created_at: "2020-04-10 15:06:20", updated_at: "2020-04-10 15:06:20">

I'm still super confused as to what would cause this. The commands you ran are all returning the expected result. To fix, try running the following:

User.where(role_id: nil).each do |user|
  highest_role = Role.joins("INNER JOIN users_roles ON users_roles.role_id = roles.id").where("users_roles.user_id = '#{user.id}'")&.min_by(&:priority)&.id
  user.update_attributes(role_id: highest_role) unless highest_role.nil?
end

Oh wow - I think we're getting closer:

Traceback (most recent call last):
        1: from (irb):1
ActiveRecord::StatementInvalid (PG::UndefinedColumn: ERROR:  column users.role_id does not exist)
LINE 1: ...".* FROM "users" WHERE "users"."deleted" = $1 AND "users"."r...
                                                             ^
HINT:  Perhaps you meant to reference the column "users.room_id".
: SELECT "users".* FROM "users" WHERE "users"."deleted" = $1 AND "users"."role_id" IS NULL

And when I try logging in using a test account that is not yet known, I get basically the same:

INFO: [f9b1dcfb-ec8e-4491-894d-d6e51b967034] method=GET path=/b/signin format=html controller=SessionsController action=signin status=200 duration=29.97 view=19.12 db=2.37 host=greenlight 
INFO: [d70157cf-3ba2-4812-82f6-12216b8431be] (saml) Request phase initiated. 
INFO: [22271366-cb6a-4728-ae2e-63df66633c51] (saml) Request phase initiated. 
INFO: [94302e0b-7baf-429d-8b1c-316f6f3c8496] (saml) Callback phase initiated. 
INFO: [94302e0b-7baf-429d-8b1c-316f6f3c8496] Support: Auth user [email protected] is attempting to login. 
ERROR: [94302e0b-7baf-429d-8b1c-316f6f3c8496] Error authenticating via omniauth: can't write unknown attribute `role_id` 
INFO: [94302e0b-7baf-429d-8b1c-316f6f3c8496] method=POST path=/b/auth/saml/callback format=html controller=SessionsController action=omniauth status=302 duration=178.36 view=0.00 db=45.87 location=https://bbbtest.zdv.uni-mainz.de/b/ host=greenlight 

And then I remember that I saw something in the logs but disregarded it:

Attaching to greenlight-v2
greenlight-v2 | curl: (52) Empty reply from server
greenlight-v2 | PG::InsufficientPrivilege: ERROR: permission denied to create database : CREATE DATABASE "greenlight_production" ENCODING = 'utf8' Couldn't create 'greenlight_production' database. Please check your configuration. rake aborted! ActiveRecord::StatementInvalid: PG::InsufficientPrivilege: ERROR: permission denied to create database : CREATE DATABASE "greenlight_production" ENCODING = 'utf8' /usr/src/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.3/lib/active_record/connection_adapters/postgresql/database_statements.rb:75:in `async_exec' /usr/src/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.3/lib/active_record/connection_adapters/postgresql/database_statements.rb:75:in `block (2 levels) in execute' /usr/src/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.3/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads' /usr/src/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.3/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares' /usr/src/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.3/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads' /usr/src/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.3/lib/active_record/connection_adapters/postgresql/database_statements.rb:74:in `block in execute' /usr/src/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.3/lib/active_record/connection_adapters/abstract_adapter.rb:581:in `block (2 levels) in log' /usr/src/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.3/lib/active_record/connection_adapters/abstract_adapter.rb:580:in `block in log' /usr/src/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.3/lib/active_support/notifications/instrumenter.rb:23:in `instrument' /usr/src/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.3/lib/active_record/connection_adapters/abstract_adapter.rb:571:in `log' /usr/src/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.3/lib/active_record/connection_adapters/postgresql/database_statements.rb:73:in `execute' /usr/src/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.3/lib/active_record/connection_adapters/postgresql/schema_statements.rb:46:in `create_database' /usr/src/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.3/lib/active_record/tasks/postgresql_database_tasks.rb:21:in `create' /usr/src/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.3/lib/active_record/tasks/database_tasks.rb:119:in `create' /usr/src/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.3/lib/active_record/tasks/database_tasks.rb:139:in `block in create_current' /usr/src/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.3/lib/active_record/tasks/database_tasks.rb:316:in `block in each_current_configuration' /usr/src/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.3/lib/active_record/tasks/database_tasks.rb:313:in `each' /usr/src/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.3/lib/active_record/tasks/database_tasks.rb:313:in `each_current_configuration' /usr/src/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.3/lib/active_record/tasks/database_tasks.rb:138:in `create_current' /usr/src/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.3/lib/active_record/railties/databases.rake:29:in `block (2 levels) in <top (required)>' /usr/src/app/vendor/bundle/ruby/2.5.0/gems/rake-13.0.1/exe/rake:27:in `<top (required)>' /usr/local/bin/bundle:23:in `load' /usr/local/bin/bundle:23:in `<main>' Caused by: PG::InsufficientPrivilege: ERROR: permission denied to create database /usr/src/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.3/lib/active_record/connection_adapters/postgresql/database_statements.rb:75:in `async_exec' /usr/src/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.3/lib/active_record/connection_adapters/postgresql/database_statements.rb:75:in `block (2 levels) in execute' /usr/src/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.3/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads' /usr/src/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.3/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares' /usr/src/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.3/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads' /usr/src/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.3/lib/active_record/connection_adapters/postgresql/database_statements.rb:74:in `block in execute' /usr/src/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.3/lib/active_record/connection_adapters/abstract_adapter.rb:581:in `block (2 levels) in log' /usr/src/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.3/lib/active_record/connection_adapters/abstract_adapter.rb:580:in `block in log' /usr/src/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.3/lib/active_support/notifications/instrumenter.rb:23:in `instrument' /usr/src/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.3/lib/active_record/connection_adapters/abstract_adapter.rb:571:in `log' /usr/src/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.3/lib/active_record/connection_adapters/postgresql/database_statements.rb:73:in `execute' /usr/src/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.3/lib/active_record/connection_adapters/postgresql/schema_statements.rb:46:in `create_database' /usr/src/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.3/lib/active_record/tasks/postgresql_database_tasks.rb:21:in `create' /usr/src/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.3/lib/active_record/tasks/database_tasks.rb:119:in `create' /usr/src/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.3/lib/active_record/tasks/database_tasks.rb:139:in `block in create_current' /usr/src/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.3/lib/active_record/tasks/database_tasks.rb:316:in `block in each_current_configuration' /usr/src/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.3/lib/active_record/tasks/database_tasks.rb:313:in `each' /usr/src/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.3/lib/active_record/tasks/database_tasks.rb:313:in `each_current_configuration' /usr/src/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.3/lib/active_record/tasks/database_tasks.rb:138:in `create_current' /usr/src/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.3/lib/active_record/railties/databases.rake:29:in `block (2 levels) in <top (required)>' /usr/src/app/vendor/bundle/ruby/2.5.0/gems/rake-13.0.1/exe/rake:27:in `<top (required)>' /usr/local/bin/bundle:23:in `load' /usr/local/bin/bundle:23:in `<main>' Tasks: TOP => db:create (See full trace by running task with --trace)
greenlight-v2 | >>> Database initialization
greenlight-v2 | rake aborted!
greenlight-v2 | ActiveRecord::ProtectedEnvironmentError: You are attempting to run a destructive action against your 'production' database.
greenlight-v2 | If you are sure you want to continue, run the same command with the environment variable:
greenlight-v2 | DISABLE_DATABASE_ENVIRONMENT_CHECK=1
greenlight-v2 | /usr/src/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.3/lib/active_record/tasks/database_tasks.rb:61:in `check_protected_environments!'
greenlight-v2 | /usr/src/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.3/lib/active_record/railties/databases.rake:13:in `block (2 levels) in <top (required)>'
greenlight-v2 | /usr/src/app/vendor/bundle/ruby/2.5.0/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'
greenlight-v2 | /usr/local/bin/bundle:23:in `load'
greenlight-v2 | /usr/local/bin/bundle:23:in `<main>'
greenlight-v2 | Tasks: TOP => db:schema:load => db:check_protected_environments
greenlight-v2 | (See full trace by running task with --trace)

When I saw this, I just thought: Good, you shouldn't need to create the database because it's already there, but now I'm thinking that there might be some migrations missing...

Yeah it looks like your migration failed, which is what is causing all of these issues. Try manually migrating your database

docker exec -it greenlight-v2 bash
bundle exec rake db:migrate

I just figured that too and that has helped, yes.
Sorry for all the fuss! And thanks a lot!

The root cause was probably that a colleague moved the database from the db container to a standalone host and that lead to a change in permissions...
It might be worth changing the logic in bin/start since its often recommended to not give the create database permissions to normal database users. Should we open another issue for that?

No worries. Thanks for your help debugging.

Yes please open a separate issue for that

@manish-yadav How and when was the user created?

user-created through self-signed using the web interface.

irb(main):019:0> User.find_by(email: "[email protected]").roles.pluck(:name, :priority)
=> [["admin", 0], ["user", 1]]
irb(main):020:0> User.find_by(email: "[email protected]").role
=> nil
irb(main):021:0>

Database alreday migrated:

db_1 | ERROR: database "greenlight_production" already exists
db_1 | STATEMENT: CREATE DATABASE "greenlight_production" ENCODING = 'utf8'
greenlight-v3 | Database 'greenlight_production' already exists
greenlight-v3 | >>> Database migration
greenlight-v3 | yarn install v1.3.2

Was this page helpful?
0 / 5 - 0 ratings