Skip to content

Update DB TCP SQL password to use hash command

Anton Smith requested to merge docs/db-tcp-update-sql-password-hash into master

What does this MR do?

Using postgresql['sql_user_password'] = Digest::MD5.hexdigest "securesqlpassword" << postgresql['sql_user'] in your gitlab.rb file generates this message on sudo gitlab-ctl reconfigure:

> gitlab-ctl reconfigure

Starting Chef Client, version 14.14.29
resolving cookbooks for run list: ["gitlab-ee"]
Synchronizing Cookbooks:
  - gitlab-ee (0.0.1)
  - repmgr (0.1.0)
  - runit (4.3.0)
  - redis (0.1.0)
  - registry (0.1.0)
  - gitaly (0.1.0)
  - package (0.1.0)
  - nginx (0.1.0)
  - postgresql (0.1.0)
  - crond (0.1.0)
  - gitlab (0.0.1)
  - praefect (0.1.0)
  - consul (0.1.0)
  - mattermost (0.1.0)
  - monitoring (0.1.0)
  - letsencrypt (0.1.0)
  - acme (4.1.1)
Installing Cookbook Gems:
Compiling Cookbooks...

================================================================================
Recipe Compile Error in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab-ee/recipes/default.rb
================================================================================

TypeError
---------
no implicit conversion of Gitlab::ConfigMash into String

Cookbook Trace:
---------------
  /opt/gitlab/embedded/cookbooks/cache/cookbooks/package/libraries/helpers/settings_helper.rb:105:in `block in from_file'
  /opt/gitlab/embedded/cookbooks/cache/cookbooks/package/libraries/config_mash.rb:29:in `auto_vivify'
  /opt/gitlab/embedded/cookbooks/cache/cookbooks/package/libraries/helpers/settings_helper.rb:105:in `from_file'
  /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/config.rb:22:in `from_file'
  /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/default.rb:26:in `from_file'
  /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab-ee/recipes/default.rb:20:in `from_file'

Relevant File Content:
----------------------
/opt/gitlab/embedded/cookbooks/cache/cookbooks/package/libraries/helpers/settings_helper.rb:

 98:
 99:    def from_file(_file_path)
100:      # Throw errors for unrecognized top level calls (usually spelling mistakes)
101:      config_strict_mode true
102:      # Turn on node deprecation messages
103:      Gitlab::Deprecations::NodeAttribute.log_deprecations = true
104:      # Allow auto mash creation during from_file call
105>>     Gitlab::ConfigMash.auto_vivify { super }
106:    ensure
107:      config_strict_mode false
108:      Gitlab::Deprecations::NodeAttribute.log_deprecations = false
109:    end
110:
111:    # Enhance set so strict mode errors aren't thrown as long as the setting is witin our defined config
112:    def internal_set(symbol, value)
113:      if configuration.key?(symbol)
114:        configuration[symbol] = value

System Info:
------------
chef_version=14.14.29
platform=ubuntu
platform_version=20.04
ruby=ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]
program_name=/opt/gitlab/embedded/bin/chef-client
executable=/opt/gitlab/embedded/bin/chef-client


Running handlers:
There was an error running gitlab-ctl reconfigure:

no implicit conversion of Gitlab::ConfigMash into String

Running handlers complete
Chef Client failed. 0 resources updated in 03 seconds

I've changed the docs so the user must run the gitlab-ctl pg-password-md5 gitlab to generate the SQL password hash. After using the SQL password hash generated by this command, a subsequent gitlab-ctl reconfigure was successful and I was able to connect to the database via TCP.

Please note that the gitlab.rb template actually mentions using gitlab-ctl pg-password-md5 gitlab to generate the SQL password hash https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-config-template/gitlab.rb.template#L946-947

I'm using GitLab 12.10.3-ee.

Related issues

Changing the header title?

  • Is it completely necessary to change the title? Changing titles breaks deep linking. If yes, proceed further.
  • Move the old heading title to the bottom of the page.
  • Change the header tag to h5, #####.

Moving docs to a new location?

  • Make sure the old link is not removed and has its contents replaced with a link to the new location.
  • Make sure internal links pointing to the document in question are not broken.

Merge request reports

Loading