Skip to content

Add Workhorse support for HTTPS backend

What does this MR do?

I can't tell why this panic was added way back when, but it is now blocking a new Geo feature #325732 (comment 644501257)

Resolves #337794 (closed)

How to setup and validate locally (strongly suggested)

How to enable the feature on your local Geo secondary site

  1. Checkout this branch on your local Geo secondary site
  2. cd <path to gdk-geo directory>
  3. Edit Procfile
  4. Find the line that begins gitlab-workhorse: exec /usr/bin/env PATH=
  5. Add GEO_SECONDARY_PROXY=1 so the line looks like gitlab-workhorse: exec /usr/bin/env GEO_SECONDARY_PROXY=1 PATH=
  6. make gitlab-workhorse-update && gdk restart gitlab-workhorse && gdk tail gitlab-workhorse
  7. In another Terminal: cd <path to gdk directory (the primary)>/gitlab
  8. bin/rails runner "Feature.enable(:geo_secondary_proxy)"

When you visit http://gdk.test:3001 (your Geo secondary site), it should appear as though you are visiting the primary site. You can search your Workhorse log for messages containing the string Geo Proxy to see some related info. You can change your Workhorse log level to debug to see a more related messages. Your primary site's Workhorse log should show requests coming from the secondary site.

How to validate the feature

The idea is that we want to change the Geo primary site's Internal URL to be an https URL so that you can observe the Geo secondary site's Workhorse proxying to that https URL without a problem.

  1. Visit http://gdk.test:3000 (your Geo primary site)
  2. Navigate to Admin > Geo > Nodes
  3. Click Edit on the Geo primary site
  4. Get https://ngrok.com/
  5. Run ./ngrok http 3000
  6. Copy the https ngrok URL, let's say it's https://8c921afabba4.ngrok.io
  7. Paste it into the Internal URL field
  8. Click Save
  9. Within a minute, the secondary site's workhorse log should say e.g.:
    2021-08-06_22:21:18.82125 gitlab-workhorse      : {"level":"info","msg":"Geo Proxy: URL changed","newGeoProxyURL":{"Scheme":"https","Opaque":"","User":null,"Host":"8c921afabba4.ngrok.io","Path":"/","RawPath":"","ForceQuery":false,"RawQuery":"","Fragment":"","RawFragment":""},"oldGeoProxyURL":{"Scheme":"http","Opaque":"","User":null,"Host":"gdk.test:3000","Path":"/","RawPath":"","ForceQuery":false,"RawQuery":"","Fragment":"","RawFragment":""},"time":"2021-08-06T15:21:18-07:00"}

You should be able to visit the secondary (and get proxied to the primary). Your ngrok log should show the requests as well.

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Edited by Michael Kozono

Merge request reports