Skip to content

WIP: Geo: Move push to secondary (SSH) logic from Rails into workhorse - push

This MR moves the push logic from Rails (https://gitlab.com/gitlab-org/gitlab-ee/blob/master/ee/lib/api/geo.rb#L70-88) into workhorse. In the broad strokes, here's how push to secondary (SSH) works:

  1. git push to secondary from command line
  2. check_custom_action(cmd) (https://gitlab.com/gitlab-org/gitlab-ee/blob/master/lib/gitlab/git_access.rb#L68) is examined
  3. For a valid Geo setup, https://gitlab.com/gitlab-org/gitlab-ee/blob/master/ee/lib/ee/gitlab/geo_git_access.rb#L34-47 is executed which returns a JSON payload to gitlab-shell with some endpoints to POST to in sequence - ["/api/v4/geo/proxy_git_push_ssh/info_refs", "/api/v4/geo/proxy_git_push_ssh/push"]
  4. Each endpoint is POST'd at the secondary node, with any output being send to the following endpoint (e.g. output from /api/v4/geo/proxy_git_push_ssh/info_refs is sent POST'd to /api/v4/geo/proxy_git_push_ssh/push)
  5. For each /api/v4/geo/proxy_git_push_ssh/* API endpoint on the secondary node, logic for info_refs (https://gitlab.com/gitlab-org/gitlab-ee/blob/master/ee/lib/gitlab/geo/git_push_ssh_proxy.rb#L57) and push (https://gitlab.com/gitlab-org/gitlab-ee/blob/master/ee/lib/gitlab/geo/git_push_ssh_proxy.rb#L71) is executed.

Items 4. and 5. present a challenge here as we need to not only POST data to the various endpoints, but we also need to return and pass along any output.

Am totally open to alternate ways of achieving the same result 😄

Related:

Edited by Ash McKenzie

Merge request reports