Skip to content

An improper configuration file fails validation with an error discussing the wrong object

Summary

When a configuration file is built for sidekiq, the rails application will attempt to validate the connection object for artifacts, uploads, and lfs. But if the connection object is missing for any of these, we end up with an error that tells us something else is wrong with the file.

Settingslogic::MissingSetting: Missing setting 'connection' in 'backup' section in /srv/gitlab/config/gitlab.yml
/srv/gitlab/vendor/bundle/ruby/2.6.0/gems/settingslogic-2.0.9/lib/settingslogic.rb:189:in `missing_key'
(eval):3:in `connection'
/srv/gitlab/config/initializers/direct_upload_support.rb:9:in `verify!'
/srv/gitlab/config/initializers/direct_upload_support.rb:17:in `block (2 levels) in <top (required)>'
/srv/gitlab/config/initializers/direct_upload_support.rb:16:in `each'
/srv/gitlab/config/initializers/direct_upload_support.rb:16:in `block in <top (required)>'
/srv/gitlab/config/initializers/direct_upload_support.rb:15:in `tap'
/srv/gitlab/config/initializers/direct_upload_support.rb:15:in `<top (required)>'
/srv/gitlab/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:285:in `load'
/srv/gitlab/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:285:in `block in load'
/srv/gitlab/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
/srv/gitlab/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:285:in `load'
/srv/gitlab/vendor/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/engine.rb:657:in `block in load_config_initializer'
/srv/gitlab/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/notifications.rb:170:in `instrument'
/srv/gitlab/vendor/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/engine.rb:656:in `load_config_initializer'
/srv/gitlab/vendor/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/engine.rb:614:in `block (2 levels) in <class:Engine>'
/srv/gitlab/vendor/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/engine.rb:613:in `each'
/srv/gitlab/vendor/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/engine.rb:613:in `block in <class:Engine>'
/srv/gitlab/vendor/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/initializable.rb:32:in `instance_exec'
/srv/gitlab/vendor/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/initializable.rb:32:in `run'
/srv/gitlab/vendor/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/initializable.rb:61:in `block in run_initializers'
/srv/gitlab/vendor/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/initializable.rb:50:in `each'
/srv/gitlab/vendor/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/initializable.rb:50:in `tsort_each_child'
/srv/gitlab/vendor/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/initializable.rb:60:in `run_initializers'
/srv/gitlab/vendor/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/application.rb:361:in `initialize!'
/srv/gitlab/config/environment.rb:6:in `<top (required)>'
/srv/gitlab/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
/srv/gitlab/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require'
/srv/gitlab/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
/srv/gitlab/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
/srv/gitlab/vendor/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/application.rb:337:in `require_environment!'
/srv/gitlab/vendor/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/application.rb:520:in `block in run_tasks_blocks'
/srv/gitlab/vendor/bundle/ruby/2.6.0/gems/rake-12.3.3/exe/rake:27:in `<top (required)>'
/srv/gitlab/bin/bundle:3:in `load'
/srv/gitlab/bin/bundle:3:in `<main>'
Tasks: TOP => db:version => db:load_config => environment
(See full trace by running task with --trace)

As seen in the above, it's indicating we are missing connection for the key backup. Which, in our initializer, we don't check for:

The error message is simply very misleading. This causes confusion for the administrator of the system.

Steps to reproduce

Purposely do not configure object storage and disable minio during a helm chart based installation. During the install, sidekiq will fail to start with the above error.

Example Project

More details about this can be found here: gitlab-org/charts/gitlab#1751 (closed)

What is the expected correct behavior?

The error message should indicate that the connection key is missing in the correct sections of the yaml file.