Merge remote-tracking branch 'upstream/main'

pull/2062/head
skiffer-git 2 years ago
commit 9ee5f5a4c3

@ -16,12 +16,6 @@ cloud.google.com/go/storage v1.36.0/go.mod h1:M6M/3V/D3KpzMTJyPOR/HU6n2Si5QdaXYE
firebase.google.com/go v3.13.0+incompatible h1:3TdYC3DDi6aHn20qoRkxwGqNgdjtblwVAyRLQwGn/+4= firebase.google.com/go v3.13.0+incompatible h1:3TdYC3DDi6aHn20qoRkxwGqNgdjtblwVAyRLQwGn/+4=
firebase.google.com/go v3.13.0+incompatible/go.mod h1:xlah6XbEyW6tbfSklcfe5FHJIwjt8toICdV5Wh9ptHs= firebase.google.com/go v3.13.0+incompatible/go.mod h1:xlah6XbEyW6tbfSklcfe5FHJIwjt8toICdV5Wh9ptHs=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/IBM/sarama v1.41.3 h1:MWBEJ12vHC8coMjdEXFq/6ftO6DUZnQlFYcxtOJFa7c=
github.com/IBM/sarama v1.41.3/go.mod h1:Xxho9HkHd4K/MDUo/T/sOqwtX/17D33++E9Wib6hUdQ=
github.com/OpenIMSDK/protocol v0.0.53 h1:PtePLTqMYRHjWSf8XIL3x5JRC3YoySTMA6tRKfbUjQY=
github.com/OpenIMSDK/protocol v0.0.53/go.mod h1:F25dFrwrIx3lkNoiuf6FkCfxuwf8L4Z8UIsdTHP/r0Y=
github.com/OpenIMSDK/tools v0.0.29 h1:NS4PEwYl9sX3SWsMjDOLVxMo3LcTWREMr+2cjzWjcqc=
github.com/OpenIMSDK/tools v0.0.29/go.mod h1:eg+q4A34Qmu73xkY0mt37FHGMCMfC6CtmOnm0kFEGFI=
github.com/IBM/sarama v1.42.2 h1:VoY4hVIZ+WQJ8G9KNY/SQlWguBQXQ9uvFPOnrcu8hEw= github.com/IBM/sarama v1.42.2 h1:VoY4hVIZ+WQJ8G9KNY/SQlWguBQXQ9uvFPOnrcu8hEw=
github.com/IBM/sarama v1.42.2/go.mod h1:FLPGUGwYqEs62hq2bVG6Io2+5n+pS6s/WOXVKWSLFtE= github.com/IBM/sarama v1.42.2/go.mod h1:FLPGUGwYqEs62hq2bVG6Io2+5n+pS6s/WOXVKWSLFtE=
github.com/OpenIMSDK/protocol v0.0.55 h1:eBjg8DyuhxGmuCUjpoZjg6MJJJXU/xJ3xJwFhrn34yA= github.com/OpenIMSDK/protocol v0.0.55 h1:eBjg8DyuhxGmuCUjpoZjg6MJJJXU/xJ3xJwFhrn34yA=

@ -101,7 +101,13 @@ function openim::tools::start_service() {
cmd="${cmd} --prometheus_port ${prometheus_port}" cmd="${cmd} --prometheus_port ${prometheus_port}"
fi fi
openim::log::status "Starting binary ${binary_name}..." openim::log::status "Starting binary ${binary_name}..."
${cmd} ${cmd}
local status=$? local status=$?
if [ $status -eq 0 ]; then if [ $status -eq 0 ]; then

@ -1795,10 +1795,6 @@ openim::util::stop_services_on_ports() {
return 0 return 0
fi fi
} }
# nc -l -p 12345
# nc -l -p 123456
# ps -ef | grep "nc -l"
# openim::util::stop_services_on_ports 1234 12345
# The `openim::util::stop_services_with_name` function stops services with specified names. # The `openim::util::stop_services_with_name` function stops services with specified names.

@ -31,7 +31,6 @@ import (
"github.com/OpenIMSDK/tools/errs" "github.com/OpenIMSDK/tools/errs"
"github.com/openimsdk/open-im-server/v3/pkg/common/config" "github.com/openimsdk/open-im-server/v3/pkg/common/config"
"gopkg.in/yaml.v3" "gopkg.in/yaml.v3"
) )
@ -77,7 +76,7 @@ func main() {
err = configGetEnv(conf) err = configGetEnv(conf)
if err != nil { if err != nil {
fmt.Printf("configGetEnv failed,err:%v", err) fmt.Printf("configGetEnv failed, err:%v", err)
return return
} }
@ -94,7 +93,7 @@ func main() {
if i != 0 { if i != 0 {
time.Sleep(1 * time.Second) time.Sleep(1 * time.Second)
} }
fmt.Printf("Checking components Round %v...\n", i+1) fmt.Printf("Checking components round %v...\n", i+1)
var err error var err error
allSuccess := true allSuccess := true
@ -102,24 +101,17 @@ func main() {
if !check.flag { if !check.flag {
err = check.function(check.config) err = check.function(check.config)
if err != nil { if err != nil {
allSuccess = false
component.ErrorPrint(fmt.Sprintf("Check component: %s, failed: %s", check.name, err.Error()))
if check.name == "Minio" { if check.name == "Minio" {
if errors.Is(err, errMinioNotEnabled) { if errors.Is(err, errMinioNotEnabled) ||
fmt.Println(err.Error(), " check ", check.name) errors.Is(err, errSignEndPoint) ||
checks[index].flag = true errors.Is(err, errApiURL) {
}
if errors.Is(err, errSignEndPoint) {
fmt.Fprintf(os.Stderr, err.Error(), " check ", check.name) fmt.Fprintf(os.Stderr, err.Error(), " check ", check.name)
checks[index].flag = true checks[index].flag = true
continue
} }
} break
component.ErrorPrint(fmt.Sprintf("Starting %s failed:%v.", check.name, errs.Unwrap(err).Error()))
if strings.Contains(errs.Unwrap(err).Error(), "connection refused") ||
strings.Contains(errs.Unwrap(err).Error(), "timeout") ||
strings.Contains(errs.Unwrap(err).Error(), "context deadline exceeded") {
component.ErrorPrint(fmt.Sprintf("try check connection %s", check.name))
allSuccess = false
break
} }
} else { } else {
checks[index].flag = true checks[index].flag = true
@ -127,13 +119,12 @@ func main() {
} }
} }
} }
if allSuccess { if allSuccess {
component.SuccessPrint("All components started successfully!") component.SuccessPrint("All components started successfully!")
return return
} }
} }
component.ErrorPrint("Some components started failed!") component.ErrorPrint("Some components checked failed!")
os.Exit(-1) os.Exit(-1)
} }
@ -171,13 +162,13 @@ func checkRedis(config *config.GlobalConfig) error {
// checkMinio checks the MinIO connection // checkMinio checks the MinIO connection
func checkMinio(config *config.GlobalConfig) error { func checkMinio(config *config.GlobalConfig) error {
if strings.Contains(config.Object.ApiURL, "127.0.0.1") { if strings.Contains(config.Object.ApiURL, "127.0.0.1") {
return errs.Wrap(errApiURL, "config.Object.ApiURL: "+config.Object.ApiURL) return errs.Wrap(errApiURL)
} }
if config.Object.Enable != "minio" { if config.Object.Enable != "minio" {
return errs.Wrap(errMinioNotEnabled, "config.Object.Enable: "+config.Object.Enable) return errs.Wrap(errMinioNotEnabled)
} }
if strings.Contains(config.Object.Minio.Endpoint, "127.0.0.1") { if strings.Contains(config.Object.Minio.Endpoint, "127.0.0.1") {
return errs.Wrap(errSignEndPoint, "config.Object.Minio.Endpoint: "+config.Object.Minio.Endpoint) return errs.Wrap(errSignEndPoint)
} }
minio := &component.Minio{ minio := &component.Minio{

Loading…
Cancel
Save