Skip to content

Remove support for uses_legacy_database_config

What does this MR do and why?

This was planned to to be removed in %15.0. This setting in config/database.yml (or inferred from the structure of config/database.yml) allowed GitLab installations (from source) to stick to the old "flat" structure like:

production:
  database: gitlabhq_production
  host: 127.0.0.1

as opposed to the new "nested" structure:

production:
  main:
    database: gitlabhq_production
    host: 127.0.0.1

which is a necessary step for optionally supporting our 2nd ci database like:

production:
  main:
    database: gitlabhq_production
    host: 127.0.0.1
  c:
    database: gitlabhq_production_ci
    host: 127.0.0.1

This change does not make ci required but it does make the nested structure (ie. main key) required.

Since we've already updated Omnibus installations and GDK to no longer generate the flat structure there would only be installations from source that are affected by this change and they should have already been receiving deprecation warnings for some months. This change will ensure they see an error if they don't have a top level main key in their config/database.yml and all they need to do is nest the config under main to fix the problem.

Screenshots or screen recordings

Screen_Shot_2022-04-13_at_11.30.42_am

How to set up and validate locally

  1. Backup your config/database.yml:
    1. cp config/database.yml config/database.yml.bkp
  2. Configure your config/database.yml with flat structure as described above (by removing the main key and moving the keys under it back 1 level of indentation, also removing the ci section entirely if you have it)
  3. Start GDK gdk start
  4. Tail the logs gdk tail rails-web
  5. See the error ERROR: This installation of GitLab uses unsupported 'config/database.yml'. The main: database needs to be defined as a first configuration item instead of primary. (RuntimeError)
  6. Restore your config/database.yml:
    1. cp config/database.yml.bkp config/database.yml
  7. Restart GDK gdk stop && gdk start
  8. Tail the logs gdk tail rails-web
  9. See there is no longer an error

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Closes #338182 (closed)

Edited by Dylan Griffith

Merge request reports