enable redis over wireguard

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
This commit is contained in:
Evan Hazlett 2019-10-07 23:37:13 -04:00
parent 190ec3130d
commit 48d43ee2ee
8 changed files with 210 additions and 85 deletions

View file

@ -32,6 +32,7 @@ type Master struct {
ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
GRPCAddress string `protobuf:"bytes,2,opt,name=grpc_address,json=grpcAddress,proto3" json:"grpc_address,omitempty"`
RedisURL string `protobuf:"bytes,3,opt,name=redis_url,json=redisUrl,proto3" json:"redis_url,omitempty"`
GatewayIP string `protobuf:"bytes,4,opt,name=gateway_ip,json=gatewayIp,proto3" json:"gateway_ip,omitempty"`
Peers []*Peer `protobuf:"bytes,5,rep,name=peers,proto3" json:"peers,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
@ -83,6 +84,13 @@ func (m *Master) GetRedisURL() string {
return ""
}
func (m *Master) GetGatewayIP() string {
if m != nil {
return m.GatewayIP
}
return ""
}
func (m *Master) GetPeers() []*Peer {
if m != nil {
return m.Peers
@ -1031,75 +1039,75 @@ func init() {
}
var fileDescriptor_b6184fc395da86b1 = []byte{
// 1076 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0x5f, 0x6f, 0xe3, 0x44,
0x10, 0xc7, 0xf9, 0x9f, 0x49, 0xd3, 0x4a, 0xab, 0x53, 0xf1, 0x05, 0x21, 0x97, 0x9c, 0x10, 0x39,
0x74, 0xb2, 0xdb, 0x02, 0xe2, 0xcf, 0xe9, 0x10, 0x4d, 0x73, 0x1c, 0xa6, 0x50, 0x85, 0x3d, 0xee,
0x05, 0x9d, 0x14, 0xdc, 0x78, 0x2e, 0x75, 0xeb, 0xd8, 0x8b, 0xbd, 0x69, 0x15, 0x3e, 0x01, 0x8f,
0x7c, 0x1f, 0x24, 0x9e, 0x79,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cc, 0x15, 0xfd, 0xf2, 0x32, 0x2f, 0x8d, 0x7e,
0x0c, 0xe5, 0xf8, 0x21, 0x20, 0x56, 0x4e, 0xc5, 0xcf, 0x88, 0xda, 0xcc, 0x0f, 0x50, 0x3c, 0x1d,
0x43, 0x39, 0x99, 0x3f, 0x2b, 0xa7, 0x78, 0xde, 0x28, 0xd7, 0xc2, 0xac, 0xed, 0x9a, 0x3f, 0x3c,
0xc8, 0xfd, 0x1f, 0xdd, 0xc3, 0xd3, 0xad, 0xc3, 0x4a, 0xcc, 0xcb, 0x07, 0xff, 0x07, 0x00, 0x00,
0xff, 0xff, 0xdf, 0x73, 0xc4, 0x68, 0x08, 0x0e, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.

View file

@ -25,6 +25,7 @@ message Master {
string id = 1 [(gogoproto.customname) = "ID"];
string grpc_address = 2 [(gogoproto.customname) = "GRPCAddress"];
string redis_url = 3 [(gogoproto.customname) = "RedisURL"];
string gateway_ip = 4 [(gogoproto.customname) = "GatewayIP"];
repeated Peer peers = 5;
}

1
go.mod
View file

@ -6,6 +6,7 @@ require (
github.com/certifi/gocertifi v0.0.0-20190905060710-a5e0173ced67 // indirect
github.com/containerd/typeurl v0.0.0-20190911142611-5eb25027c9fd
github.com/crosbymichael/guard v0.0.0-20190716141324-5c2daadf8067 // indirect
github.com/digineo/go-ping v1.0.0
github.com/dustin/go-humanize v1.0.0
github.com/getsentry/raven-go v0.2.0 // indirect
github.com/gogo/googleapis v1.3.0

16
go.sum
View file

@ -19,9 +19,16 @@ github.com/crosbymichael/guard v0.0.0-20190716141324-5c2daadf8067/go.mod h1:+l2f
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/digineo/go-logwrap v0.0.0-20181106161722-a178c58ea3f0 h1:OT/LKmj81wMymnWXaKaKBR9n1vPlu+GC0VVKaZP6kzs=
github.com/digineo/go-logwrap v0.0.0-20181106161722-a178c58ea3f0/go.mod h1:DmqdumeAKGQNU5E8MN0ruT5ZGx8l/WbAsMbXCXcSEts=
github.com/digineo/go-ping v1.0.0 h1:gOuD3YzkIcW/0Y2IAe27bsMKtpfNZdoX1Rnc1RGYOSI=
github.com/digineo/go-ping v1.0.0/go.mod h1:YLDBnHoAygacawa2aubI4vXhZ4do5f62oJSvRiJVEjw=
github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/ehazlett/ttlcache v0.0.0-20190820213212-4400e3aef9f0/go.mod h1:D7IiYXsX2n2xixWvFTxGeZucCvvNtI14ikLj6L9Kp9E=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg=
github.com/gdamore/tcell v1.1.1/go.mod h1:K1udHkiR3cOtlpKG5tZPD5XxrF7v2y7lDq7Whcj+xkQ=
github.com/getsentry/raven-go v0.2.0 h1:no+xWJRb5ZI7eE8TWgIq1jLulQiIoLG0IfYxv5JYMGs=
github.com/getsentry/raven-go v0.2.0/go.mod h1:KungGk8q33+aIAZUIVWZDr2OfAEBsO49PX4NzFV5kcQ=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
@ -61,6 +68,10 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGi
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
github.com/lucasb-eyer/go-colorful v0.0.0-20181028223441-12d3b2882a08/go.mod h1:NXg0ArsFk0Y01623LgUqoqcouGDB+PwCCQlrwrG6xJ4=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/miekg/dns v1.1.15/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
@ -89,6 +100,7 @@ github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
github.com/prometheus/procfs v0.0.3 h1:CTwfnzjQ+8dS6MhHHu4YswVAD99sL2wjPqP+VkURmKE=
github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ=
github.com/rivo/tview v0.0.0-20181226202439-36893a669792/go.mod h1:J4W+hErFfITUbyFAEXizpmkuxX7ZN56dopxHB4XQhMw=
github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
@ -115,6 +127,7 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980 h1:dfGZHvZk057jK2MCeWus/TowKpJ8y4AmooUzdBSR9GU=
@ -125,6 +138,7 @@ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181228144115-9a3f9b0469bb/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894 h1:Cz4ceDQGXuKRnVBDTS23GTn/pU5OE2C0WrNTOYK1Uuc=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@ -144,9 +158,11 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoA
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.24.0 h1:vb/1TCsVn3DcJlQ0Gs1yB1pKI6Do2/QNwxdKqmc/b0s=
google.golang.org/grpc v1.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRnRtcA=
gopkg.in/DATA-DOG/go-sqlmock.v1 v1.3.0/go.mod h1:OdE7CF6DbADk7lN8LIKRzRJTTZXIjtWgA5THM5lhBAw=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/cheggaaa/pb.v1 v1.0.27/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

View file

@ -30,6 +30,7 @@ import (
"github.com/gomodule/redigo/redis"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
type subnetRange struct {
@ -39,6 +40,7 @@ type subnetRange struct {
}
func (s *Server) updateNodeNetwork(ctx context.Context, id string, subnet string) error {
logrus.Debugf("updating node network: id=%s subnet=%s", id, subnet)
if _, err := s.master(ctx, "SET", s.getNodeNetworkKey(id), subnet); err != nil {
return err
}

View file

@ -115,12 +115,14 @@ func (s *Server) configureNode() error {
continue
}
// TODO: start tunnel
// start tunnel
if err := s.updatePeerConfig(ctx, r.Node, r.Peers); err != nil {
return err
}
// TODO: wait for tunnel to come up
time.Sleep(time.Second * 20)
// wait for tunnel to come up
if err := s.waitForMaster(ctx, r.Master); err != nil {
return err
}
if err := s.joinMaster(r.Master); err != nil {
c.Close()
@ -128,6 +130,11 @@ func (s *Server) configureNode() error {
continue
}
logrus.Debug("waiting for redis sync")
if err := s.waitForRedisSync(ctx); err != nil {
return err
}
go s.replicaMonitor()
return nil
@ -200,10 +207,12 @@ func (s *Server) replicaMonitor() {
logrus.Error(err)
continue
}
logrus.Debugf("replica monitor: node=%s", n)
if n == nil || n.ID != s.cfg.ID {
logrus.Debugf("waiting for new master to initialize: %s", n.ID)
logrus.Debug("waiting for new master to initialize")
continue
}
logrus.Debugf("replica monitor: configuring node with master %+v", n)
if err := s.configureNode(); err != nil {
logrus.Error(err)
continue
@ -285,11 +294,13 @@ func (s *Server) joinMaster(m *v1.Master) error {
func (s *Server) updateMasterInfo(ctx context.Context) error {
// update master info
if _, err := s.master(ctx, "SET", clusterKey, s.cfg.ClusterKey); err != nil {
logrus.Error("updateMasterInfo.setClusterKey")
return err
}
// build redis url with gateway ip
gatewayIP, _, err := s.getNodeIP(ctx, s.cfg.ID)
if err != nil {
logrus.Error("updateMasterInfo.getNodeIP")
return err
}
u, err := url.Parse(s.cfg.RedisURL)
@ -302,6 +313,7 @@ func (s *Server) updateMasterInfo(ctx context.Context) error {
ID: s.cfg.ID,
GRPCAddress: s.cfg.AdvertiseGRPCAddress,
RedisURL: u.String(),
GatewayIP: gatewayIP.String(),
}
data, err := proto.Marshal(m)
if err != nil {
@ -334,11 +346,11 @@ func (s *Server) updateLocalNodeInfo(ctx context.Context) error {
key := s.getNodeKey(s.cfg.ID)
keyPair, err := s.getOrCreateKeyPair(ctx, s.cfg.ID)
if err != nil {
return err
return errors.Wrapf(err, "error getting keypair for %s", s.cfg.ID)
}
nodeIP, _, err := s.getNodeIP(ctx, s.cfg.ID)
if err != nil {
return err
return errors.Wrapf(err, "error getting node IP for %s", s.cfg.ID)
}
node := &v1.Node{
Updated: time.Now(),

View file

@ -234,15 +234,10 @@ func (s *Server) updatePeerConfig(ctx context.Context, node *v1.Node, peers []*v
nodePeers = append(nodePeers, peer)
}
keyPair, err := s.getOrCreateKeyPair(ctx, node.ID)
if err != nil {
return err
}
//size, _ := gatewayNet.Mask.Size()
wireguardCfg := &wg.Config{
Iface: node.InterfaceName,
PrivateKey: keyPair.PrivateKey,
PrivateKey: node.KeyPair.PrivateKey,
ListenPort: int(node.EndpointPort),
Address: fmt.Sprintf("%s/%d", node.GatewayIP, 16),
Peers: nodePeers,

View file

@ -22,15 +22,20 @@
package server
import (
"bufio"
"bytes"
"context"
"fmt"
"io/ioutil"
"net"
"net/url"
"path/filepath"
"runtime"
"runtime/pprof"
"strings"
"time"
ping "github.com/digineo/go-ping"
"github.com/gogo/protobuf/proto"
ptypes "github.com/gogo/protobuf/types"
"github.com/gomodule/redigo/redis"
@ -137,19 +142,27 @@ func (s *Server) Run() error {
return err
}
logrus.Debugf("response: %+v", r)
logrus.Debugf("master info received: %+v", r)
// start tunnel
if err := s.updatePeerConfig(ctx, r.Node, r.Peers); err != nil {
return errors.Wrap(err, "error updating peer config")
}
// TODO: wait for tunnel to come up
time.Sleep(time.Second * 20)
logrus.Debugf("master info received: %+v", r)
// wait for tunnel to come up
if err := s.waitForMaster(ctx, r.Master); err != nil {
return errors.Wrap(err, "error waiting for master")
}
logrus.Debugf("joining master: %s", r.Master.ID)
if err := s.joinMaster(r.Master); err != nil {
return err
}
logrus.Debug("waiting for redis sync")
if err := s.waitForRedisSync(ctx); err != nil {
return err
}
go s.replicaMonitor()
} else {
if err := s.configureNode(); err != nil {
@ -251,6 +264,80 @@ func getPool(redisUrl string) (*redis.Pool, error) {
return pool, nil
}
func (s *Server) waitForMaster(ctx context.Context, m *v1.Master) error {
p, err := ping.New("0.0.0.0", "")
if err != nil {
return err
}
defer p.Close()
doneCh := make(chan time.Duration)
errCh := make(chan error)
go func() {
for {
ip, err := net.ResolveIPAddr("ip4", m.GatewayIP)
if err != nil {
errCh <- err
return
}
rtt, err := p.Ping(ip, time.Second*30)
if err != nil {
errCh <- err
}
doneCh <- rtt
}
}()
select {
case rtt := <-doneCh:
logrus.Debugf("rtt master ping: %s", rtt)
return nil
case err := <-errCh:
return err
}
return nil
}
func (s *Server) waitForRedisSync(ctx context.Context) error {
doneCh := make(chan bool)
errCh := make(chan error)
go func() {
for {
info, err := redis.String(s.local(ctx, "INFO", "REPLICATION"))
if err != nil {
logrus.Warn(err)
continue
}
b := bytes.NewBufferString(info)
s := bufio.NewScanner(b)
for s.Scan() {
v := s.Text()
parts := strings.SplitN(v, ":", 2)
if parts[0] == "master_link_status" {
if parts[1] == "up" {
doneCh <- true
return
}
}
}
time.Sleep(time.Second * 1)
}
}()
select {
case <-doneCh:
return nil
case err := <-errCh:
return err
case <-time.After(nodeHeartbeatInterval):
return fmt.Errorf("timeout waiting on sync")
}
}
func (s *Server) ensureNetworkSubnet(ctx context.Context, id string) error {
network, err := redis.String(s.local(ctx, "GET", s.getNodeNetworkKey(id)))
if err != nil {
@ -267,6 +354,7 @@ func (s *Server) ensureNetworkSubnet(ctx context.Context, id string) error {
if err != nil {
return err
}
logrus.Debugf("node networks: %s", nodeNetworkKeys)
lookup := map[string]struct{}{}
for _, netKey := range nodeNetworkKeys {
n, err := redis.String(s.local(ctx, "GET", netKey))
@ -276,6 +364,8 @@ func (s *Server) ensureNetworkSubnet(ctx context.Context, id string) error {
lookup[n] = struct{}{}
}
logrus.Debugf("lookup: %+v", lookup)
subnet := r.Subnet
size, _ := subnet.Mask.Size()