diff --git a/chart/templates/server/business.yaml b/chart/templates/server/business.yaml index 7ae499b..e697f27 100644 --- a/chart/templates/server/business.yaml +++ b/chart/templates/server/business.yaml @@ -18,7 +18,7 @@ spec: spec: containers: - name: business - image: 'registry.cn-shenzhen.aliyuncs.com/fnuoos-prd/zyos-gim-business:202209020-02' + image: 'registry.cn-shenzhen.aliyuncs.com/fnuoos-prd/zyos-gim-business:202209020-03' imagePullPolicy: Always ports: - containerPort: 8000 diff --git a/cmd/business/main.go b/cmd/business/main.go index cb05719..8852cae 100644 --- a/cmd/business/main.go +++ b/cmd/business/main.go @@ -3,6 +3,7 @@ package main import ( "gim/config" "gim/internal/business/api" + "gim/pkg/db" "gim/pkg/interceptor" "gim/pkg/logger" "gim/pkg/pb" @@ -17,6 +18,9 @@ import ( ) func main() { + config.Init() + db.Init() + server := grpc.NewServer(grpc.UnaryInterceptor(interceptor.NewInterceptor("business_interceptor", urlwhitelist.Business))) // 监听服务关闭信号,服务平滑重启 go func() { diff --git a/cmd/connect/main.go b/cmd/connect/main.go index 7f7110a..7e32ab5 100644 --- a/cmd/connect/main.go +++ b/cmd/connect/main.go @@ -4,21 +4,24 @@ import ( "context" "gim/config" "gim/internal/connect" + "gim/pkg/db" "gim/pkg/interceptor" "gim/pkg/logger" "gim/pkg/pb" "gim/pkg/rpc" + "google.golang.org/grpc" "net" "os" "os/signal" "syscall" - "google.golang.org/grpc" - "go.uber.org/zap" ) func main() { + config.Init() + db.Init() + // 启动TCP长链接服务器 go func() { connect.StartTCPServer(config.TCPListenAddr) diff --git a/cmd/logic/main.go b/cmd/logic/main.go index 699d230..c74867c 100644 --- a/cmd/logic/main.go +++ b/cmd/logic/main.go @@ -5,6 +5,7 @@ import ( "gim/internal/logic/api" "gim/internal/logic/app" "gim/internal/logic/proxy" + "gim/pkg/db" "gim/pkg/interceptor" "gim/pkg/logger" "gim/pkg/pb" @@ -24,6 +25,9 @@ func init() { } func main() { + config.Init() + db.Init() + server := grpc.NewServer(grpc.UnaryInterceptor(interceptor.NewInterceptor("logic_interceptor", urlwhitelist.Logic))) // 监听服务关闭信号,服务平滑重启 diff --git a/config/config.go b/config/config.go index 4b18c7e..e0b0328 100644 --- a/config/config.go +++ b/config/config.go @@ -4,12 +4,10 @@ import ( "context" "gim/pkg/k8sutil" "gim/pkg/logger" - "os" - "strconv" - "go.uber.org/zap" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "os" + "strconv" ) const ( @@ -23,16 +21,16 @@ const ( var ( NameSpace string = "gim" - MySQL string - RedisIP string - RedisPassword string + MySQL string = "root:Fnuo123com@@tcp(119.23.182.117:3306)/gim?charset=utf8&parseTime=true" + RedisIP string = "120.24.28.6:32572" + RedisPassword string = "" LocalAddr string PushRoomSubscribeNum int PushAllSubscribeNum int ) -func init() { +func Init() { k8sClient, err := k8sutil.GetK8sClient() if err != nil { panic(err) diff --git a/internal/business/api/business_ext_test.go b/internal/business/api/business_ext_test.go index 017774b..9c3eca6 100644 --- a/internal/business/api/business_ext_test.go +++ b/internal/business/api/business_ext_test.go @@ -32,7 +32,7 @@ func getCtx() context.Context { func TestUserExtServer_SignIn(t *testing.T) { resp, err := getBusinessExtClient().SignIn(getCtx(), &pb.SignInReq{ - PhoneNumber: "11111111111", + PhoneNumber: "18229775316", Code: "1", DeviceId: 1, }) diff --git a/pkg/db/db.go b/pkg/db/db.go index de720e7..5b776e8 100644 --- a/pkg/db/db.go +++ b/pkg/db/db.go @@ -18,7 +18,7 @@ var ( RedisUtil *util.RedisUtil ) -func init() { +func Init() { InitMysql(config.MySQL) InitRedis(config.RedisIP, config.RedisPassword) }