Skip to content

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.

gdk_cells_seeds

How to set up and validate locally

  1. Make sure you pull this branch of gitlab: 412075-application-settings-should-not-be-reset-by-seeding.
  2. Make sure you run gitlab on an empty database. See the next section for how to change to a new empty database.
  3. Run rake db:seed_fu on your GitLab project to seed the development database.
  4. 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
  5. On your 2nd GDK Cell instance, from the directory gdk2/gitlab, run rake 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.
  6. 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:

  1. From config/database.yml I change main and ci database to some new database temporary_database.
  2. Make sure that ci is changed to database_tasks: false.
  3. Run rake db:create db:setup
  4. 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

  1. We already have an epic for the follow ups to fix the Cell2 seeds: &11618
  2. 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.

Related to #412075

Edited by Omar Qunsul

Merge request reports