Allow to provide complete cluster configuration

Replace CORE_CLUSTER_JOIN_ADDRESS with CORE_CLUSTER_PEERS. This is
a comma separated list of cluster members with their IDs of the form
ID@host:port

On startup the node tries to connect to all the peers. In case of
sudden deaths of a node this will allow to find back into the
cluster. The list in CLUSTER_PEERS is a starting point of known
peers. Other node that are not in that list can still join the
cluster.

File and stream proxy has been moved to the Proxy type.
This commit is contained in:
Ingo Oppermann
2023-05-03 16:13:05 +02:00
parent c0a5325f05
commit d201921a33
14 changed files with 836 additions and 365 deletions

View File

@@ -42,8 +42,6 @@ type JoinRequest struct {
ID string `json:"id"`
RaftAddress string `json:"raft_address"`
APIAddress string `json:"api_address"`
APIUsername string `json:"api_username"`
APIPassword string `json:"api_password"`
}
type LeaveRequest struct {
@@ -73,8 +71,8 @@ func NewAPI(config APIConfig) (API, error) {
a.router.Debug = true
a.router.HTTPErrorHandler = errorhandler.HTTPErrorHandler
a.router.Validator = validator.New()
a.router.HideBanner = false
a.router.HidePort = false
a.router.HideBanner = true
a.router.HidePort = true
mwlog.NewWithConfig(mwlog.Config{
Logger: a.logger,
@@ -105,7 +103,7 @@ func NewAPI(config APIConfig) (API, error) {
return httpapi.Err(http.StatusLoopDetected, "", "breaking circuit")
}
err := a.cluster.Join(r.Origin, r.ID, r.RaftAddress, r.APIAddress, r.APIUsername, r.APIPassword)
err := a.cluster.Join(r.Origin, r.ID, r.RaftAddress, r.APIAddress, "")
if err != nil {
a.logger.Debug().WithError(err).Log("unable to join cluster")
return httpapi.Err(http.StatusInternalServerError, "unable to join cluster", "%s", err)