Skip to content

feat: Allow configuration of sec database

Lucas Charles requested to merge add-sec-db into main

What does this merge request do and why?

Initial configuration for decomposing the sectionsec tables into a separate database. This configuration defaults to off and when enabled falls back to the main DB.

Relates to Add distribution configuration for Sec DB (gitlab#466281) in support of the parent epic Sec DB Decomposition Slice 1 - SBOM featureset (&14116)

For gitlab application config see See feat: Add dedicated schema for sec DB (gitlab!156952 - merged)

How to set up and validate locally

  1. Checkout the add-sec-db-schema branch inside gitlab.
  2. Checkout the add-sec-db branch inside GDK.
  3. Run gdk config set gitlab.rails.databases.sec.enabled true.
  4. Run gdk reconfigure.
  5. Check gitlab/config/database.yml
  6. Run rake db:create db:migrate
  7. Witness!

Example

Click to expand
❯ gdk config set gitlab.rails.databases.sec.enabled true
❯ gdk reconfigure
❯ grep -A8 'sec:' gitlab/config/database.yml
  sec:
    adapter: postgresql
    encoding: unicode
    database: gitlabhq_development
    database_tasks: false
    host: localhost
    port: 5432
    pool: 10
    gssencmode: disable
--
  sec:
    adapter: postgresql
    encoding: unicode
    database: gitlabhq_test
    database_tasks: false
    host: localhost
    port: 5432
    pool: 10
    gssencmode: disable

❯ gdk config set gitlab.rails.databases.sec.use_main_database true
❯ gdk reconfigure
❯ grep -A8 'sec:'  gitlab/config/database.yml
  sec:
    adapter: postgresql
    encoding: unicode
    database: gitlabhq_development_sec
    host: localhost
    port: 5432
    pool: 10
    gssencmode: disable
    prepared_statements: false
--
  sec:
    adapter: postgresql
    encoding: unicode
    database: gitlabhq_test_sec
    host: localhost
    port: 5432
    pool: 10
    gssencmode: disable
    prepared_statements: false

Impacted categories

The following categories relate to this merge request:

Merge request checklist

  • This change is backward compatible. If not, please include steps to communicate to our users.
  • Tests added for new functionality. If not, please raise an issue to follow-up.
  • Documentation added/updated, if needed.
  • Announcement added, if change is notable.
  • gdk doctor test added, if needed.
  • Add the ~highlight label if this MR should be included in the CHANGELOG.md.
Edited by Lucas Charles

Merge request reports