MSP-8007 fix threads
This commit is contained in:
1 parent
36e320af28
commit
94af308030
5 files changed
+16
-13
No files matched your search
+1
-1
@@ -6,7 +6,7 @@ replace isp-config-service => ../..
|
||||
|
||||
require (
|
||||
github.com/jmoiron/sqlx v1.4.0
|
||||
github.com/mattn/go-sqlite3 v1.14.42
|
||||
github.com/mattn/go-sqlite3 v1.14.47
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/pressly/goose/v3 v3.27.2
|
||||
github.com/txix-open/isp-kit v1.71.1
|
||||
|
||||
@@ -100,6 +100,7 @@ github.com/mattn/go-sqlite3 v1.14.32 h1:JD12Ag3oLy1zQA+BNn74xRgaBbdhbNIDYvQUEuuE
|
||||
github.com/mattn/go-sqlite3 v1.14.32/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
|
||||
github.com/mattn/go-sqlite3 v1.14.42 h1:MigqEP4ZmHw3aIdIT7T+9TLa90Z6smwcthx+Azv4Cgo=
|
||||
github.com/mattn/go-sqlite3 v1.14.42/go.mod h1:pjEuOr8IwzLJP2MfGeTb0A35jauH+C2kbHKBr7yXKVQ=
|
||||
github.com/mattn/go-sqlite3 v1.14.47/go.mod h1:6JTjA44L93a0QCyJef5YvlPoKXntQPjzWv5gtm9sB6w=
|
||||
github.com/mfridman/interpolate v0.0.2 h1:pnuTK7MQIxxFz1Gr+rjSIx9u7qVjf5VOoM/u6BbAxPY=
|
||||
github.com/mfridman/interpolate v0.0.2/go.mod h1:p+7uk6oE07mpE/Ik1b8EckO0O4ZXiGAfshKBWLUM9Xg=
|
||||
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
|
||||
|
||||
@@ -78,6 +78,9 @@ type Config struct {
|
||||
// If NoNodeVerify is true this field is ignored.
|
||||
NodeVerifyServerName string
|
||||
|
||||
// NodeVerifyCommonName is the CommonName to verify as on the certificates returned by a node.
|
||||
NodeVerifyCommonName string
|
||||
|
||||
// NodeID is the Raft ID for the node.
|
||||
NodeID string
|
||||
|
||||
|
||||
@@ -81,6 +81,7 @@ func ParseFlags(name, desc string, build *BuildInfo) (*Config, error) {
|
||||
fs.BoolVar(&config.NoNodeVerify, "node-no-verify", false, "Skip verification of any node-node certificate")
|
||||
fs.BoolVar(&config.NodeVerifyClient, "node-verify-client", false, "Enable mutual TLS for node-to-node communication")
|
||||
fs.StringVar(&config.NodeVerifyServerName, "node-verify-server-name", "", "Hostname to verify on certificate returned by a node")
|
||||
fs.StringVar(&config.NodeVerifyCommonName, "node-verify-common-name", "", "CommonName to verify on certificate returned by a node")
|
||||
fs.StringVar(&config.AuthFile, "auth", "", "Path to authentication and authorization file. If not set, not enabled")
|
||||
fs.StringVar(&config.AutoBackupFile, "auto-backup", "", "Path to automatic backup configuration file. If not set, not enabled")
|
||||
fs.StringVar(&config.AutoRestoreFile, "auto-restore", "", "Path to automatic restore configuration file. If not set, not enabled")
|
||||
|
||||
+10
-12
@@ -26,7 +26,7 @@ import (
|
||||
"github.com/rqlite/rqlite/v10/auto/backup"
|
||||
"github.com/rqlite/rqlite/v10/cluster"
|
||||
"github.com/rqlite/rqlite/v10/cmd"
|
||||
command "github.com/rqlite/rqlite/v10/command/proto"
|
||||
cmdpkg "github.com/rqlite/rqlite/v10/command"
|
||||
"github.com/rqlite/rqlite/v10/db"
|
||||
"github.com/rqlite/rqlite/v10/db/extensions"
|
||||
httpd "github.com/rqlite/rqlite/v10/http"
|
||||
@@ -83,7 +83,7 @@ func main(ctx context.Context, r *Rqlite) error {
|
||||
r.localHttpAddr = cfg.HTTPAddr
|
||||
|
||||
// Configure logging and pump out initial message.
|
||||
log.Printf("%s starting, version %s, SQLite %s, commit %s, branch %s, compiler (toolchain) %s, compiler (command) %s",
|
||||
log.Printf("%s starting, version %s, SQLite %s, commit %s, compiler (toolchain) %s, compiler (command) %s",
|
||||
name, cmd.Version, db.DBVersion, cmd.Commit, runtime.Compiler, cmd.CompilerCommand)
|
||||
log.Printf("%s, target architecture is %s, operating system target is %s", runtime.Version(),
|
||||
runtime.GOARCH, runtime.GOOS)
|
||||
@@ -151,7 +151,10 @@ func main(ctx context.Context, r *Rqlite) error {
|
||||
if err != nil {
|
||||
log.Fatalf("failed to create cluster client: %s", err.Error())
|
||||
}
|
||||
httpServ, err := startHTTPService(cfg, str, clstrClient, credStr)
|
||||
pxy := proxy.New(str, clstrClient)
|
||||
pxy.SetAPIAddr(cfg.HTTPAdv)
|
||||
|
||||
httpServ, err := startHTTPService(cfg, str, clstrClient, credStr, pxy)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to start HTTP server: %s", err.Error())
|
||||
}
|
||||
@@ -353,9 +356,9 @@ func createStore(cfg *Config, ln *tcp.Layer, extensions []string) (*store.Store,
|
||||
return str, nil
|
||||
}
|
||||
|
||||
func startHTTPService(cfg *Config, str *store.Store, cltr *cluster.Client, credStr *auth.CredentialsStore) (*httpd.Service, error) {
|
||||
func startHTTPService(cfg *Config, str *store.Store, cltr *cluster.Client, credStr *auth.CredentialsStore, pxy *proxy.Proxy) (*httpd.Service, error) {
|
||||
// Create HTTP server and load authentication information.
|
||||
s := httpd.New(cfg.HTTPAddr, str, cltr, proxy.New(str, cltr), credStr)
|
||||
s := httpd.New(cfg.HTTPAddr, str, cltr, pxy, credStr)
|
||||
|
||||
s.CACertFile = cfg.HTTPx509CACert
|
||||
s.CertFile = cfg.HTTPx509Cert
|
||||
@@ -394,7 +397,7 @@ func startNodeMux(cfg *Config, ln net.Listener) (*tcp.Mux, error) {
|
||||
}
|
||||
if cfg.NodeVerifyClient {
|
||||
b.WriteString(", mutual TLS enabled")
|
||||
mux, err = tcp.NewMutualTLSMux(ln, adv, cfg.NodeX509Cert, cfg.NodeX509Key, cfg.NodeX509CACert, "")
|
||||
mux, err = tcp.NewMutualTLSMux(ln, adv, cfg.NodeX509Cert, cfg.NodeX509Key, cfg.NodeX509CACert, cfg.NodeVerifyCommonName)
|
||||
} else {
|
||||
b.WriteString(", mutual TLS disabled")
|
||||
mux, err = tcp.NewTLSMux(ln, adv, cfg.NodeX509Cert, cfg.NodeX509Key)
|
||||
@@ -469,12 +472,7 @@ func createCluster(ctx context.Context, cfg *Config, hasPeers bool, client *clus
|
||||
leader, _ := str.LeaderAddr()
|
||||
return leader != ""
|
||||
}
|
||||
clusterSuf := func() command.Suffrage {
|
||||
if cfg.RaftNonVoter {
|
||||
return command.Suffrage_NON_VOTER
|
||||
}
|
||||
return command.Suffrage_VOTER
|
||||
}()
|
||||
clusterSuf := cmdpkg.SuffrageNonVoterFromBool(cfg.RaftNonVoter)
|
||||
|
||||
joiner := cluster.NewJoiner(client, cfg.JoinAttempts, cfg.JoinInterval)
|
||||
joiner.SetCredentials(cluster.CredentialsFor(credStr, cfg.JoinAs))
|
||||
|
||||
Reference in new issue
Block a user