SUSE / Portus

Authorization service and frontend for Docker registry (v2)
http://port.us.org/
Apache License 2.0
3k stars 471 forks source link

website (dashboard) default route returns 500 for admin users #2242

Closed stephgosling closed 4 years ago

stephgosling commented 4 years ago

Description

All of a sudden (since yesterday) the dashboard (path /) has started throwing a 500 on login for admin users. Other paths (/repositories, namespaces etc.) all work. The dashboard works for non-admin users however. No changes on this installation for months so I am at a bit of a loss as to what has happened

Steps to reproduce

  1. Woke up this morning
  2. Logged in (github oauth), but verified with a local user, and reproducible with that local user by toggling admin = 1 in the DB
  3. 500

When it works (non-admin) I see this

portus_1      | Started GET "/" for 172.18.0.6 at 2019-10-15 13:13:04 +0000
portus_1      | Processing by DashboardController#index as HTML
portus_1      | Scoped order and limit are ignored, it's forced to be batch order and batch size
portus_1      |   Rendered dashboard/partials/_portus_user_alert.html.slim (0.0ms)
portus_1      |   Rendered dashboard/partials/_stats.html.slim (0.1ms)
portus_1      |   Rendered public_activity/registry/_delete.html.slim (1.1ms)
portus_1      |   Rendered dashboard/partials/_recent_activities.html.slim (3.4ms)
portus_1      |   Rendered dashboard/partials/_repositories.html.slim (2.5ms)
portus_1      |   Rendered dashboard/index.html.slim within layouts/application (6.5ms)
portus_1      |   Rendered shared/_config.html.slim (0.0ms)
portus_1      |   Rendered shared/_header.html.slim (0.5ms)
portus_1      |   Rendered shared/_aside.html.slim (2.4ms)
portus_1      |   Rendered shared/_search.html.slim (0.9ms)
portus_1      |   Rendered shared/_notification.html.slim (0.1ms)
portus_1      |   Rendered shared/_notifications.html.slim (0.4ms)
portus_1      | Completed 200 OK in 23ms (Views: 11.8ms | ActiveRecord: 3.3ms)
portus_1      | Started GET "/" for 172.18.0.6 at 2019-10-15 13:13:20 +0000
portus_1      | Processing by DashboardController#index as HTML
portus_1      | Scoped order and limit are ignored, it's forced to be batch order and batch size
portus_1      |   Rendered dashboard/partials/_portus_user_alert.html.slim (0.0ms)
portus_1      |   Rendered dashboard/partials/_stats.html.slim (2.5ms)
portus_1      |   Rendered public_activity/registry/_delete.html.slim (1.5ms)
portus_1      |   Rendered public_activity/repository/_push.html.slim (3.5ms)
portus_1      |   Rendered public_activity/repository/_push.html.slim (2.7ms)
portus_1      |   Rendered public_activity/repository/_push.html.slim (3.2ms)
portus_1      |   Rendered public_activity/repository/_push.html.slim (2.3ms)
portus_1      |   Rendered public_activity/repository/_push.html.slim (2.6ms)
portus_1      |   Rendered public_activity/repository/_push.html.slim (2.8ms)
portus_1      |   Rendered public_activity/repository/_push.html.slim (2.7ms)
portus_1      |   Rendered public_activity/repository/_push.html.slim (2.7ms)
portus_1      |   Rendered public_activity/repository/_push.html.slim (2.8ms)
portus_1      |   Rendered public_activity/repository/_push.html.slim (3.5ms)
portus_1      |   Rendered public_activity/repository/_push.html.slim (2.8ms)
portus_1      |   Rendered public_activity/repository/_push.html.slim (2.3ms)
portus_1      |   Rendered public_activity/team/_add_member.html.slim (2.0ms)
portus_1      |   Rendered public_activity/application_token/_create.html.slim (0.8ms)
portus_1      |   Rendered public_activity/application_token/_destroy.html.slim (0.9ms)
portus_1      |   Rendered public_activity/application_token/_create.html.slim (0.7ms)
portus_1      |   Rendered public_activity/user/_delete.html.slim (0.6ms)
portus_1      |   Rendered public_activity/team/_remove_member.html.slim (3.9ms)
portus_1      |   Rendered dashboard/partials/_recent_activities.html.slim (53.3ms)
portus_1      |   Rendered dashboard/index.html.slim within layouts/application (56.3ms)
portus_1      | Completed 401 Unauthorized in 65ms (ActiveRecord: 7.6ms)
portus_1      | 
portus_1      | ActionView::Template::Error (undefined method `display_username' for nil:NilClass):
portus_1      |     10:           - if activity.owner == activity.recipient
portus_1      |     11:             = "#{activity_owner(activity)} removed itself "
portus_1      |     12:           - else
portus_1      |     13:             = "#{activity_owner(activity)} removed user #{activity.recipient.display_username} "
portus_1      |     14:         = "from the "
portus_1      |     15:         = link_to activity_team(activity), activity.trackable
portus_1      |     16:         |  team
portus_1      |   app/views/public_activity/team/_remove_member.html.slim:13:in `_app_views_public_activity_team__remove_member_html_slim___3982712366759266697_40960960'
portus_1      |   app/views/dashboard/partials/_recent_activities.html.slim:31:in `block in _app_views_dashboard_partials__recent_activities_html_slim__2930910754939079675_69816376900240'
portus_1      |   app/views/dashboard/partials/_recent_activities.html.slim:30:in `_app_views_dashboard_partials__recent_activities_html_slim__2930910754939079675_69816376900240'
portus_1      |   app/views/dashboard/index.html.slim:6:in `_app_views_dashboard_index_html_slim___2430252226660761129_69816376145800'
portus_1      |   app/middleware/catch_json_parse_errors.rb:11:in `call'
portus_1      | 
portus_1      | 
portus_1      | Processing by ErrorsController#show as HTML
portus_1      |   Parameters: {"status"=>"500"}
portus_1      |   Rendered errors/500.html.erb within layouts/errors (0.0ms)
portus_1      |   Rendered errors/_status_title.html.slim (0.0ms)
portus_1      | Completed 500 Internal Server Error in 3ms (Views: 2.0ms | ActiveRecord: 0.0ms)

I initially thought as the installation hasn't changed that there was a github issue but as I say it happens with local users too. This installation is a bit over a year old and started life as 2.3 but has been upgraded.

Deployment information

Portus 2.4.3 containers deployed via compose: https://gist.github.com/stephgosling/93e5a5081ee56d779071f818b08fa8da

Config: https://gist.github.com/stephgosling/d249b7664eb93b8a8301274ebb5d1e43

stephgosling commented 4 years ago

as you can see from the config display_name is false but I don't know exactly which component is getting the 401 internally and why that template render would all of a sudden start to fail

stephgosling commented 4 years ago

and it miraculously started working, however now all of the namespaces, repos, and tags are missing from the interface (yet the json request they depend on works and all is properly populated...