From c3f0446b00a7fd0fab2ebb03a1325d21ca0e0720 Mon Sep 17 00:00:00 2001 From: hanzhixiao <709674996@qq.com> Date: Fri, 18 Aug 2023 19:50:23 +0800 Subject: [PATCH] docker_script Signed-off-by: hanzhixiao <709674996@qq.com> --- tools/component/main.go | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/tools/component/main.go b/tools/component/main.go index f2b27216ae..c683ac3838 100644 --- a/tools/component/main.go +++ b/tools/component/main.go @@ -49,7 +49,6 @@ func initCfg() error { if err = yaml.Unmarshal(data, &config.Config); err != nil { return err } - fmt.Println(config.Config.Mysql.Address) return nil } @@ -143,12 +142,12 @@ func checkMysql() error { config.Config.Mysql.Username, config.Config.Mysql.Password, config.Config.Mysql.Address[0], "mysql") db, err := gorm.Open(mysql.Open(dsn), nil) if err != nil { - return err + return errs.Wrap(err) } else { sqlDB, err = db.DB() err = sqlDB.Ping() if err != nil { - return err + return errs.Wrap(err) } } return nil @@ -173,11 +172,11 @@ func checkMongo() error { fmt.Sprintf("mongodb://%v:%v@%v/?authSource=admin", config.Config.Mongo.Username, config.Config.Mongo.Password, mongodbHosts))) if err != nil { - return err + return errs.Wrap(err) } else { err = client.Ping(context.TODO(), &readpref.ReadPref{}) if err != nil { - return err + return errs.Wrap(err) } } return nil @@ -192,7 +191,7 @@ func checkMinio() error { Secure: u.Scheme == "https", }) if err != nil { - return err + return errs.Wrap(err) } cancel, err := minioClient.HealthCheck(time.Duration(minioHealthCheckDuration) * time.Second) @@ -202,7 +201,7 @@ func checkMinio() error { } }() if err != nil { - return err + return errs.Wrap(err) } else { if minioClient.IsOffline() { return ErrComponentStart.Wrap("Minio server is offline") @@ -237,7 +236,7 @@ func checkRedis() error { } _, err := redisClient.Ping(context.Background()).Result() if err != nil { - return err + return errs.Wrap(err) } return nil } @@ -251,16 +250,16 @@ func checkZookeeper() error { }() c, _, err := zk.Connect(config.Config.Zookeeper.ZkAddr, time.Second) if err != nil { - return err + return errs.Wrap(err) } else { if config.Config.Zookeeper.Username != "" && config.Config.Zookeeper.Password != "" { if err := c.AddAuth("digest", []byte(config.Config.Zookeeper.Username+":"+config.Config.Zookeeper.Password)); err != nil { - return err + return errs.Wrap(err) } } _, _, err = c.Get("/") if err != nil { - return err + return errs.Wrap(err) } } return nil @@ -281,7 +280,7 @@ func checkKafka() error { } kafkaClient, err := sarama.NewClient(config.Config.Kafka.Addr, cfg) if err != nil { - return err + return errs.Wrap(err) } else { topics, err := kafkaClient.Topics() if err != nil {