Check Topology Service Health during cells sequence alteration

What does this MR do and why?

Checks the TS health during DB provisioning and aborts the process in case the TS is unhealthy.

How to test

Test the Health Service

  1. Clone https://gitlab.com/gitlab-org/cells/topology-service and follow the set-up process https://gitlab.com/gitlab-org/cells/topology-service/-/blob/main/docs/development.md.
  2. Start the TS server: go run . serve
REST Insecure server running at port [::]:9098
gRPC Insecure server running at port [::]:9097
  1. Configure the cells in config/gitlab.yml:
  cell:
    enabled: true
    id: 1
    database:
      skip_sequence_alteration: false
    topology_service_client:
      address: 127.0.0.1:9097
      ca_file: /Users/leonardodarosa/gdk/topology-service/tmp/certs/ca-cert.pem
      private_key_file: /Users/leonardodarosa/gdk/topology-service/tmp/certs/client-key.pem
      certificate_file: /Users/leonardodarosa/gdk/topology-service/tmp/certs/client-cert.pem
  1. In the rails c:
[1] pry(main)> Gitlab::TopologyServiceClient::HealthService.new.service_healthy?
=> true

Test the gitlab:db:configure task

Check Topology Service Health during cells sequence alteration

Case 1: TS is unhealthy

⚠️ This will re-create your local DB

  1. Stop TS
  2. Reset the DB: gdk stop && gdk start db && rails db:drop db:create
  3. Run bundle exec rake gitlab:db:configure
  4. An error should happen:
GRPC::Unavailable: 14:failed to connect to all addresses; last error: UNKNOWN: ipv4:127.0.0.1:9097: Failed to connect to remote host: Connection refused. debug_error_string:{UNKNOWN:Error received from peer  {grpc_message:"failed to connect to all addresses; last error: UNKNOWN: ipv4:127.0.0.1:9097: Failed to connect to remote host: Connection refused", grpc_status:14, created_time:"2025-06-27T18:39:14.3073-03:00"}}

Case 2: TS is healthy

⚠️ This will re-create your local DB

  1. Start TS: go run . serve
  2. Reset the DB: gdk stop && gdk start db && rails db:drop db:create
  3. Run bundle exec rake gitlab:db:configure
  4. Everything should work:
Topology Service is HEALTHY.
Running db:schema:load:main rake task
Running db:schema:load:ci rake task
Running gitlab:db:alter_cell_sequences_range rake task with (100000000000, 199999999999)

Related to #550496 (closed)

Edited by Leonardo da Rosa

Merge request reports

Loading