Undefined method `terms_of_service_url'
Summary
The 500 is shown trying to open Terms of Service related to admin settings Let's Encrypt of pages.
Steps to reproduce
- Navigate to your instance’s Admin Area > Settings > Preferences and expand Pages settings.
- Click on Link "Terms of Service"
From docs: https://docs.gitlab.com/ee/administration/pages/index.html#lets-encrypt-integration
Example Project
Gitlab EE (Starter)
What is the current bug behavior?
The 500 page is shown.
What is the expected correct behavior?
I supposed it should be some page with the Terms of Service.
Relevant logs and/or screenshots
Started GET "/admin/application_settings/lets_encrypt_terms_of_service" for 62.69.2.2 at 2019-10-02 12:54:09 +0000
Processing by Admin::ApplicationSettingsController#lets_encrypt_terms_of_service as HTML
Completed 500 Internal Server Error in 17ms (ActiveRecord: 2.7ms | Elasticsearch: 0.0ms)
NoMethodError (undefined method `terms_of_service_url' for Gitlab::LetsEncrypt:Module):
app/controllers/admin/application_settings_controller.rb:62:in `lets_encrypt_terms_of_service'
ee/lib/gitlab/ip_address_state.rb:10:in `with'
ee/app/controllers/ee/application_controller.rb:43:in `set_current_ip_address'
lib/gitlab/session.rb:11:in `with_session'
app/controllers/application_controller.rb:450:in `set_session_storage'
lib/gitlab/i18n.rb:55:in `with_locale'
lib/gitlab/i18n.rb:61:in `with_user_locale'
app/controllers/application_controller.rb:444:in `set_locale'
lib/gitlab/middleware/rails_queue_duration.rb:27:in `call'
lib/gitlab/metrics/rack_middleware.rb:17:in `block in call'
lib/gitlab/metrics/transaction.rb:57:in `run'
lib/gitlab/metrics/rack_middleware.rb:17:in `call'
lib/gitlab/request_profiler/middleware.rb:17:in `call'
ee/lib/gitlab/jira/middleware.rb:17:in `call'
lib/gitlab/middleware/go.rb:20:in `call'
lib/gitlab/etag_caching/middleware.rb:13:in `call'
lib/gitlab/middleware/correlation_id.rb:16:in `block in call'
lib/gitlab/middleware/correlation_id.rb:15:in `call'
lib/gitlab/middleware/multipart.rb:117:in `call'
lib/gitlab/middleware/read_only/controller.rb:42:in `call'
lib/gitlab/middleware/read_only.rb:18:in `call'
lib/gitlab/middleware/basic_health_check.rb:25:in `call'
lib/gitlab/request_context.rb:26:in `call'
lib/gitlab/metrics/requests_rack_middleware.rb:29:in `call'
lib/gitlab/middleware/release_env.rb:12:in `call'
Output of checks
(If you are reporting a bug on GitLab.com, write: This bug happens on GitLab.com)
Results of GitLab environment info
Expand for output related to GitLab environment info
$ sudo gitlab-rake gitlab:env:infoSystem information System: Ubuntu 18.04 Proxy: no Current User: git Using RVM: no Ruby Version: 2.6.3p62 Gem Version: 2.7.9 Bundler Version:1.17.3 Rake Version: 12.3.2 Redis Version: 3.2.12 Git Version: 2.22.0 Sidekiq Version:5.2.7 Go Version: unknown
GitLab information Version: 12.3.3-ee Revision: 47e969b011f Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: PostgreSQL DB Version: 10.7 URL: https://gitlab.bpnsites.com HTTP Clone URL: https://gitlab.bpnsites.com/some-group/some-project.git SSH Clone URL: git@gitlab.bpnsites.com:some-group/some-project.git Elasticsearch: no Geo: no Using LDAP: no Using Omniauth: yes Omniauth Providers: bitbucket
GitLab Shell Version: 10.0.0 Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories GitLab Shell path: /opt/gitlab/embedded/service/gitlab-shell Git: /opt/gitlab/embedded/bin/git
Results of GitLab application Check
Expand for output related to the GitLab application check
$ sudo gitlab-rake gitlab:check SANITIZE=true Checking GitLab subtasks ...
Checking GitLab Shell ...
GitLab Shell: ... GitLab Shell version >= 10.0.0 ? ... OK (10.0.0) Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Check GitLab API access: OK Redis available via internal API: OK
gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Gitaly ...
Gitaly: ... default ... OK
Checking Gitaly ... Finished
Checking Sidekiq ...
Sidekiq: ... Running? ... yes Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Checking Incoming Email ...
Incoming Email: ... Reply by email is disabled in config/gitlab.yml
Checking Incoming Email ... Finished
Checking LDAP ...
LDAP: ... LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab App ...
Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... yes Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 6/1 ... yes 12/3 ... yes 2/4 ... yes 2/5 ... yes 11/6 ... yes 4/9 ... yes 24/10 ... yes 12/11 ... yes 12/12 ... yes 12/13 ... yes 19/14 ... yes 19/15 ... yes 19/16 ... yes 19/17 ... yes 19/18 ... yes 19/19 ... yes 19/20 ... yes 19/21 ... yes 19/22 ... yes 19/23 ... yes 19/24 ... yes 19/25 ... yes 19/26 ... yes 19/28 ... yes 19/29 ... yes 19/31 ... yes 19/33 ... yes 19/34 ... yes 19/35 ... yes 24/37 ... yes 2/38 ... yes 8/39 ... yes 28/41 ... yes 3/42 ... yes 28/43 ... yes 28/44 ... yes 30/46 ... yes 30/47 ... yes 31/48 ... yes 12/49 ... yes 33/50 ... yes 6/51 ... yes 11/52 ... yes 12/53 ... yes 6/55 ... yes 6/56 ... yes 12/57 ... yes 36/58 ... yes 6/59 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.5.3 ? ... yes (2.6.3) Git version >= 2.22.0 ? ... yes (2.22.0) Git user has default SSH configuration? ... yes Active users: ... 15 Is authorized keys file accessible? ... yes Elasticsearch version 5.6 - 6.x? ... skipped (elasticsearch is disabled)
Checking GitLab App ... Finished
Checking GitLab subtasks ... Finished
Possible fixes
The problem line is here: https://gitlab.com/gitlab-org/gitlab/blob/master/app/controllers/admin/application_settings_controller.rb#L62
# Getting ToS url requires `directory` api call to Let's Encrypt
# which could result in 500 error/slow rendering on settings page
# Because of that we use separate controller action
def lets_encrypt_terms_of_service
redirect_to ::Gitlab::LetsEncrypt.terms_of_service_url
end