Add ability to configure main_clusterwide database
What does this merge request do and why?
Add ability to configure main_clusterwide
database. This is part of Cells effort.
In previous GitLab MRs we added support for a different main_clusterwide
database connection.
The idea for main_clusterwide
is to allow many Cells to share tables such as application_settings
.
This only supports single cell. We will extend GDK config to support connection to second cell at later stage (you can see gitlab#388278 (comment 1381141501) for a rough idea)
Related: gitlab#388278 (closed)
How to set up and validate locally
- Test config/database.yml by default (
cells.enabled=false
) with :make gitlab/config/database.yml
- Test config/database.yml with
cells.enabled=true
) with :gdk config set cells.enabled true make gitlab/config/database.yml
With cells.enabled=true
, you will see the main_clusterwide
connection in config/database.yml
:
(arm64) tkgl2:gdk-ee tkuah$ make gitlab/config/database.yml
ℹ️ 'gitlab/config/database.yml' has incoming changes:
-------------------------------------------------------------------------------------------------------------
@@ -19,6 +19,14 @@ development:
prepared_statements: false
variables:
statement_timeout: 120s
+ main_clusterwide: &main_clusterwide
+ adapter: postgresql
+ encoding: unicode
+ database: gitlabhq_development
+ database_tasks: false
+ host: /Users/tkuah/code/gdk-ee/postgresql
+ port: 5432
+ pool: 5
test: &test
main:
@@ -41,3 +49,6 @@ test: &test
prepared_statements: false
variables:
statement_timeout: 120s
+ main_clusterwide:
+ <<: *main_clusterwide
+ database: gitlabhq_test
-------------------------------------------------------------------------------------------------------------
⚠️ WARNING: 'gitlab/config/database.yml' has been overwritten. To recover the previous version, run:
cp -f '/Users/tkuah/code/gdk-ee/.backups/gitlab__config__database.yml.20230508143904' \
'/Users/tkuah/code/gdk-ee/gitlab/config/database.yml'
If you want to protect this file from being overwritten, see:
https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/main/doc/configuration.md#overwriting-configuration-files
-------------------------------------------------------------------------------------------------------------
Impacted categories
The following categories relate to this merge request:
-
gdk-reliability - e.g. When a GDK action fails to complete. -
gdk-usability - e.g. Improvements or suggestions around how the GDK functions. -
gdk-performance - e.g. When a GDK action is slow or times out.
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. => Next MR
-
Announcement added, if change is notable. -
gdk doctor
test added, if needed. -
Add the ~highlight
label if this MR should be included in theCHANGELOG.md
.
Edited by Thong Kuah