Skip to content

gitlab-ctl/chef does not restart postgresql when the listen_address changes

Summary

When following the Setup Geo steps the postgresql['listen_address'] was changed in gitlab.rb.

After the change was made and the sudo gitlab-ctl reconfigure was attempted it failed due to Postgresql not running:

[2025-10-21T15:39:53+00:00] FATAL: Mixlib::ShellOut::ShellCommandFailed: rails_migration[gitlab-rails] (gitlab::database_migrations line 51) had an error: Mixlib::ShellOut::ShellCommandFailed: bash_hide_env[migrate gitlab-rails database] (gitlab::database_migrations line 20) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of "bash"  ----
STDOUT: rake aborted!
ActiveRecord::DatabaseConnectionError: There is an issue connecting with your hostname: 10.154.0.2.

Please check your database configuration and ensure there is a valid connection to your database.
/opt/gitlab/embedded/service/gitlab-rails/gems/activerecord-gitlab/lib/active_record/gitlab_patches/abstract_adapter.rb:32:in `block in reconnect!

Steps to reproduce

  • Install and setup basic Gitlab Standalone
  • ensure that postgresql is using the standard socket access
  • edit gitlab.rb and add postgresql['listen_address']
  • perform reconfigure: sudo gitlab-ctl reconfigure

What is the current bug behavior?

When a gitlab-ctl reconfigure is performed it detects that the postgresql configuration has changed so it performs a "reload of the configuration" by sending a HUP to the process:

[2025-10-21T15:38:44+00:00] INFO: postgresql_config[gitlab] sending run action to execute[reload postgresql] (immediate)
Recipe: postgresql::standalone
  * execute[reload postgresql] action run[2025-10-21T15:38:46+00:00] INFO: execute[reload postgresql] ran successfully

    - execute /opt/gitlab/bin/gitlab-ctl hup postgresql
[2025-10-21T15:38:46+00:00] INFO: postgresql_config[gitlab] sending run action to execute[start postgresql] (immediate)
  * execute[start postgresql] action run (skipped due to not_if)

However, postgresql does not change the listen address due to the hup

2025-10-21_15:38:46.33429 LOG:  received SIGHUP, reloading configuration files
2025-10-21_15:38:46.34510 LOG:  parameter "listen_addresses" cannot be changed without restarting the server
2025-10-21_15:38:46.34563 LOG:  configuration file "/var/opt/gitlab/postgresql/data/postgresql.conf" contains errors; unaffected changes were applied

The solution is now in an inconsistent state where we think the db is listening on a host and port as configured in gitlab.rb but it is not.

What is the expected correct behavior?

When a gitlab-ctl reconfigure is performed and the changes requires a restart of postgresql then it should warn the user and perform the restart of postgresql.

Relevant logs

Relevant logs

Details of package version

Provide the package version installation details