Mailroom fails to start in GitLab 16.6
Summary
!136002 (merged) added support for encrypted secrets for Redis. This relied on GitLab rails environment being available to populate few settings. However, Mailroom also uses Redis, but without the rails environment being present. This causes mailroom to fail starting with 16.6 with errors like the following
==> /var/log/gitlab/mailroom/current <==
2023-11-17_15:58:51.82444 /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/redis/wrapper.rb:113:in `secret_file': uninitialized constant Gitlab::Redis::Wrapper::Settings (NameError)
2023-11-17_15:58:51.82455 Did you mean? String
2023-11-17_15:58:51.82458 from /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/redis/wrapper.rb:135:in `encrypted_secrets'
2023-11-17_15:58:51.82461 from /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/redis/wrapper.rb:159:in `parse_encrypted_config'
2023-11-17_15:58:51.82462 from /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/redis/wrapper.rb:144:in `redis_store_options'
2023-11-17_15:58:51.82464 from /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/redis/wrapper.rb:104:in `db'
2023-11-17_15:58:51.82465 from /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/mail_room.rb:114:in `redis_config'
2023-11-17_15:58:51.82466 from /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/mail_room.rb:90:in `fetch_config'
2023-11-17_15:58:51.82467 from /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/mail_room.rb:82:in `block in configs'
2023-11-17_15:58:51.82469 from /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/mail_room.rb:82:in `to_h'
2023-11-17_15:58:51.82470 from /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/mail_room.rb:82:in `configs'
2023-11-17_15:58:51.82472 from /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/mail_room.rb:64:in `enabled_configs'
2023-11-17_15:58:51.82473 from /opt/gitlab/embedded/service/gitlab-rails/config/mail_room.yml:4:in `<main>'
2023-11-17_15:58:51.82474 from /opt/gitlab/embedded/lib/ruby/3.0.0/erb.rb:905:in `eval'
2023-11-17_15:58:51.82475 from /opt/gitlab/embedded/lib/ruby/3.0.0/erb.rb:905:in `result'
2023-11-17_15:58:51.82477 from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/gitlab-mail_room-0.0.23/lib/mail_room/configuration.rb:18:in `initialize'
2023-11-17_15:58:51.82478 from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/gitlab-mail_room-0.0.23/lib/mail_room/cli.rb:44:in `new'
2023-11-17_15:58:51.82479 from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/gitlab-mail_room-0.0.23/lib/mail_room/cli.rb:44:in `initialize'
2023-11-17_15:58:51.82481 from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/gitlab-mail_room-0.0.23/bin/mail_room:5:in `new'
2023-11-17_15:58:51.82482 from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/gitlab-mail_room-0.0.23/bin/mail_room:5:in `<top (required)>'
2023-11-17_15:58:51.82483 from /opt/gitlab/embedded/bin/mail_room:25:in `load'
2023-11-17_15:58:51.82484 from /opt/gitlab/embedded/bin/mail_room:25:in `<main>'
Steps to reproduce
Deploy a GitLab 16.6 instance with incoming email enabled.
Example Project
What is the current bug behavior?
Mailroom fails to start
What is the expected correct behavior?
Mailroom should work fine
Relevant logs and/or screenshots
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true
)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true
)(we will only investigate if the tests are passing)
Possible fixes
Edited by Balasankar 'Balu' C