Draft: Add gdk org configure-replication command

Summary

Adds the gdk org configure-replication command to set up Geo replication between a source (primary) and target (secondary) cell for organization migration.

This is a slice of the full org migration POC (!5555) focusing only on the configure-replication step.

Why this is safe to merge

New command, minimal blast radius:

  • Adds a new gdk org command that does not affect existing GDK functionality
  • Only 4 existing files modified with trivial additions:
    • lib/gdk/command.rb: +1 line (register command)
    • lib/gdk/config.rb: +5 lines (config schema)
    • gdk.example.yml: +3 lines (example config)
    • doc/howto/cells.md: +51 lines (documentation)
  • All other changes are new files (5 lib files + 5 spec files)

Well tested:

  • 22 RSpec examples covering all new classes
  • All CI checks pass (rubocop, rspec, docs-lint)

Isolated behavior:

  • Command only runs when explicitly invoked: gdk org configure-replication
  • Requires explicit configuration in gdk.yml to do anything
  • Without configuration, safely errors: ERROR: Cannot configure org replication without a valid configuration

Command output

$ gdk org configure-replication
ERROR: Cannot configure org replication without a valid configuration

$ gdk org
WARNING: Usage: gdk org configure-replication

$ gdk org invalid
WARNING: Usage: gdk org configure-replication

Usage

Configure in gdk.yml:

cells:
  enabled: true
  instance_count: 1
  org_migration:
    source_cell: legacy-cell  # The cell to migrate from (uses geo.node_name)
    targets:
      cell-2: {}               # Target cell name (uses geo.node_name)
  instances:
    - config:
        geo:
          enabled: true
          node_name: cell-2     # Must match target name in org_migration

Then run:

gdk org configure-replication

What configure-replication does

  1. Validates that both source and target cells are configured
  2. Checks that both cells have a Premium or Ultimate license
  3. Enables required feature flags on both cells:
    • Source: geo_selective_sync_by_organizations
    • Target: geo_selective_sync_by_organizations + org_migration_target_cell
  4. Configures Geo primary node on source cell
  5. Configures Geo secondary node on target cell
  6. Sets up the tracking database on the target cell
  7. Copies the db_key_base secret from source to target
  8. Copies the geo_nodes table from source to target
  9. Restarts Sidekiq on the target cell

Feature flags

The org_migration_target_cell feature flag is enabled on the target cell to mark it as an org migration target. This requires gitlab!219850 which adds this feature flag.

Merge request checklist

  • This MR references an issue describing the change.
  • This change is backward compatible.
  • Tests added for new functionality.
  • Documentation added/updated.
Edited by Michael Kozono

Merge request reports

Loading