remove advertise redis url
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
This commit is contained in:
parent
48d43ee2ee
commit
d6e6b7e373
6 changed files with 5 additions and 16 deletions
|
@ -72,12 +72,6 @@ func main() {
|
||||||
Value: "redis://127.0.0.1:6379/0",
|
Value: "redis://127.0.0.1:6379/0",
|
||||||
EnvVar: "HEIMDALL_REDIS_URL",
|
EnvVar: "HEIMDALL_REDIS_URL",
|
||||||
},
|
},
|
||||||
cli.StringFlag{
|
|
||||||
Name: "advertise-redis-url, p",
|
|
||||||
Usage: "advertise uri for peers",
|
|
||||||
Value: fmt.Sprintf("redis://%s:6379/0", heimdall.GetIP()),
|
|
||||||
EnvVar: "HEIMDALL_ADVERTISE_REDIS_URL",
|
|
||||||
},
|
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "peer",
|
Name: "peer",
|
||||||
Usage: "grpc address to join a peer",
|
Usage: "grpc address to join a peer",
|
||||||
|
|
|
@ -52,7 +52,6 @@ func runServer(cx *cli.Context) error {
|
||||||
EndpointPort: cx.Int("endpoint-port"),
|
EndpointPort: cx.Int("endpoint-port"),
|
||||||
InterfaceName: cx.String("interface-name"),
|
InterfaceName: cx.String("interface-name"),
|
||||||
RedisURL: cx.String("redis-url"),
|
RedisURL: cx.String("redis-url"),
|
||||||
AdvertiseRedisURL: cx.String("advertise-redis-url"),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
errCh := make(chan error, 1)
|
errCh := make(chan error, 1)
|
||||||
|
|
|
@ -47,8 +47,6 @@ type Config struct {
|
||||||
InterfaceName string
|
InterfaceName string
|
||||||
// RedisURL is the uri to the redis backend
|
// RedisURL is the uri to the redis backend
|
||||||
RedisURL string
|
RedisURL string
|
||||||
// AdvertiseRedisURL is the uri to the public redis backend
|
|
||||||
AdvertiseRedisURL string
|
|
||||||
// TLSCertificate is the certificate used for grpc communication
|
// TLSCertificate is the certificate used for grpc communication
|
||||||
TLSServerCertificate string
|
TLSServerCertificate string
|
||||||
// TLSKey is the key used for grpc communication
|
// TLSKey is the key used for grpc communication
|
||||||
|
|
|
@ -120,6 +120,7 @@ func (s *Server) configureNode() error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// wait for tunnel to come up
|
// wait for tunnel to come up
|
||||||
|
logrus.Infof("waiting for master %s", r.Master.ID)
|
||||||
if err := s.waitForMaster(ctx, r.Master); err != nil {
|
if err := s.waitForMaster(ctx, r.Master); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -130,7 +131,7 @@ func (s *Server) configureNode() error {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
logrus.Debug("waiting for redis sync")
|
logrus.Infof("waiting for redis sync with %s", r.Master.ID)
|
||||||
if err := s.waitForRedisSync(ctx); err != nil {
|
if err := s.waitForRedisSync(ctx); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -272,7 +273,7 @@ func (s *Server) joinMaster(m *v1.Master) error {
|
||||||
conn := pool.Get()
|
conn := pool.Get()
|
||||||
defer conn.Close()
|
defer conn.Close()
|
||||||
|
|
||||||
logrus.Debugf("configuring redis as slave of %s", m.RedisURL)
|
logrus.Debugf("configuring redis as slave of %s", m.ID)
|
||||||
u, err := url.Parse(m.RedisURL)
|
u, err := url.Parse(m.RedisURL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "error parsing master redis url")
|
return errors.Wrap(err, "error parsing master redis url")
|
||||||
|
|
|
@ -71,7 +71,6 @@ func (s *Server) peerUpdater(ctx context.Context) {
|
||||||
logrus.Debugf("starting peer config updater: ttl=%s", peerConfigUpdateInterval)
|
logrus.Debugf("starting peer config updater: ttl=%s", peerConfigUpdateInterval)
|
||||||
t := time.NewTicker(peerConfigUpdateInterval)
|
t := time.NewTicker(peerConfigUpdateInterval)
|
||||||
for range t.C {
|
for range t.C {
|
||||||
logrus.Debug("peer config update")
|
|
||||||
uctx, cancel := context.WithTimeout(ctx, peerConfigUpdateInterval)
|
uctx, cancel := context.WithTimeout(ctx, peerConfigUpdateInterval)
|
||||||
if err := s.updatePeerInfo(uctx, s.cfg.ID); err != nil {
|
if err := s.updatePeerInfo(uctx, s.cfg.ID); err != nil {
|
||||||
logrus.Errorf("updateLocalPeerInfo: %s", err)
|
logrus.Errorf("updateLocalPeerInfo: %s", err)
|
||||||
|
@ -86,8 +85,6 @@ func (s *Server) peerUpdater(ctx context.Context) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
logrus.Debugf("peer update: peers %+v", peers)
|
|
||||||
|
|
||||||
node, err := s.getNode(ctx, s.cfg.ID)
|
node, err := s.getNode(ctx, s.cfg.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Error(err)
|
logrus.Error(err)
|
||||||
|
|
|
@ -149,6 +149,7 @@ func (s *Server) Run() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// wait for tunnel to come up
|
// wait for tunnel to come up
|
||||||
|
logrus.Infof("waiting for master %s", r.Master.ID)
|
||||||
if err := s.waitForMaster(ctx, r.Master); err != nil {
|
if err := s.waitForMaster(ctx, r.Master); err != nil {
|
||||||
return errors.Wrap(err, "error waiting for master")
|
return errors.Wrap(err, "error waiting for master")
|
||||||
}
|
}
|
||||||
|
@ -158,7 +159,7 @@ func (s *Server) Run() error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
logrus.Debug("waiting for redis sync")
|
logrus.Infof("waiting for redis sync with %s", r.Master.ID)
|
||||||
if err := s.waitForRedisSync(ctx); err != nil {
|
if err := s.waitForRedisSync(ctx); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -253,7 +254,6 @@ func getPool(redisUrl string) (*redis.Pool, error) {
|
||||||
|
|
||||||
auth, ok := u.User.Password()
|
auth, ok := u.User.Password()
|
||||||
if ok {
|
if ok {
|
||||||
logrus.Debug("setting masterauth for redis")
|
|
||||||
if _, err := conn.Do("CONFIG", "SET", "MASTERAUTH", auth); err != nil {
|
if _, err := conn.Do("CONFIG", "SET", "MASTERAUTH", auth); err != nil {
|
||||||
return nil, errors.Wrap(err, "error authenticating to redis")
|
return nil, errors.Wrap(err, "error authenticating to redis")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue