Browse Source

update

master
DengBiao 2 years ago
parent
commit
177acf4a6b
7 changed files with 22 additions and 13 deletions
  1. +1
    -1
      chart/templates/server/business.yaml
  2. +4
    -0
      cmd/business/main.go
  3. +5
    -2
      cmd/connect/main.go
  4. +4
    -0
      cmd/logic/main.go
  5. +6
    -8
      config/config.go
  6. +1
    -1
      internal/business/api/business_ext_test.go
  7. +1
    -1
      pkg/db/db.go

+ 1
- 1
chart/templates/server/business.yaml View File

@@ -18,7 +18,7 @@ spec:
spec: spec:
containers: containers:
- name: business - 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 imagePullPolicy: Always
ports: ports:
- containerPort: 8000 - containerPort: 8000


+ 4
- 0
cmd/business/main.go View File

@@ -3,6 +3,7 @@ package main
import ( import (
"gim/config" "gim/config"
"gim/internal/business/api" "gim/internal/business/api"
"gim/pkg/db"
"gim/pkg/interceptor" "gim/pkg/interceptor"
"gim/pkg/logger" "gim/pkg/logger"
"gim/pkg/pb" "gim/pkg/pb"
@@ -17,6 +18,9 @@ import (
) )


func main() { func main() {
config.Init()
db.Init()

server := grpc.NewServer(grpc.UnaryInterceptor(interceptor.NewInterceptor("business_interceptor", urlwhitelist.Business))) server := grpc.NewServer(grpc.UnaryInterceptor(interceptor.NewInterceptor("business_interceptor", urlwhitelist.Business)))
// 监听服务关闭信号,服务平滑重启 // 监听服务关闭信号,服务平滑重启
go func() { go func() {


+ 5
- 2
cmd/connect/main.go View File

@@ -4,21 +4,24 @@ import (
"context" "context"
"gim/config" "gim/config"
"gim/internal/connect" "gim/internal/connect"
"gim/pkg/db"
"gim/pkg/interceptor" "gim/pkg/interceptor"
"gim/pkg/logger" "gim/pkg/logger"
"gim/pkg/pb" "gim/pkg/pb"
"gim/pkg/rpc" "gim/pkg/rpc"
"google.golang.org/grpc"
"net" "net"
"os" "os"
"os/signal" "os/signal"
"syscall" "syscall"


"google.golang.org/grpc"

"go.uber.org/zap" "go.uber.org/zap"
) )


func main() { func main() {
config.Init()
db.Init()

// 启动TCP长链接服务器 // 启动TCP长链接服务器
go func() { go func() {
connect.StartTCPServer(config.TCPListenAddr) connect.StartTCPServer(config.TCPListenAddr)


+ 4
- 0
cmd/logic/main.go View File

@@ -5,6 +5,7 @@ import (
"gim/internal/logic/api" "gim/internal/logic/api"
"gim/internal/logic/app" "gim/internal/logic/app"
"gim/internal/logic/proxy" "gim/internal/logic/proxy"
"gim/pkg/db"
"gim/pkg/interceptor" "gim/pkg/interceptor"
"gim/pkg/logger" "gim/pkg/logger"
"gim/pkg/pb" "gim/pkg/pb"
@@ -24,6 +25,9 @@ func init() {
} }


func main() { func main() {
config.Init()
db.Init()

server := grpc.NewServer(grpc.UnaryInterceptor(interceptor.NewInterceptor("logic_interceptor", urlwhitelist.Logic))) server := grpc.NewServer(grpc.UnaryInterceptor(interceptor.NewInterceptor("logic_interceptor", urlwhitelist.Logic)))


// 监听服务关闭信号,服务平滑重启 // 监听服务关闭信号,服务平滑重启


+ 6
- 8
config/config.go View File

@@ -4,12 +4,10 @@ import (
"context" "context"
"gim/pkg/k8sutil" "gim/pkg/k8sutil"
"gim/pkg/logger" "gim/pkg/logger"
"os"
"strconv"

"go.uber.org/zap" "go.uber.org/zap"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"os"
"strconv"
) )


const ( const (
@@ -23,16 +21,16 @@ const (


var ( var (
NameSpace string = "gim" 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 LocalAddr string
PushRoomSubscribeNum int PushRoomSubscribeNum int
PushAllSubscribeNum int PushAllSubscribeNum int
) )


func init() {
func Init() {
k8sClient, err := k8sutil.GetK8sClient() k8sClient, err := k8sutil.GetK8sClient()
if err != nil { if err != nil {
panic(err) panic(err)


+ 1
- 1
internal/business/api/business_ext_test.go View File

@@ -32,7 +32,7 @@ func getCtx() context.Context {


func TestUserExtServer_SignIn(t *testing.T) { func TestUserExtServer_SignIn(t *testing.T) {
resp, err := getBusinessExtClient().SignIn(getCtx(), &pb.SignInReq{ resp, err := getBusinessExtClient().SignIn(getCtx(), &pb.SignInReq{
PhoneNumber: "11111111111",
PhoneNumber: "18229775316",
Code: "1", Code: "1",
DeviceId: 1, DeviceId: 1,
}) })


+ 1
- 1
pkg/db/db.go View File

@@ -18,7 +18,7 @@ var (
RedisUtil *util.RedisUtil RedisUtil *util.RedisUtil
) )


func init() {
func Init() {
InitMysql(config.MySQL) InitMysql(config.MySQL)
InitRedis(config.RedisIP, config.RedisPassword) InitRedis(config.RedisIP, config.RedisPassword)
} }


Loading…
Cancel
Save