Start redis (#470)

* Start miniredis, repairer, and checker with captplanet
This commit is contained in:
Alexander Leitner 2018-10-12 14:04:16 -04:00 committed by GitHub
parent 0e7f6358fb
commit 3e1b16ea99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 6 deletions

View File

@ -10,6 +10,7 @@ import (
"github.com/spf13/cobra"
"github.com/alicebob/miniredis"
"storj.io/storj/pkg/auth/grpcauth"
"storj.io/storj/pkg/cfgstruct"
"storj.io/storj/pkg/datarepair/checker"
@ -114,11 +115,29 @@ func cmdRun(cmd *cobra.Command, args []string) (err error) {
grpcauth.NewAPIKeyInterceptor(),
runCfg.Satellite.PointerDB,
runCfg.Satellite.Kademlia,
// runCfg.Satellite.Checker,
// runCfg.Satellite.Repairer,
o)
o,
)
}()
// start Repair
m := miniredis.NewMiniRedis()
m.RequireAuth("abc123")
if err = m.StartAddr(":6378"); err != nil {
errch <- err
} else {
defer m.Close()
go func() {
errch <- runCfg.Satellite.Checker.Run(ctx, nil)
}()
go func() {
errch <- runCfg.Satellite.Repairer.Run(ctx, nil)
}()
}
// start s3 uplink
go func() {
_, _ = fmt.Printf("Starting s3-gateway on %s\nAccess key: %s\nSecret key: %s\n",

View File

@ -112,8 +112,9 @@ func cmdSetup(cmd *cobra.Command, args []string) (err error) {
startingPort := setupCfg.StartingPort
overrides := map[string]interface{}{
"satellite.identity.cert-path": setupCfg.HCIdentity.CertPath,
"satellite.identity.key-path": setupCfg.HCIdentity.KeyPath,
"satellite.repairer.queue-address": "redis://127.0.0.1:6378?db=1&password=abc123",
"satellite.identity.cert-path": setupCfg.HCIdentity.CertPath,
"satellite.identity.key-path": setupCfg.HCIdentity.KeyPath,
"satellite.identity.address": joinHostPort(
setupCfg.ListenHost, startingPort+1),
"satellite.kademlia.todo-listen-addr": joinHostPort(

View File

@ -14,7 +14,7 @@ import (
// Config contains configurable values for repairer
type Config struct {
QueueAddress string `help:"data repair queue address" default:"redis://localhost:6379?db=5&password=123"`
QueueAddress string `help:"data repair queue address" default:"redis://localhost:6379?db=0&password=testpass"`
MaxRepair int `help:"maximum segments that can be repaired concurrently" default:"100"`
Interval time.Duration `help:"how frequently checker should audit segments" default:"3600s"`
}

View File

@ -9,6 +9,8 @@ import (
"sync"
"time"
"go.uber.org/zap"
q "storj.io/storj/pkg/datarepair/queue"
"storj.io/storj/pkg/pb"
"storj.io/storj/pkg/utils"
@ -36,6 +38,8 @@ type repairer struct {
// Run the repairer loop
func (r *repairer) Run() (err error) {
zap.S().Info("Repairer is starting up")
c := make(chan *pb.InjuredSegment)
ticker := time.NewTicker(r.interval)