Skip to content

gitlab-shell doesn't work with UNIX sockets and a GitLab relative path

From omnibus-gitlab!4498 (comment 397401883), if you specify a relative path such as:

external_url 'http://gitlab.example.com/gitlab'

gitlab-shell doesn't have a way to pass the /gitlab to the host. In trying to fix this in !406 (merged), it's a bit tricky to do this with the current gitlab-shell configuration. For example, let's say we have:

gitlab_url: "http+unix://%2Fvar%2Fopt%2Fgitlab%2Fgitlab-workhorse%2Fsocket"

If we have /gitlab as the relative path, how do we specify what is the UNIX socket path and what is the relative path? If we specify:

gitlab_url: "http+unix:///var/opt/gitlab/gitlab-workhorse.socket/gitlab

This is ambiguous. Is the socket in /var/opt/gitlab/gitlab-workhorse.socket/gitlab or in /var/opt/gitlab/gitlab-workhorse.socket?

Option 1: Use query parameter

Another approach would be to use query parameters such as the following:

gitlab_url: "http+unix://%2Fvar%2Fopt%2Fgitlab%2Fgitlab-workhorse%2Fsocket?relative_path=/gitlab"

Option 2: Use another config setting

Alternatively, do we fix this by adding an optional parameter?

gitlab_url: "http+unix://%2Fvar%2Fopt%2Fgitlab%2Fgitlab-workhorse%2Fsocket"
gitlab_relative_path: /gitlab

Option 3: Don't allow this config mode

Users can always use a TCP backend to handle this.

Since Gitaly depends on a single URL, I'm inclined to use a query string, but that does feel a little hacky.

@ashmckenzie @igor.drozdov What do you think?

Edited by Stan Hu