Skip to content

Add deprecation for single DB connnection

Deprecate single DB connection

Previously, the config/database.yml looked like this. It only has main: section:

production:
  main:
    adapter: postgresql
    encoding: unicode
    database: gitlabhq_production
    ...

With two database connections configured, the config/database.yml should look like:

production:
  main:
    adapter: postgresql
    encoding: unicode
    database: gitlabhq_production
    ...
  ci:
    adapter: postgresql
    encoding: unicode
    database: gitlabhq_production  # Ensure this is the same as main's database field
    database_tasks: false          # Ensure this is false
    ...

How to switch to two connections

Omnibus

  1. In /etc/gitlab/gitlab.rb, add the following line:

    gitlab_rails['databases']['ci']['enable'] = true
  2. Run gitlab-ctl reconfigure

  3. Run gitlab-rake gitlab:db:validate_config to check the config is correct. You can also check the contents of config/database.yml to verify it has two connections configured (see above).

Charts

  1. Configure global.psql.ci.enable to true
  2. In the toolbox pod, run gitlab-rake gitlab:db:validate_config to check the config is correct. You can also check the contents of config/database.yml to verify it has two connections configured (see above).

From source

Edit config/database.yml to add the ci: section. You can copy most fields from main, except for database_tasks which should be set to false

Edited by Thong Kuah