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 orgcommand 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.ymlto 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
- Validates that both source and target cells are configured
- Checks that both cells have a Premium or Ultimate license
- Enables required feature flags on both cells:
- Source:
geo_selective_sync_by_organizations - Target:
geo_selective_sync_by_organizations+org_migration_target_cell
- Source:
- Configures Geo primary node on source cell
- Configures Geo secondary node on target cell
- Sets up the tracking database on the target cell
- Copies the
db_key_basesecret from source to target - Copies the
geo_nodestable from source to target - 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.
Related
- Part of: gitlab#571916 (closed)
- Full POC: !5555
- GitLab MR: gitlab!219850
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