diff options
author | John Cai <jcai@gitlab.com> | 2019-06-04 20:37:31 +0300 |
---|---|---|
committer | John Cai <jcai@gitlab.com> | 2019-06-04 20:37:31 +0300 |
commit | b27493b8a6f19a0b4ab6325d38781a4f03088904 (patch) | |
tree | 017abdbab621babecd0f636ef954b4174ce4163b | |
parent | 51b832c5582901747ff9459a8bfc6905e3c106f6 (diff) | |
parent | 9f421054d1483db93d11502877c758938dbc5f9b (diff) |
Merge branch 'zj-minor-praefect-config-fixes' into 'master'
Praefect configuration fixes
See merge request gitlab-org/gitaly!1287
-rw-r--r-- | cmd/praefect/main.go | 2 | ||||
-rw-r--r-- | config.praefect.toml.example | 30 | ||||
-rw-r--r-- | internal/bootstrap/bootstrap.go | 2 | ||||
-rw-r--r-- | internal/config/config.go | 2 | ||||
-rw-r--r-- | internal/praefect/config/testdata/config.toml | 2 |
5 files changed, 26 insertions, 12 deletions
diff --git a/cmd/praefect/main.go b/cmd/praefect/main.go index 75d47308c..1ec7930ac 100644 --- a/cmd/praefect/main.go +++ b/cmd/praefect/main.go @@ -128,7 +128,7 @@ func getListeners(socketPath, listenAddr string) ([]net.Listener, error) { var listeners []net.Listener if socketPath != "" { - if err := os.Remove(socketPath); err != nil && !os.IsNotExist(err) { + if err := os.RemoveAll(socketPath); err != nil { return nil, err } l, err := net.Listen("unix", socketPath) diff --git a/config.praefect.toml.example b/config.praefect.toml.example index b6b8662a9..59e7563f1 100644 --- a/config.praefect.toml.example +++ b/config.praefect.toml.example @@ -1,22 +1,36 @@ # Example Praefect configuration file # # TCP address to listen on -# listen_addr = "127.0.0.1:2305" -socket_path = "/home/git/gitlab/tmp/sockets/private/praefect.socket" -# prometheus_listen_addr = "127.0.0.1:10101" +listen_addr = "127.0.0.1:2305" + +# # Praefect can listen on a socket when placed on the same machine as all clients +# socket_path = "/home/git/gitlab/tmp/sockets/private/praefect.socket" +# # Praefect will only replicate whitelisted repositories +# whitelist = ["@hashed/3f/db/3fdba35f04dc8c462986c992bcf875546257113072a909c162f7e470e581e278.git"] +# # Optional: export metrics via Prometheus +# prometheus_listen_addr = "127.0.01:10101" # # You can optionally configure Praefect to output JSON-formatted log messages to stdout # [logging] -# format = "json" +# format = "json" # # Optional: Set log level to only log entries with that severity or above # # One of, in order: debug, info, warn, errror, fatal, panic # # Defaults to "info" -# level = "warn" +# level = "warn" # # One or more Gitaly servers need to be configured to be managed. The names # of each server are used to link multiple nodes, or `gitaly_server`s together # as shard. listen_addr should be unique for all nodes. # Requires the protocol to be defined, e.g. tcp://host.tld:1234 -[[gitaly_server]] -name = "default" -listen_addr = "tcp://localhost:9999" + +[primary_server] + name = "default" + listen_addr = "tcp://gitaly-primary.example.com" + +# [[secondary_server]] +# name = "default" +# listen_addr = "tcp://gitaly-backup1.example.com" + +# [[secondary_server]] +# name = "backup" +# listen_addr = "tcp://gitaly-backup2.example.com" diff --git a/internal/bootstrap/bootstrap.go b/internal/bootstrap/bootstrap.go index bfb58066c..41c1c7d89 100644 --- a/internal/bootstrap/bootstrap.go +++ b/internal/bootstrap/bootstrap.go @@ -171,7 +171,7 @@ func (b *Bootstrap) waitGracePeriod(kill <-chan os.Signal) error { func (b *Bootstrap) listen(network, path string) (net.Listener, error) { if network == "unix" && b.isFirstBoot() { - if err := os.Remove(path); err != nil && !os.IsNotExist(err) { + if err := os.RemoveAll(path); err != nil { return nil, err } } diff --git a/internal/config/config.go b/internal/config/config.go index 5a7e26be6..e0bcdb98f 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -84,7 +84,7 @@ type Storage struct { // Logging contains the logging configuration for Gitaly type Logging struct { - Format string + Format string `toml:"format"` SentryDSN string `toml:"sentry_dsn"` RubySentryDSN string `toml:"ruby_sentry_dsn"` SentryEnvironment string `toml:"sentry_environment"` diff --git a/internal/praefect/config/testdata/config.toml b/internal/praefect/config/testdata/config.toml index 24f64add9..81701a359 100644 --- a/internal/praefect/config/testdata/config.toml +++ b/internal/praefect/config/testdata/config.toml @@ -16,7 +16,7 @@ prometheus_listen_addr = "" listen_addr = "tcp://gitaly-backup2.example.com" [logging] - Format = "" + format = "" sentry_dsn = "" ruby_sentry_dsn = "" level = "" |