Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZeger-Jan van de Weg <git@zjvandeweg.nl>2019-04-04 22:49:07 +0300
committerJohn Cai <jcai@gitlab.com>2019-11-19 19:45:36 +0300
commit25fefd700f97f7349955b6103ab047676de758a6 (patch)
tree557c87dcfc6282f8f7de676a1ec1b0cbcb035199 /internal/rubyserver
parente3d79617cba8ca2dab01700d6af36bf4670b0341 (diff)
Allow socket dir for Gitaly-Ruby to be configured
In case the `/tmp` directory can't be used for security reasons, this can be configured. The default behaviour as in production right now will remain. So if nothing is set, `/tmp` will be reused.
Diffstat (limited to 'internal/rubyserver')
-rw-r--r--internal/rubyserver/rubyserver.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/internal/rubyserver/rubyserver.go b/internal/rubyserver/rubyserver.go
index 21bfbd744..2f8e57bc9 100644
--- a/internal/rubyserver/rubyserver.go
+++ b/internal/rubyserver/rubyserver.go
@@ -47,6 +47,11 @@ func init() {
}
func prepareSocketPath() {
+ if config.Config.InternalSocketDir != "" {
+ socketDir = config.Config.InternalSocketDir
+ return
+ }
+
// The socket path must be short-ish because listen(2) fails on long
// socket paths. We hope/expect that ioutil.TempDir creates a directory
// that is not too deep. We need a directory, not a tempfile, because we
@@ -64,7 +69,7 @@ func socketPath(id int) string {
panic("socketDir is not set")
}
- return path.Join(filepath.Clean(socketDir), fmt.Sprintf("socket.%d", id))
+ return filepath.Join(socketDir, fmt.Sprintf("ruby.%d", id))
}
// Server represents a gitaly-ruby helper process.
@@ -91,7 +96,8 @@ func (s *Server) Stop() {
}
}
- if socketDir != "" {
+ // If we use the old gitaly-ruby temp dir, we should clean up
+ if config.Config.InternalSocketDir == "" && socketDir != "" {
os.RemoveAll(socketDir)
}
}
@@ -133,7 +139,7 @@ func (s *Server) start() error {
env = append(env, "SENTRY_ENVIRONMENT="+sentryEnvironment)
}
- gitalyRuby := path.Join(cfg.Ruby.Dir, "bin/gitaly-ruby")
+ gitalyRuby := path.Join(cfg.Ruby.Dir, "bin", "gitaly-ruby")
numWorkers := cfg.Ruby.NumWorkers
balancer.ConfigureBuilder(numWorkers, 0)