docker-gitlab icon indicating copy to clipboard operation
docker-gitlab copied to clipboard

OAuth2 Generic not working

Open DarkLiKally opened this issue 4 months ago • 2 comments

Hello,

I have a little problem with my gitlab installation. First of all I'm stuck on 16.6.2 because I'm running it on a Synology NAS and I'm facing the typical too old kernel problem so I can't update to any later version.

I'm trying to add authentication using Keycloak to my Gitlab instance. Since I'm on 16.6.2 I also don't have the "OIDC" integration available in this package here. But I have OAuth2 Generic.

So I set up all the required ENV Variables, but when I try to boot my Gitlab Puma always crashes and restarts, I'm getting the following in my Puma logs:

{"timestamp":"2025-08-16T11:29:44.655Z","pid":2410,"message":"Puma starting in cluster mode..."}
{"timestamp":"2025-08-16T11:29:44.685Z","pid":2410,"message":"* Puma version: 6.4.0 (ruby 3.0.6-p216) (\"The Eagle of Durango\")"}
{"timestamp":"2025-08-16T11:29:44.686Z","pid":2410,"message":"*  Min threads: 1"}
{"timestamp":"2025-08-16T11:29:44.686Z","pid":2410,"message":"*  Max threads: 16"}
{"timestamp":"2025-08-16T11:29:44.686Z","pid":2410,"message":"*  Environment: production"}
{"timestamp":"2025-08-16T11:29:44.687Z","pid":2410,"message":"*   Master PID: 2410"}
{"timestamp":"2025-08-16T11:29:44.687Z","pid":2410,"message":"*      Workers: 3"}
{"timestamp":"2025-08-16T11:29:44.688Z","pid":2410,"message":"*     Restarts: (✔) hot (✖) phased"}
{"timestamp":"2025-08-16T11:29:44.688Z","pid":2410,"message":"* Preloading application"}
{"timestamp":"2025-08-16T11:31:15.628Z","pid":2410,"message":"! Unable to load application: ArgumentError: Missing :action key on routes definition, please check your routes."}
bundler: failed to load command: puma (/home/git/gitlab/vendor/bundle/ruby/3.0.0/bin/puma)
/home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/actionpack-7.0.8/lib/action_dispatch/routing/mapper.rb:302:in `check_part': Missing :action key on routes definition, please check your routes. (ArgumentError)
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/actionpack-7.0.8/lib/action_dispatch/routing/mapper.rb:291:in `check_controller_and_action'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/actionpack-7.0.8/lib/action_dispatch/routing/mapper.rb:223:in `normalize_options!'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/actionpack-7.0.8/lib/action_dispatch/routing/mapper.rb:132:in `initialize'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/actionpack-7.0.8/lib/action_dispatch/routing/mapper.rb:85:in `new'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/actionpack-7.0.8/lib/action_dispatch/routing/mapper.rb:85:in `build'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/actionpack-7.0.8/lib/action_dispatch/routing/mapper.rb:1984:in `add_route'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/actionpack-7.0.8/lib/action_dispatch/routing/mapper.rb:1956:in `decomposed_match'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/actionpack-7.0.8/lib/action_dispatch/routing/mapper.rb:1920:in `block in map_match'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/actionpack-7.0.8/lib/action_dispatch/routing/mapper.rb:1914:in `each'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/actionpack-7.0.8/lib/action_dispatch/routing/mapper.rb:1914:in `map_match'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/actionpack-7.0.8/lib/action_dispatch/routing/mapper.rb:1662:in `match'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/devise-4.9.3/lib/devise/rails/routes.rb:452:in `block in devise_omniauth_callback'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/devise-4.9.3/lib/devise/rails/routes.rb:446:in `each'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/devise-4.9.3/lib/devise/rails/routes.rb:446:in `devise_omniauth_callback'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/devise-4.9.3/lib/devise/rails/routes.rb:268:in `block (4 levels) in devise_for'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/devise-4.9.3/lib/devise/rails/routes.rb:268:in `each'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/devise-4.9.3/lib/devise/rails/routes.rb:268:in `block (3 levels) in devise_for'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/devise-4.9.3/lib/devise/rails/routes.rb:472:in `with_devise_exclusive_scope'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/devise-4.9.3/lib/devise/rails/routes.rb:267:in `block (2 levels) in devise_for'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/devise-4.9.3/lib/devise/rails/routes.rb:370:in `block in devise_scope'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/actionpack-7.0.8/lib/action_dispatch/routing/mapper.rb:871:in `scope'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/actionpack-7.0.8/lib/action_dispatch/routing/mapper.rb:1000:in `constraints'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/devise-4.9.3/lib/devise/rails/routes.rb:369:in `devise_scope'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/devise-4.9.3/lib/devise/rails/routes.rb:266:in `block in devise_for'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/devise-4.9.3/lib/devise/rails/routes.rb:242:in `each'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/devise-4.9.3/lib/devise/rails/routes.rb:242:in `devise_for'
        from /home/git/gitlab/config/routes/user.rb:42:in `draw_route'
        from /home/git/gitlab/lib/gitlab/patch/draw_route.rb:30:in `instance_eval'
        from /home/git/gitlab/lib/gitlab/patch/draw_route.rb:30:in `draw_route'
        from /home/git/gitlab/lib/gitlab/patch/draw_route.rb:17:in `draw_ce'
        from /home/git/gitlab/lib/gitlab/patch/draw_route.rb:11:in `draw'
        from /home/git/gitlab/config/routes.rb:278:in `block (2 levels) in <top (required)>'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/actionpack-7.0.8/lib/action_dispatch/routing/route_set.rb:428:in `instance_exec'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/actionpack-7.0.8/lib/action_dispatch/routing/route_set.rb:428:in `eval_block'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/actionpack-7.0.8/lib/action_dispatch/routing/route_set.rb:410:in `draw'
        from /home/git/gitlab/config/routes.rb:7:in `block in <top (required)>'
        from /home/git/gitlab/lib/initializer_connections.rb:18:in `raise_if_new_database_connection'
        from /home/git/gitlab/config/routes.rb:6:in `<top (required)>'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/railties-7.0.8/lib/rails/application/routes_reloader.rb:50:in `load'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/railties-7.0.8/lib/rails/application/routes_reloader.rb:50:in `block in load_paths'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/railties-7.0.8/lib/rails/application/routes_reloader.rb:50:in `each'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/railties-7.0.8/lib/rails/application/routes_reloader.rb:50:in `load_paths'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/railties-7.0.8/lib/rails/application/routes_reloader.rb:24:in `reload!'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/railties-7.0.8/lib/rails/application.rb:149:in `reload_routes!'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/devise-4.9.3/lib/devise/rails.rb:17:in `block in <class:Engine>'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/activesupport-7.0.8/lib/active_support/lazy_load_hooks.rb:92:in `block in execute_hook'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/activesupport-7.0.8/lib/active_support/lazy_load_hooks.rb:85:in `with_execution_control'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/activesupport-7.0.8/lib/active_support/lazy_load_hooks.rb:90:in `execute_hook'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/activesupport-7.0.8/lib/active_support/lazy_load_hooks.rb:76:in `block in run_load_hooks'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/activesupport-7.0.8/lib/active_support/lazy_load_hooks.rb:75:in `each'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/activesupport-7.0.8/lib/active_support/lazy_load_hooks.rb:75:in `run_load_hooks'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/railties-7.0.8/lib/rails/application/finisher.rb:73:in `block in <module:Finisher>'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/railties-7.0.8/lib/rails/initializable.rb:32:in `instance_exec'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/railties-7.0.8/lib/rails/initializable.rb:32:in `run'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/railties-7.0.8/lib/rails/initializable.rb:61:in `block in run_initializers'
        from /usr/local/lib/ruby/3.0.0/tsort.rb:228:in `block in tsort_each'
        from /usr/local/lib/ruby/3.0.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
        from /usr/local/lib/ruby/3.0.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
        from /usr/local/lib/ruby/3.0.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
        from /usr/local/lib/ruby/3.0.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
        from /usr/local/lib/ruby/3.0.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
        from /usr/local/lib/ruby/3.0.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
        from /usr/local/lib/ruby/3.0.0/tsort.rb:431:in `each_strongly_connected_component_from'
        from /usr/local/lib/ruby/3.0.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/railties-7.0.8/lib/rails/initializable.rb:50:in `each'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/railties-7.0.8/lib/rails/initializable.rb:50:in `tsort_each_child'
        from /usr/local/lib/ruby/3.0.0/tsort.rb:415:in `call'
        from /usr/local/lib/ruby/3.0.0/tsort.rb:415:in `each_strongly_connected_component_from'
        from /usr/local/lib/ruby/3.0.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/railties-7.0.8/lib/rails/initializable.rb:50:in `each'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/railties-7.0.8/lib/rails/initializable.rb:50:in `tsort_each_child'
        from /usr/local/lib/ruby/3.0.0/tsort.rb:415:in `call'
        from /usr/local/lib/ruby/3.0.0/tsort.rb:415:in `each_strongly_connected_component_from'
        from /usr/local/lib/ruby/3.0.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/railties-7.0.8/lib/rails/initializable.rb:50:in `each'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/railties-7.0.8/lib/rails/initializable.rb:50:in `tsort_each_child'
        from /usr/local/lib/ruby/3.0.0/tsort.rb:415:in `call'
        from /usr/local/lib/ruby/3.0.0/tsort.rb:415:in `each_strongly_connected_component_from'
        from /usr/local/lib/ruby/3.0.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/railties-7.0.8/lib/rails/initializable.rb:50:in `each'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/railties-7.0.8/lib/rails/initializable.rb:50:in `tsort_each_child'
        from /usr/local/lib/ruby/3.0.0/tsort.rb:415:in `call'
        from /usr/local/lib/ruby/3.0.0/tsort.rb:415:in `each_strongly_connected_component_from'
        from /usr/local/lib/ruby/3.0.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/railties-7.0.8/lib/rails/initializable.rb:50:in `each'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/railties-7.0.8/lib/rails/initializable.rb:50:in `tsort_each_child'
        from /usr/local/lib/ruby/3.0.0/tsort.rb:415:in `call'
        from /usr/local/lib/ruby/3.0.0/tsort.rb:415:in `each_strongly_connected_component_from'
        from /usr/local/lib/ruby/3.0.0/tsort.rb:349:in `block in each_strongly_connected_component'
        from /usr/local/lib/ruby/3.0.0/tsort.rb:347:in `each'
        from /usr/local/lib/ruby/3.0.0/tsort.rb:347:in `call'
        from /usr/local/lib/ruby/3.0.0/tsort.rb:347:in `each_strongly_connected_component'
        from /usr/local/lib/ruby/3.0.0/tsort.rb:226:in `tsort_each'
        from /usr/local/lib/ruby/3.0.0/tsort.rb:205:in `tsort_each'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/railties-7.0.8/lib/rails/initializable.rb:60:in `run_initializers'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/railties-7.0.8/lib/rails/application.rb:372:in `initialize!'
        from /home/git/gitlab/config/environment.rb:7:in `<top (required)>'
        from config.ru:5:in `require'
        from config.ru:5:in `block in <main>'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/rack-2.2.8/lib/rack/builder.rb:116:in `eval'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/rack-2.2.8/lib/rack/builder.rb:116:in `new_from_string'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/rack-2.2.8/lib/rack/builder.rb:105:in `load_file'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/rack-2.2.8/lib/rack/builder.rb:66:in `parse_file'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/puma-6.4.0/lib/puma/configuration.rb:368:in `load_rackup'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/puma-6.4.0/lib/puma/configuration.rb:290:in `app'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/puma-6.4.0/lib/puma/runner.rb:162:in `load_and_bind'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/puma-6.4.0/lib/puma/cluster.rb:359:in `run'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/puma-6.4.0/lib/puma/launcher.rb:194:in `run'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/puma-6.4.0/lib/puma/cli.rb:75:in `run'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/gems/puma-6.4.0/bin/puma:10:in `<top (required)>'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/bin/puma:25:in `load'
        from /home/git/gitlab/vendor/bundle/ruby/3.0.0/bin/puma:25:in `<top (required)>'
        from /usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.4.21/lib/bundler/cli/exec.rb:58:in `load'
        from /usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.4.21/lib/bundler/cli/exec.rb:58:in `kernel_load'
        from /usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.4.21/lib/bundler/cli/exec.rb:23:in `run'
        from /usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.4.21/lib/bundler/cli.rb:492:in `exec'
        from /usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.4.21/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
        from /usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.4.21/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
        from /usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.4.21/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
        from /usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.4.21/lib/bundler/cli.rb:34:in `dispatch'
        from /usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.4.21/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
        from /usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.4.21/lib/bundler/cli.rb:28:in `start'
        from /usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.4.21/exe/bundle:37:in `block in <top (required)>'
        from /usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.4.21/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
        from /usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.4.21/exe/bundle:29:in `<top (required)>'
        from /usr/local/bin/bundle:23:in `load'
        from /usr/local/bin/bundle:23:in `<main>'

The error message Unable to load application: ArgumentError: Missing :action key on routes definition, please check your routes. seems to indicate, that something fails when it tries to add the oauth related routes.

When I leave all configs as is, and just rename / remove my oauth generic Client ID and CLient Secret env variables so that the entrypoint script assumes it's not set up, Gitlab is booting and working fine again.

Any ideas on how to solve that issue or to work around it? Maybe without an upgrade of the package. Would it work fine in a newer release?

DarkLiKally avatar Aug 16 '25 11:08 DarkLiKally

For your information: An issue that occurs when running sameersbn/gitlab on a Synology NAS (failed to get urandom) has reported #2872 and fixed by #2897, applied to v16.8.2 or later (backported by v16.7.x with #2898, applied to v16.7.5 or later).
If you're facing other issues and add more detail, someone might be able to fix it based on your report.

kkimurak avatar Aug 19 '25 08:08 kkimurak

For your information: An issue that occurs when running sameersbn/gitlab on a Synology NAS (failed to get urandom) has reported #2872 and fixed by #2897, applied to v16.8.2 or later (backported by v16.7.x with #2898, applied to v16.7.5 or later). If you're facing other issues and add more detail, someone might be able to fix it based on your report.

Thanks for your reply! Yes i know those issues, I faced the same when I tried to update before, failed to get urandom. Thats why im stuck with version 16.6.2 for now. On this version I'm facing the issue that Generic OAuth is not working as described above in my report. For now I'm using LDAP Login as a workaround, but utilizing my SSO Server would be great.

Am I stuck with the issue on my version (generally generic oatuh not working on 16.6.2) or is something wrong with my configuration setup? I followed the guides in the Repo here for setting up Generic OAuth.

DarkLiKally avatar Aug 26 '25 09:08 DarkLiKally