mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
Merge branch 'main' into v0926_project_layout
# Conflicts: # cmd/open_im_api/main.go # internal/rpc/auth/rpcAuth.go # internal/rpc/chat/rpcChat.go # src/common/log/logrus.go
This commit is contained in:
commit
a2e204667f
@ -8,6 +8,7 @@ import (
|
|||||||
"Open_IM/internal/api/manage"
|
"Open_IM/internal/api/manage"
|
||||||
apiThird "Open_IM/internal/api/third"
|
apiThird "Open_IM/internal/api/third"
|
||||||
"Open_IM/internal/api/user"
|
"Open_IM/internal/api/user"
|
||||||
|
"Open_IM/pkg/common/log"
|
||||||
"Open_IM/pkg/utils"
|
"Open_IM/pkg/utils"
|
||||||
"flag"
|
"flag"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
@ -93,7 +94,7 @@ func main() {
|
|||||||
managementGroup.POST("/send_msg", manage.ManagementSendMsg)
|
managementGroup.POST("/send_msg", manage.ManagementSendMsg)
|
||||||
managementGroup.POST("/get_all_users_uid", manage.GetAllUsersUid)
|
managementGroup.POST("/get_all_users_uid", manage.GetAllUsersUid)
|
||||||
}
|
}
|
||||||
|
log.NewPrivateLog("api")
|
||||||
ginPort := flag.Int("port", 10000, "get ginServerPort from cmd,default 10000 as port")
|
ginPort := flag.Int("port", 10000, "get ginServerPort from cmd,default 10000 as port")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
r.Run(utils.ServerIP + ":" + strconv.Itoa(*ginPort))
|
r.Run(utils.ServerIP + ":" + strconv.Itoa(*ginPort))
|
||||||
|
@ -60,7 +60,7 @@ serverip:
|
|||||||
api:
|
api:
|
||||||
openImApiPort: [ 10000 ]
|
openImApiPort: [ 10000 ]
|
||||||
sdk:
|
sdk:
|
||||||
sdkWsPort: [ 30000 ]
|
openImSdkWsPort: [ 30000 ]
|
||||||
|
|
||||||
credential:
|
credential:
|
||||||
tencent:
|
tencent:
|
||||||
@ -88,12 +88,13 @@ rpcregistername:
|
|||||||
openImPushName: Push
|
openImPushName: Push
|
||||||
openImOnlineMessageRelayName: OnlineMessageRelay
|
openImOnlineMessageRelayName: OnlineMessageRelay
|
||||||
openImGroupName: Group
|
openImGroupName: Group
|
||||||
rpcGetTokenName: Auth
|
openImAuthName: Auth
|
||||||
|
|
||||||
log:
|
log:
|
||||||
storageLocation: ../logs/
|
storageLocation: ../logs/
|
||||||
rotationTime: 12
|
rotationTime: 24
|
||||||
remainRotationCount: 10
|
remainRotationCount: 5
|
||||||
|
remainLogLevel: 6
|
||||||
elasticSearchSwitch: false
|
elasticSearchSwitch: false
|
||||||
elasticSearchAddr: [ 127.0.0.1:9201 ]
|
elasticSearchAddr: [ 127.0.0.1:9201 ]
|
||||||
elasticSearchUser: ""
|
elasticSearchUser: ""
|
||||||
@ -105,7 +106,7 @@ modulename:
|
|||||||
pushName: push
|
pushName: push
|
||||||
|
|
||||||
longconnsvr:
|
longconnsvr:
|
||||||
websocketPort: [ 17778 ]
|
openImWsPort: [ 17778 ]
|
||||||
websocketMaxConnNum: 10000
|
websocketMaxConnNum: 10000
|
||||||
websocketMaxMsgLen: 4096
|
websocketMaxMsgLen: 4096
|
||||||
websocketTimeOut: 10
|
websocketTimeOut: 10
|
||||||
|
@ -28,7 +28,7 @@ RUN ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && dpkg-reconfigure
|
|||||||
|
|
||||||
|
|
||||||
#set directory to map logs,config file,script file.
|
#set directory to map logs,config file,script file.
|
||||||
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"]
|
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script","/Open-IM-Server/db/sdk"]
|
||||||
|
|
||||||
#Copy scripts files and binary files to the blank image
|
#Copy scripts files and binary files to the blank image
|
||||||
COPY --from=build /Open-IM-Server/script /Open-IM-Server/script
|
COPY --from=build /Open-IM-Server/script /Open-IM-Server/script
|
||||||
@ -36,4 +36,4 @@ COPY --from=build /Open-IM-Server/bin /Open-IM-Server/bin
|
|||||||
|
|
||||||
WORKDIR /Open-IM-Server/script
|
WORKDIR /Open-IM-Server/script
|
||||||
|
|
||||||
CMD ["./docker_start_all.sh"]
|
CMD ["./docker_start_all.sh"]
|
||||||
|
@ -84,25 +84,28 @@ services:
|
|||||||
|
|
||||||
|
|
||||||
#fixme-----build from dockerfile---------
|
#fixme-----build from dockerfile---------
|
||||||
# open-im-server:
|
# open-im-server:
|
||||||
# image: open_im_server
|
# image: open_im_server
|
||||||
# ports:
|
# container_name: open-im-server
|
||||||
# - 10000:10000
|
# volumes:
|
||||||
# - 17778:17778
|
# - ./logs:/Open-IM-Server/logs
|
||||||
# container_name: open-im-server
|
# - ./config/config.yaml:/Open-IM-Server/config/config.yaml
|
||||||
# volumes:
|
# restart: always
|
||||||
# - ./logs:/Open-IM-Server/logs
|
# build:
|
||||||
# - ./config/config.yaml:/Open-IM-Server/config/config.yaml
|
# context: .
|
||||||
# restart: always
|
# dockerfile: deploy.Dockerfile
|
||||||
# build:
|
# depends_on:
|
||||||
# context: .
|
# - mysql
|
||||||
# dockerfile: deploy.Dockerfile
|
# - mongodb
|
||||||
# depends_on:
|
# - redis
|
||||||
# - mysql
|
# - kafka
|
||||||
# - mongodb
|
# - etcd
|
||||||
# - redis
|
# network_mode: "host"
|
||||||
# - kafka
|
# logging:
|
||||||
# - etcd
|
# driver: json-file
|
||||||
|
# options:
|
||||||
|
# max-size: "1g"
|
||||||
|
# max-file: "2"
|
||||||
|
|
||||||
#fixme----build from docker hub------
|
#fixme----build from docker hub------
|
||||||
open-im-server:
|
open-im-server:
|
||||||
|
@ -40,7 +40,7 @@ func newUserRegisterReq(params *paramsUserRegister) *pbAuth.UserRegisterReq {
|
|||||||
|
|
||||||
func UserRegister(c *gin.Context) {
|
func UserRegister(c *gin.Context) {
|
||||||
log.Info("", "", "api user_register init ....")
|
log.Info("", "", "api user_register init ....")
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.RpcGetTokenName)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAuthName)
|
||||||
client := pbAuth.NewAuthClient(etcdConn)
|
client := pbAuth.NewAuthClient(etcdConn)
|
||||||
//defer etcdConn.Close()
|
//defer etcdConn.Close()
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ func newUserTokenReq(params *paramsUserToken) *pbAuth.UserTokenReq {
|
|||||||
|
|
||||||
func UserToken(c *gin.Context) {
|
func UserToken(c *gin.Context) {
|
||||||
log.Info("", "", "api user_token init ....")
|
log.Info("", "", "api user_token init ....")
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.RpcGetTokenName)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAuthName)
|
||||||
client := pbAuth.NewAuthClient(etcdConn)
|
client := pbAuth.NewAuthClient(etcdConn)
|
||||||
//defer etcdConn.Close()
|
//defer etcdConn.Close()
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ package auth
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
log2 "Open_IM/pkg/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
pbAuth "Open_IM/pkg/proto/auth"
|
pbAuth "Open_IM/pkg/proto/auth"
|
||||||
"Open_IM/pkg/utils"
|
"Open_IM/pkg/utils"
|
||||||
@ -20,24 +20,25 @@ type rpcAuth struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewRpcAuthServer(port int) *rpcAuth {
|
func NewRpcAuthServer(port int) *rpcAuth {
|
||||||
|
log.NewPrivateLog("auth")
|
||||||
return &rpcAuth{
|
return &rpcAuth{
|
||||||
rpcPort: port,
|
rpcPort: port,
|
||||||
rpcRegisterName: config.Config.RpcRegisterName.RpcGetTokenName,
|
rpcRegisterName: config.Config.RpcRegisterName.OpenImAuthName,
|
||||||
etcdSchema: config.Config.Etcd.EtcdSchema,
|
etcdSchema: config.Config.Etcd.EtcdSchema,
|
||||||
etcdAddr: config.Config.Etcd.EtcdAddr,
|
etcdAddr: config.Config.Etcd.EtcdAddr,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (rpc *rpcAuth) Run() {
|
func (rpc *rpcAuth) Run() {
|
||||||
log2.Info("", "", "rpc get_token init...")
|
log.Info("", "", "rpc get_token init...")
|
||||||
|
|
||||||
address := utils.ServerIP + ":" + strconv.Itoa(rpc.rpcPort)
|
address := utils.ServerIP + ":" + strconv.Itoa(rpc.rpcPort)
|
||||||
listener, err := net.Listen("tcp", address)
|
listener, err := net.Listen("tcp", address)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log2.Error("", "", "listen network failed, err = %s, address = %s", err.Error(), address)
|
log.Error("", "", "listen network failed, err = %s, address = %s", err.Error(), address)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log2.Info("", "", "listen network success, address = %s", address)
|
log.Info("", "", "listen network success, address = %s", address)
|
||||||
|
|
||||||
//grpc server
|
//grpc server
|
||||||
srv := grpc.NewServer()
|
srv := grpc.NewServer()
|
||||||
@ -48,14 +49,14 @@ func (rpc *rpcAuth) Run() {
|
|||||||
pbAuth.RegisterAuthServer(srv, rpc)
|
pbAuth.RegisterAuthServer(srv, rpc)
|
||||||
err = getcdv3.RegisterEtcd(rpc.etcdSchema, strings.Join(rpc.etcdAddr, ","), utils.ServerIP, rpc.rpcPort, rpc.rpcRegisterName, 10)
|
err = getcdv3.RegisterEtcd(rpc.etcdSchema, strings.Join(rpc.etcdAddr, ","), utils.ServerIP, rpc.rpcPort, rpc.rpcRegisterName, 10)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log2.Error("", "", "register rpc get_token to etcd failed, err = %s", err.Error())
|
log.Error("", "", "register rpc get_token to etcd failed, err = %s", err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
err = srv.Serve(listener)
|
err = srv.Serve(listener)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log2.Info("", "", "rpc get_token fail, err = %s", err.Error())
|
log.Info("", "", "rpc get_token fail, err = %s", err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log2.Info("", "", "rpc get_token init success")
|
log.Info("", "", "rpc get_token init success")
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ package chat
|
|||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/kafka"
|
"Open_IM/pkg/common/kafka"
|
||||||
log2 "Open_IM/pkg/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
pbChat "Open_IM/pkg/proto/chat"
|
pbChat "Open_IM/pkg/proto/chat"
|
||||||
"Open_IM/pkg/utils"
|
"Open_IM/pkg/utils"
|
||||||
@ -22,6 +22,7 @@ type rpcChat struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewRpcChatServer(port int) *rpcChat {
|
func NewRpcChatServer(port int) *rpcChat {
|
||||||
|
log.NewPrivateLog("msg")
|
||||||
rc := rpcChat{
|
rc := rpcChat{
|
||||||
rpcPort: port,
|
rpcPort: port,
|
||||||
rpcRegisterName: config.Config.RpcRegisterName.OpenImOfflineMessageName,
|
rpcRegisterName: config.Config.RpcRegisterName.OpenImOfflineMessageName,
|
||||||
@ -33,15 +34,15 @@ func NewRpcChatServer(port int) *rpcChat {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (rpc *rpcChat) Run() {
|
func (rpc *rpcChat) Run() {
|
||||||
log2.Info("", "", "rpc get_token init...")
|
log.Info("", "", "rpc get_token init...")
|
||||||
|
|
||||||
address := utils.ServerIP + ":" + strconv.Itoa(rpc.rpcPort)
|
address := utils.ServerIP + ":" + strconv.Itoa(rpc.rpcPort)
|
||||||
listener, err := net.Listen("tcp", address)
|
listener, err := net.Listen("tcp", address)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log2.Error("", "", "listen network failed, err = %s, address = %s", err.Error(), address)
|
log.Error("", "", "listen network failed, err = %s, address = %s", err.Error(), address)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log2.Info("", "", "listen network success, address = %s", address)
|
log.Info("", "", "listen network success, address = %s", address)
|
||||||
|
|
||||||
//grpc server
|
//grpc server
|
||||||
srv := grpc.NewServer()
|
srv := grpc.NewServer()
|
||||||
@ -52,14 +53,14 @@ func (rpc *rpcChat) Run() {
|
|||||||
pbChat.RegisterChatServer(srv, rpc)
|
pbChat.RegisterChatServer(srv, rpc)
|
||||||
err = getcdv3.RegisterEtcd(rpc.etcdSchema, strings.Join(rpc.etcdAddr, ","), utils.ServerIP, rpc.rpcPort, rpc.rpcRegisterName, 10)
|
err = getcdv3.RegisterEtcd(rpc.etcdSchema, strings.Join(rpc.etcdAddr, ","), utils.ServerIP, rpc.rpcPort, rpc.rpcRegisterName, 10)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log2.Error("", "", "register rpc get_token to etcd failed, err = %s", err.Error())
|
log.Error("", "", "register rpc get_token to etcd failed, err = %s", err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
err = srv.Serve(listener)
|
err = srv.Serve(listener)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log2.Info("", "", "rpc get_token fail, err = %s", err.Error())
|
log.Info("", "", "rpc get_token fail, err = %s", err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log2.Info("", "", "rpc get_token init success")
|
log.Info("", "", "rpc get_token init success")
|
||||||
}
|
}
|
||||||
|
@ -110,6 +110,10 @@ func (s *friendServer) ImportFriend(ctx context.Context, req *pbFriend.ImportFri
|
|||||||
SessionType: constant.SingleChatType,
|
SessionType: constant.SingleChatType,
|
||||||
OperationID: req.OperationID,
|
OperationID: req.OperationID,
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
resp.CommonResp.ErrorMsg = "some uid establish failed"
|
||||||
|
resp.CommonResp.ErrorCode = 408
|
||||||
|
resp.FailedUidList = append(resp.FailedUidList, v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ type friendServer struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewFriendServer(port int) *friendServer {
|
func NewFriendServer(port int) *friendServer {
|
||||||
|
log.NewPrivateLog("friend")
|
||||||
return &friendServer{
|
return &friendServer{
|
||||||
rpcPort: port,
|
rpcPort: port,
|
||||||
rpcRegisterName: config.Config.RpcRegisterName.OpenImFriendName,
|
rpcRegisterName: config.Config.RpcRegisterName.OpenImFriendName,
|
||||||
|
@ -28,6 +28,7 @@ type groupServer struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewGroupServer(port int) *groupServer {
|
func NewGroupServer(port int) *groupServer {
|
||||||
|
log.NewPrivateLog("group")
|
||||||
return &groupServer{
|
return &groupServer{
|
||||||
rpcPort: port,
|
rpcPort: port,
|
||||||
rpcRegisterName: config.Config.RpcRegisterName.OpenImGroupName,
|
rpcRegisterName: config.Config.RpcRegisterName.OpenImGroupName,
|
||||||
|
@ -81,7 +81,7 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite
|
|||||||
log.Error(claims.UID, req.OperationID, "FindUserByUID failed, err: ", err.Error())
|
log.Error(claims.UID, req.OperationID, "FindUserByUID failed, err: ", err.Error())
|
||||||
return &pbGroup.InviteUserToGroupResp{ErrorCode: config.ErrParam.ErrCode, ErrorMsg: config.ErrParam.ErrMsg}, nil
|
return &pbGroup.InviteUserToGroupResp{ErrorCode: config.ErrParam.ErrCode, ErrorMsg: config.ErrParam.ErrMsg}, nil
|
||||||
}*/
|
}*/
|
||||||
|
var nicknameList string
|
||||||
for _, v := range req.UidList {
|
for _, v := range req.UidList {
|
||||||
var resultNode pbGroup.Id2Result
|
var resultNode pbGroup.Id2Result
|
||||||
resultNode.UId = v
|
resultNode.UId = v
|
||||||
@ -113,7 +113,7 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("", "", "add mongo group member failed, db.DB.AddGroupMember fail [err: %s]", err.Error())
|
log.Error("", "", "add mongo group member failed, db.DB.AddGroupMember fail [err: %s]", err.Error())
|
||||||
}
|
}
|
||||||
|
nicknameList = nicknameList + toUserInfo.Name + " "
|
||||||
resp.Id2Result = append(resp.Id2Result, &resultNode)
|
resp.Id2Result = append(resp.Id2Result, &resultNode)
|
||||||
}
|
}
|
||||||
resp.ErrorCode = 0
|
resp.ErrorCode = 0
|
||||||
@ -121,12 +121,13 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite
|
|||||||
|
|
||||||
//if claims.UID == config.Config.AppManagerUid
|
//if claims.UID == config.Config.AppManagerUid
|
||||||
if utils.IsContain(claims.UID, config.Config.Manager.AppManagerUid) {
|
if utils.IsContain(claims.UID, config.Config.Manager.AppManagerUid) {
|
||||||
|
m, _ := imdb.FindUserByUID(claims.UID)
|
||||||
var iu inviteUserToGroupReq
|
var iu inviteUserToGroupReq
|
||||||
iu.GroupID = req.GroupID
|
iu.GroupID = req.GroupID
|
||||||
iu.OperationID = req.OperationID
|
iu.OperationID = req.OperationID
|
||||||
iu.Reason = req.Reason
|
iu.Reason = req.Reason
|
||||||
iu.UidList = req.UidList
|
iu.UidList = req.UidList
|
||||||
n := content_struct.NotificationContent{1, req.GroupID, iu.ContentToString()}
|
n := content_struct.NotificationContent{1, nicknameList + " invited into the group chat by " + m.Name, iu.ContentToString()}
|
||||||
logic.SendMsgByWS(&pbChat.WSToMsgSvrChatMsg{
|
logic.SendMsgByWS(&pbChat.WSToMsgSvrChatMsg{
|
||||||
SendID: claims.UID,
|
SendID: claims.UID,
|
||||||
RecvID: req.GroupID,
|
RecvID: req.GroupID,
|
||||||
|
@ -22,6 +22,7 @@ type userServer struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewUserServer(port int) *userServer {
|
func NewUserServer(port int) *userServer {
|
||||||
|
log.NewPrivateLog("user")
|
||||||
return &userServer{
|
return &userServer{
|
||||||
rpcPort: port,
|
rpcPort: port,
|
||||||
rpcRegisterName: config.Config.RpcRegisterName.OpenImUserName,
|
rpcRegisterName: config.Config.RpcRegisterName.OpenImUserName,
|
||||||
|
@ -45,16 +45,17 @@ func (s *userServer) UpdateUserInfo(ctx context.Context, req *pbUser.UpdateUserI
|
|||||||
|
|
||||||
RpcResp, err := client.GetFriendList(context.Background(), newReq)
|
RpcResp, err := client.GetFriendList(context.Background(), newReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(req.Token, req.OperationID, "err=%s,call get friend list rpc server failed", err)
|
|
||||||
log.ErrorByKv("get friend list rpc server failed", req.OperationID, "err", err.Error(), "req", req.String())
|
log.ErrorByKv("get friend list rpc server failed", req.OperationID, "err", err.Error(), "req", req.String())
|
||||||
|
return &pbUser.CommonResp{}, nil
|
||||||
}
|
}
|
||||||
if RpcResp.ErrorCode != 0 {
|
if RpcResp.ErrorCode != 0 {
|
||||||
log.ErrorByKv("get friend list rpc server failed", req.OperationID, "err", err.Error(), "req", req.String())
|
log.ErrorByKv("get friend list rpc server failed", req.OperationID, "err", err.Error(), "req", req.String())
|
||||||
|
return &pbUser.CommonResp{}, nil
|
||||||
}
|
}
|
||||||
self, err := im_mysql_model.FindUserByUID(ownerUid)
|
self, err := im_mysql_model.FindUserByUID(ownerUid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.ErrorByKv("get self info failed", req.OperationID, "err", err.Error(), "req", req.String())
|
log.ErrorByKv("get self info failed", req.OperationID, "err", err.Error(), "req", req.String())
|
||||||
|
return &pbUser.CommonResp{}, nil
|
||||||
}
|
}
|
||||||
var name, faceUrl string
|
var name, faceUrl string
|
||||||
if self != nil {
|
if self != nil {
|
||||||
|
@ -14,7 +14,7 @@ type config struct {
|
|||||||
GinPort []int `yaml:"openImApiPort"`
|
GinPort []int `yaml:"openImApiPort"`
|
||||||
}
|
}
|
||||||
Sdk struct {
|
Sdk struct {
|
||||||
WsPort []int `yaml:"sdkWsPort"`
|
WsPort []int `yaml:"openImSdkWsPort"`
|
||||||
}
|
}
|
||||||
Credential struct {
|
Credential struct {
|
||||||
Tencent struct {
|
Tencent struct {
|
||||||
@ -71,7 +71,7 @@ type config struct {
|
|||||||
OpenImPushName string `yaml:"openImPushName"`
|
OpenImPushName string `yaml:"openImPushName"`
|
||||||
OpenImOnlineMessageRelayName string `yaml:"openImOnlineMessageRelayName"`
|
OpenImOnlineMessageRelayName string `yaml:"openImOnlineMessageRelayName"`
|
||||||
OpenImGroupName string `yaml:"openImGroupName"`
|
OpenImGroupName string `yaml:"openImGroupName"`
|
||||||
RpcGetTokenName string `yaml:"rpcGetTokenName"`
|
OpenImAuthName string `yaml:"openImAuthName"`
|
||||||
}
|
}
|
||||||
Etcd struct {
|
Etcd struct {
|
||||||
EtcdSchema string `yaml:"etcdSchema"`
|
EtcdSchema string `yaml:"etcdSchema"`
|
||||||
@ -81,6 +81,7 @@ type config struct {
|
|||||||
StorageLocation string `yaml:"storageLocation"`
|
StorageLocation string `yaml:"storageLocation"`
|
||||||
RotationTime int `yaml:"rotationTime"`
|
RotationTime int `yaml:"rotationTime"`
|
||||||
RemainRotationCount uint `yaml:"remainRotationCount"`
|
RemainRotationCount uint `yaml:"remainRotationCount"`
|
||||||
|
RemainLogLevel uint `yaml:"remainLogLevel"`
|
||||||
ElasticSearchSwitch bool `yaml:"elasticSearchSwitch"`
|
ElasticSearchSwitch bool `yaml:"elasticSearchSwitch"`
|
||||||
ElasticSearchAddr []string `yaml:"elasticSearchAddr"`
|
ElasticSearchAddr []string `yaml:"elasticSearchAddr"`
|
||||||
ElasticSearchUser string `yaml:"elasticSearchUser"`
|
ElasticSearchUser string `yaml:"elasticSearchUser"`
|
||||||
@ -92,7 +93,7 @@ type config struct {
|
|||||||
PushName string `yaml:"pushName"`
|
PushName string `yaml:"pushName"`
|
||||||
}
|
}
|
||||||
LongConnSvr struct {
|
LongConnSvr struct {
|
||||||
WebsocketPort []int `yaml:"websocketPort"`
|
WebsocketPort []int `yaml:"openImWsPort"`
|
||||||
WebsocketMaxConnNum int `yaml:"websocketMaxConnNum"`
|
WebsocketMaxConnNum int `yaml:"websocketMaxConnNum"`
|
||||||
WebsocketMaxMsgLen int `yaml:"websocketMaxMsgLen"`
|
WebsocketMaxMsgLen int `yaml:"websocketMaxMsgLen"`
|
||||||
WebsocketTimeOut int `yaml:"websocketTimeOut"`
|
WebsocketTimeOut int `yaml:"websocketTimeOut"`
|
||||||
|
@ -4,9 +4,7 @@ source ./style_info.cfg
|
|||||||
source ./path_info.cfg
|
source ./path_info.cfg
|
||||||
source ./function.sh
|
source ./function.sh
|
||||||
service_port_name=(
|
service_port_name=(
|
||||||
#api port name
|
|
||||||
openImApiPort
|
openImApiPort
|
||||||
#rpc port name
|
|
||||||
openImUserPort
|
openImUserPort
|
||||||
openImFriendPort
|
openImFriendPort
|
||||||
openImOfflineMessagePort
|
openImOfflineMessagePort
|
||||||
@ -14,8 +12,8 @@ service_port_name=(
|
|||||||
openImGroupPort
|
openImGroupPort
|
||||||
openImAuthPort
|
openImAuthPort
|
||||||
openImPushPort
|
openImPushPort
|
||||||
websocketPort
|
openImWsPort
|
||||||
sdkWsPort
|
openImSdkWsPort
|
||||||
)
|
)
|
||||||
for i in ${service_port_name[*]};do
|
for i in ${service_port_name[*]};do
|
||||||
list=$(cat $config_path | grep -w ${i} | awk -F '[:]' '{print $NF}')
|
list=$(cat $config_path | grep -w ${i} | awk -F '[:]' '{print $NF}')
|
||||||
|
@ -8,6 +8,7 @@ need_to_start_server_shell=(
|
|||||||
msg_gateway_start.sh
|
msg_gateway_start.sh
|
||||||
push_start.sh
|
push_start.sh
|
||||||
msg_transfer_start.sh
|
msg_transfer_start.sh
|
||||||
|
sdk_svr_start.sh
|
||||||
)
|
)
|
||||||
|
|
||||||
#fixme The 10 second delay to start the project is for the docker-compose one-click to start openIM when the infrastructure dependencies are not started
|
#fixme The 10 second delay to start the project is for the docker-compose one-click to start openIM when the infrastructure dependencies are not started
|
||||||
|
@ -4,7 +4,7 @@ source ./style_info.cfg
|
|||||||
source ./path_info.cfg
|
source ./path_info.cfg
|
||||||
source ./function.sh
|
source ./function.sh
|
||||||
list1=$(cat $config_path | grep openImOnlineRelayPort | awk -F '[:]' '{print $NF}')
|
list1=$(cat $config_path | grep openImOnlineRelayPort | awk -F '[:]' '{print $NF}')
|
||||||
list2=$(cat $config_path | grep websocketPort | awk -F '[:]' '{print $NF}')
|
list2=$(cat $config_path | grep openImWsPort | awk -F '[:]' '{print $NF}')
|
||||||
list_to_string $list1
|
list_to_string $list1
|
||||||
rpc_ports=($ports_array)
|
rpc_ports=($ports_array)
|
||||||
list_to_string $list2
|
list_to_string $list2
|
||||||
@ -26,7 +26,7 @@ fi
|
|||||||
sleep 1
|
sleep 1
|
||||||
cd ${msg_gateway_binary_root}
|
cd ${msg_gateway_binary_root}
|
||||||
for ((i = 0; i < ${#ws_ports[@]}; i++)); do
|
for ((i = 0; i < ${#ws_ports[@]}; i++)); do
|
||||||
nohup ./${msg_gateway_name} -rpc_port ${rpc_ports[$i]} -ws_port ${ws_ports[$i]} >>../logs/${msg_gateway_name}.log 2>&1 &
|
nohup ./${msg_gateway_name} -rpc_port ${rpc_ports[$i]} -ws_port ${ws_ports[$i]} >>../logs/openIM.log 2>&1 &
|
||||||
done
|
done
|
||||||
|
|
||||||
#Check launched service process
|
#Check launched service process
|
||||||
@ -39,7 +39,7 @@ if [ $check -ge 1 ]; then
|
|||||||
ports=$(netstat -netulp | grep -w ${i} | awk '{print $4}' | awk -F '[:]' '{print $NF}')
|
ports=$(netstat -netulp | grep -w ${i} | awk '{print $4}' | awk -F '[:]' '{print $NF}')
|
||||||
allPorts=${allPorts}"$ports "
|
allPorts=${allPorts}"$ports "
|
||||||
done
|
done
|
||||||
echo -e ${SKY_BLUE_PREFIX}"SERVICE START SUCCESS !!!"${COLOR_SUFFIX}
|
echo -e ${SKY_BLUE_PREFIX}"SERVICE START SUCCESS"${COLOR_SUFFIX}
|
||||||
echo -e ${SKY_BLUE_PREFIX}"SERVICE_NAME: "${COLOR_SUFFIX}${YELLOW_PREFIX}${msg_gateway_name}${COLOR_SUFFIX}
|
echo -e ${SKY_BLUE_PREFIX}"SERVICE_NAME: "${COLOR_SUFFIX}${YELLOW_PREFIX}${msg_gateway_name}${COLOR_SUFFIX}
|
||||||
echo -e ${SKY_BLUE_PREFIX}"PID: "${COLOR_SUFFIX}${YELLOW_PREFIX}${allNewPid}${COLOR_SUFFIX}
|
echo -e ${SKY_BLUE_PREFIX}"PID: "${COLOR_SUFFIX}${YELLOW_PREFIX}${allNewPid}${COLOR_SUFFIX}
|
||||||
echo -e ${SKY_BLUE_PREFIX}"LISTENING_PORT: "${COLOR_SUFFIX}${YELLOW_PREFIX}${allPorts}${COLOR_SUFFIX}
|
echo -e ${SKY_BLUE_PREFIX}"LISTENING_PORT: "${COLOR_SUFFIX}${YELLOW_PREFIX}${allPorts}${COLOR_SUFFIX}
|
||||||
|
@ -16,7 +16,7 @@ fi
|
|||||||
#Waiting port recycling
|
#Waiting port recycling
|
||||||
sleep 1
|
sleep 1
|
||||||
cd ${msg_transfer_binary_root}
|
cd ${msg_transfer_binary_root}
|
||||||
nohup ./${msg_transfer_name} >>../logs/${msg_transfer_name}.log 2>&1 &
|
nohup ./${msg_transfer_name} >>../logs/openIM.log 2>&1 &
|
||||||
#Check launched service process
|
#Check launched service process
|
||||||
check=`ps aux | grep -w ./${msg_transfer_name} | grep -v grep| wc -l`
|
check=`ps aux | grep -w ./${msg_transfer_name} | grep -v grep| wc -l`
|
||||||
if [ $check -eq 1 ]
|
if [ $check -eq 1 ]
|
||||||
@ -29,7 +29,7 @@ for i in $ports ;
|
|||||||
do
|
do
|
||||||
allPorts=${allPorts}"$i "
|
allPorts=${allPorts}"$i "
|
||||||
done
|
done
|
||||||
echo -e ${SKY_BLUE_PREFIX}"SERVICE START SUCCESS !!!"${COLOR_SUFFIX}
|
echo -e ${SKY_BLUE_PREFIX}"SERVICE START SUCCESS "${COLOR_SUFFIX}
|
||||||
echo -e ${SKY_BLUE_PREFIX}"SERVICE_NAME: "${COLOR_SUFFIX}${YELLOW_PREFIX}${msg_transfer_name}${COLOR_SUFFIX}
|
echo -e ${SKY_BLUE_PREFIX}"SERVICE_NAME: "${COLOR_SUFFIX}${YELLOW_PREFIX}${msg_transfer_name}${COLOR_SUFFIX}
|
||||||
echo -e ${SKY_BLUE_PREFIX}"PID: "${COLOR_SUFFIX}${YELLOW_PREFIX}${newPid}${COLOR_SUFFIX}
|
echo -e ${SKY_BLUE_PREFIX}"PID: "${COLOR_SUFFIX}${YELLOW_PREFIX}${newPid}${COLOR_SUFFIX}
|
||||||
echo -e ${SKY_BLUE_PREFIX}"LISTENING_PORT: "${COLOR_SUFFIX}${YELLOW_PREFIX}${allPorts}${COLOR_SUFFIX}
|
echo -e ${SKY_BLUE_PREFIX}"LISTENING_PORT: "${COLOR_SUFFIX}${YELLOW_PREFIX}${allPorts}${COLOR_SUFFIX}
|
||||||
|
@ -22,7 +22,7 @@ sleep 1
|
|||||||
cd ${push_binary_root}
|
cd ${push_binary_root}
|
||||||
|
|
||||||
for ((i = 0; i < ${#rpc_ports[@]}; i++)); do
|
for ((i = 0; i < ${#rpc_ports[@]}; i++)); do
|
||||||
nohup ./${push_name} -port ${rpc_ports[$i]} >>../logs/${push_name}.log 2>&1 &
|
nohup ./${push_name} -port ${rpc_ports[$i]} >>../logs/openIM.log 2>&1 &
|
||||||
done
|
done
|
||||||
|
|
||||||
sleep 3
|
sleep 3
|
||||||
@ -36,7 +36,7 @@ if [ $check -eq 1 ]; then
|
|||||||
for i in $ports; do
|
for i in $ports; do
|
||||||
allPorts=${allPorts}"$i "
|
allPorts=${allPorts}"$i "
|
||||||
done
|
done
|
||||||
echo -e ${SKY_BLUE_PREFIX}"SERVICE START SUCCESS !!!"${COLOR_SUFFIX}
|
echo -e ${SKY_BLUE_PREFIX}"SERVICE START SUCCESS "${COLOR_SUFFIX}
|
||||||
echo -e ${SKY_BLUE_PREFIX}"SERVICE_NAME: "${COLOR_SUFFIX}${YELLOW_PREFIX}${push_name}${COLOR_SUFFIX}
|
echo -e ${SKY_BLUE_PREFIX}"SERVICE_NAME: "${COLOR_SUFFIX}${YELLOW_PREFIX}${push_name}${COLOR_SUFFIX}
|
||||||
echo -e ${SKY_BLUE_PREFIX}"PID: "${COLOR_SUFFIX}${YELLOW_PREFIX}${newPid}${COLOR_SUFFIX}
|
echo -e ${SKY_BLUE_PREFIX}"PID: "${COLOR_SUFFIX}${YELLOW_PREFIX}${newPid}${COLOR_SUFFIX}
|
||||||
echo -e ${SKY_BLUE_PREFIX}"LISTENING_PORT: "${COLOR_SUFFIX}${YELLOW_PREFIX}${allPorts}${COLOR_SUFFIX}
|
echo -e ${SKY_BLUE_PREFIX}"LISTENING_PORT: "${COLOR_SUFFIX}${YELLOW_PREFIX}${allPorts}${COLOR_SUFFIX}
|
||||||
|
@ -4,8 +4,8 @@ source ./style_info.cfg
|
|||||||
source ./path_info.cfg
|
source ./path_info.cfg
|
||||||
source ./function.sh
|
source ./function.sh
|
||||||
list1=$(cat $config_path | grep openImApiPort | awk -F '[:]' '{print $NF}')
|
list1=$(cat $config_path | grep openImApiPort | awk -F '[:]' '{print $NF}')
|
||||||
list2=$(cat $config_path | grep websocketPort | awk -F '[:]' '{print $NF}')
|
list2=$(cat $config_path | grep openImWsPort | awk -F '[:]' '{print $NF}')
|
||||||
list3=$(cat $config_path | grep sdkWsPort | awk -F '[:]' '{print $NF}')
|
list3=$(cat $config_path | grep openImSdkWsPort | awk -F '[:]' '{print $NF}')
|
||||||
list_to_string $list1
|
list_to_string $list1
|
||||||
api_ports=($ports_array)
|
api_ports=($ports_array)
|
||||||
list_to_string $list2
|
list_to_string $list2
|
||||||
@ -26,7 +26,7 @@ fi
|
|||||||
#Waiting port recycling
|
#Waiting port recycling
|
||||||
sleep 1
|
sleep 1
|
||||||
cd ${sdk_server_binary_root}
|
cd ${sdk_server_binary_root}
|
||||||
nohup ./${sdk_server_name} -openIM_api_port ${api_ports[0]} -openIM_ws_port ${ws_ports[0]} -sdk_ws_port ${sdk_ws_ports[0]} >>../logs/${sdk_server_name}.log 2>&1 &
|
nohup ./${sdk_server_name} -openIM_api_port ${api_ports[0]} -openIM_ws_port ${ws_ports[0]} -sdk_ws_port ${sdk_ws_ports[0]} >>../logs/openIM.log 2>&1 &
|
||||||
|
|
||||||
#Check launched service process
|
#Check launched service process
|
||||||
sleep 3
|
sleep 3
|
@ -8,7 +8,7 @@ need_to_start_server_shell=(
|
|||||||
msg_gateway_start.sh
|
msg_gateway_start.sh
|
||||||
push_start.sh
|
push_start.sh
|
||||||
msg_transfer_start.sh
|
msg_transfer_start.sh
|
||||||
start_sdk_svr.sh
|
sdk_svr_start.sh
|
||||||
)
|
)
|
||||||
|
|
||||||
for i in ${need_to_start_server_shell[*]}; do
|
for i in ${need_to_start_server_shell[*]}; do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user