diff options
author | Jacob Vosmaer (GitLab) <jacob@gitlab.com> | 2017-11-21 16:34:41 +0300 |
---|---|---|
committer | Ahmad Sherif <ahmad.m.sherif@gmail.com> | 2017-11-21 16:34:41 +0300 |
commit | 254a330d04c16bb74c05ee91a44a17345beda781 (patch) | |
tree | 37992346afa8ed8ddf25051cfb879e2599fcbba7 /internal/rubyserver | |
parent | 9d5d2891b543559cacd7577d126ad60fb3a29fbf (diff) |
Run gitaly-ruby in the same directory as gitaly
Diffstat (limited to 'internal/rubyserver')
-rw-r--r-- | internal/rubyserver/rubyserver.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/internal/rubyserver/rubyserver.go b/internal/rubyserver/rubyserver.go index b719de6e8..7e6bfdc9f 100644 --- a/internal/rubyserver/rubyserver.go +++ b/internal/rubyserver/rubyserver.go @@ -91,6 +91,11 @@ func (s *Server) Stop() { func Start() (*Server, error) { lazyInit.Do(prepareSocketPath) + wd, err := os.Getwd() + if err != nil { + return nil, err + } + cfg := config.Config env := []string{ "GITALY_RUBY_GIT_BIN_PATH=" + command.GitPath(), @@ -98,8 +103,12 @@ func Start() (*Server, error) { "GITALY_RUBY_GITLAB_SHELL_PATH=" + cfg.GitlabShell.Dir, "GITALY_RUBY_GITALY_BIN_DIR=" + cfg.BinDir, } + gitalyRuby := path.Join(cfg.Ruby.Dir, "bin/gitaly-ruby") - args := []string{"bundle", "exec", "bin/gitaly-ruby", fmt.Sprintf("%d", os.Getpid()), socketPath()} + // Use 'ruby-cd' to make sure gitaly-ruby has the same working directory + // as the current process. This is a hack to sort-of support relative + // Unix socket paths. + args := []string{"bundle", "exec", "bin/ruby-cd", wd, gitalyRuby, fmt.Sprintf("%d", os.Getpid()), socketPath()} p, err := supervisor.New("gitaly-ruby", append(os.Environ(), env...), args, cfg.Ruby.Dir) return &Server{Process: p}, err |