ApplicationSettings should not be reset by seeding on 2nd cell
What does this MR do and why?
Prevent the rake task db:seed_fu
from overriding main_clusterwide
data.
It introduces the concept of context
for development seeds. By having two contexts cell
and clusterwide
. The seeds of clusterwide
are applied by the primary cell only. While cell
seeds can be applied by any cells.
How to set up and validate locally
- Make sure you pull this branch of
gitlab
:412075-application-settings-should-not-be-reset-by-seeding
. - Make sure you run
gitlab
on an empty database. See the next section for how to change to a new empty database. - Run
rake db:seed_fu
on your GitLab project to seed the development database. - Add another cell by following the instructions on this page: https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/main/doc/howto/cells.md?ref_type=heads
- On your 2nd GDK Cell instance, from the directory
gdk2/gitlab
, runrake db:seed_fu
. It should run without errors, even if some seeds are not created. We have some TODOs for that. They will be solved as we make progress on the Cells project. - Feel free to remove your GDK2 Cell installation. Make sure you stop the services first: https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/main/doc/howto/cells.md?ref_type=heads#clean-up-the-installation
How to switch to an empty database for GitLab
My way of changing temporary to a new empty GitLab database:
- From
config/database.yml
I changemain
andci
database to some new databasetemporary_database
. - Make sure that
ci
is changed todatabase_tasks: false
. - Run
rake db:create db:setup
- Make sure you switch back to the previous database.
Your config/database.yml
should look like this while testing:
main: &development_main
adapter: postgresql
encoding: unicode
database: temporary_database
database_tasks: true
host: /Users/omar/gdk/postgresql
port: 5432
pool: 10
prepared_statements: false
variables:
statement_timeout: 120s
ci:
adapter: postgresql
encoding: unicode
database: temporary_database
database_tasks: false
host: /Users/omar/gdk/postgresql
port: 5432
pool: 10
prepared_statements: false
variables:
statement_timeout: 120s
Some comments
- We already have an epic for the follow ups to fix the Cell2 seeds: &11618
- Production Seeds are not touched for now. They are outside the context of this issue. Since seeds target SaaS GitLab, we don't yet if we need to modify them.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #412075
Edited by Omar Qunsul