Skip to content

Commit

Permalink
Merge: main
Browse files Browse the repository at this point in the history
  • Loading branch information
icey-yu committed Dec 6, 2024
2 parents 435d048 + fceaaa1 commit 69ccbb2
Show file tree
Hide file tree
Showing 22 changed files with 150 additions and 243 deletions.
5 changes: 5 additions & 0 deletions config/openim-msggateway.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
rpc:
# The IP address where this RPC service registers itself; if left blank, it defaults to the internal network IP
registerIP:
# autoSetPorts indicates whether to automatically set the ports
autoSetPorts: true
# List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances. These must match the number of configured prometheus ports
# It will only take effect when autoSetPorts is set to false.
ports: [ 10140, 10141, 10142, 10143, 10144, 10145, 10146, 10147, 10148, 10149, 10150, 10151, 10152, 10153, 10154, 10155 ]

prometheus:
# Enable or disable Prometheus monitoring
Expand Down
6 changes: 6 additions & 0 deletions config/openim-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ rpc:
registerIP:
# IP address that the RPC service listens on; setting to 0.0.0.0 listens on both internal and external IPs. If left blank, it automatically uses the internal network IP
listenIP: 0.0.0.0
# autoSetPorts indicates whether to automatically set the ports
autoSetPorts: true
# List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances. These must match the number of configured prometheus ports
# It will only take effect when autoSetPorts is set to false.
ports: [ 10170, 10171, 10172, 10173, 10174, 10175, 10176, 10177, 10178, 10179, 10180, 10181, 10182, 10183, 10184, 10185 ]


prometheus:
# Enable or disable Prometheus monitoring
Expand Down
5 changes: 5 additions & 0 deletions config/openim-rpc-auth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ rpc:
registerIP:
# IP address that the RPC service listens on; setting to 0.0.0.0 listens on both internal and external IPs. If left blank, it automatically uses the internal network IP
listenIP: 0.0.0.0
# autoSetPorts indicates whether to automatically set the ports
autoSetPorts: true
# List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances. These must match the number of configured prometheus ports
# It will only take effect when autoSetPorts is set to false.
ports: [ 10200 ]


prometheus:
Expand Down
5 changes: 5 additions & 0 deletions config/openim-rpc-conversation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ rpc:
registerIP:
# IP address that the RPC service listens on; setting to 0.0.0.0 listens on both internal and external IPs. If left blank, it automatically uses the internal network IP
listenIP: 0.0.0.0
# autoSetPorts indicates whether to automatically set the ports
autoSetPorts: true
# List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances. These must match the number of configured prometheus ports
# It will only take effect when autoSetPorts is set to false.
ports: [ 10220 ]

prometheus:
# Enable or disable Prometheus monitoring
Expand Down
5 changes: 5 additions & 0 deletions config/openim-rpc-friend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ rpc:
registerIP:
# IP address that the RPC service listens on; setting to 0.0.0.0 listens on both internal and external IPs. If left blank, it automatically uses the internal network IP
listenIP: 0.0.0.0
# autoSetPorts indicates whether to automatically set the ports
autoSetPorts: true
# List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances. These must match the number of configured prometheus ports
# It will only take effect when autoSetPorts is set to false.
ports: [ 10240 ]

prometheus:
# Enable or disable Prometheus monitoring
Expand Down
5 changes: 5 additions & 0 deletions config/openim-rpc-group.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ rpc:
registerIP:
# IP address that the RPC service listens on; setting to 0.0.0.0 listens on both internal and external IPs. If left blank, it automatically uses the internal network IP
listenIP: 0.0.0.0
# autoSetPorts indicates whether to automatically set the ports
autoSetPorts: true
# List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances. These must match the number of configured prometheus ports
# It will only take effect when autoSetPorts is set to false.
ports: [ 10260 ]

prometheus:
# Enable or disable Prometheus monitoring
Expand Down
5 changes: 5 additions & 0 deletions config/openim-rpc-msg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ rpc:
registerIP:
# IP address that the RPC service listens on; setting to 0.0.0.0 listens on both internal and external IPs. If left blank, it automatically uses the internal network IP
listenIP: 0.0.0.0
# autoSetPorts indicates whether to automatically set the ports
autoSetPorts: true
# List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances. These must match the number of configured prometheus ports
# It will only take effect when autoSetPorts is set to false.
ports: [ 10280 ]

prometheus:
# Enable or disable Prometheus monitoring
Expand Down
5 changes: 5 additions & 0 deletions config/openim-rpc-third.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ rpc:
registerIP:
# IP address that the RPC service listens on; setting to 0.0.0.0 listens on both internal and external IPs. If left blank, it automatically uses the internal network IP
listenIP: 0.0.0.0
# autoSetPorts indicates whether to automatically set the ports
autoSetPorts: true
# List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances. These must match the number of configured prometheus ports
# It will only take effect when autoSetPorts is set to false.
ports: [ 10300 ]

prometheus:
# Enable or disable Prometheus monitoring
Expand Down
5 changes: 5 additions & 0 deletions config/openim-rpc-user.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ rpc:
registerIP:
# Listening IP; 0.0.0.0 means both internal and external IPs are listened to, if blank, the internal network IP is automatically obtained by default
listenIP: 0.0.0.0
# autoSetPorts indicates whether to automatically set the ports
autoSetPorts: true
# List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances. These must match the number of configured prometheus ports
# It will only take effect when autoSetPorts is set to false.
ports: [ 10320 ]

prometheus:
# Whether to enable prometheus
Expand Down
3 changes: 2 additions & 1 deletion internal/msggateway/hub_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ func (s *Server) InitServer(ctx context.Context, config *Config, disCov discover

func (s *Server) Start(ctx context.Context, index int, conf *Config) error {
return startrpc.Start(ctx, &conf.Discovery, &conf.MsgGateway.Prometheus, conf.MsgGateway.ListenIP,
index,
conf.MsgGateway.RPC.RegisterIP,
conf.MsgGateway.RPC.AutoSetPorts, conf.MsgGateway.RPC.Ports, index,
conf.Discovery.RpcService.MessageGateway,
&conf.Share,
conf,
Expand Down
3 changes: 2 additions & 1 deletion internal/msggateway/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ type Config struct {

// Start run ws server.
func Start(ctx context.Context, index int, conf *Config) error {
log.CInfo(ctx, "MSG-GATEWAY server is initializing",
log.CInfo(ctx, "MSG-GATEWAY server is initializing", "autoSetPorts", conf.MsgGateway.RPC.AutoSetPorts,
"rpcPorts", conf.MsgGateway.RPC.Ports,
"wsPort", conf.MsgGateway.LongConnSvr.Ports, "prometheusPorts", conf.MsgGateway.Prometheus.Ports)
wsPort, err := datautil.GetElemByIndex(conf.MsgGateway.LongConnSvr.Ports, index)
if err != nil {
Expand Down
165 changes: 0 additions & 165 deletions internal/tools/addr/addr.go

This file was deleted.

1 change: 1 addition & 0 deletions pkg/common/cmd/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,6 @@ func (a *AuthRpcCmd) Exec() error {

func (a *AuthRpcCmd) runE() error {
return startrpc.Start(a.ctx, &a.authConfig.Discovery, &a.authConfig.RpcConfig.Prometheus, a.authConfig.RpcConfig.RPC.ListenIP,
a.authConfig.RpcConfig.RPC.RegisterIP, a.authConfig.RpcConfig.RPC.AutoSetPorts, a.authConfig.RpcConfig.RPC.Ports,
a.Index(), a.authConfig.Discovery.RpcService.Auth, &a.authConfig.Share, a.authConfig, auth.Start)
}
1 change: 1 addition & 0 deletions pkg/common/cmd/conversation.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,6 @@ func (a *ConversationRpcCmd) Exec() error {

func (a *ConversationRpcCmd) runE() error {
return startrpc.Start(a.ctx, &a.conversationConfig.Discovery, &a.conversationConfig.RpcConfig.Prometheus, a.conversationConfig.RpcConfig.RPC.ListenIP,
a.conversationConfig.RpcConfig.RPC.RegisterIP, a.conversationConfig.RpcConfig.RPC.AutoSetPorts, a.conversationConfig.RpcConfig.RPC.Ports,
a.Index(), a.conversationConfig.Discovery.RpcService.Conversation, &a.conversationConfig.Share, a.conversationConfig, conversation.Start)
}
1 change: 1 addition & 0 deletions pkg/common/cmd/friend.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,6 @@ func (a *FriendRpcCmd) Exec() error {

func (a *FriendRpcCmd) runE() error {
return startrpc.Start(a.ctx, &a.relationConfig.Discovery, &a.relationConfig.RpcConfig.Prometheus, a.relationConfig.RpcConfig.RPC.ListenIP,
a.relationConfig.RpcConfig.RPC.RegisterIP, a.relationConfig.RpcConfig.RPC.AutoSetPorts, a.relationConfig.RpcConfig.RPC.Ports,
a.Index(), a.relationConfig.Discovery.RpcService.Friend, &a.relationConfig.Share, a.relationConfig, relation.Start)
}
1 change: 1 addition & 0 deletions pkg/common/cmd/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,6 @@ func (a *GroupRpcCmd) Exec() error {

func (a *GroupRpcCmd) runE() error {
return startrpc.Start(a.ctx, &a.groupConfig.Discovery, &a.groupConfig.RpcConfig.Prometheus, a.groupConfig.RpcConfig.RPC.ListenIP,
a.groupConfig.RpcConfig.RPC.RegisterIP, a.groupConfig.RpcConfig.RPC.AutoSetPorts, a.groupConfig.RpcConfig.RPC.Ports,
a.Index(), a.groupConfig.Discovery.RpcService.Group, &a.groupConfig.Share, a.groupConfig, group.Start, versionctx.EnableVersionCtx())
}
1 change: 1 addition & 0 deletions pkg/common/cmd/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,6 @@ func (a *MsgRpcCmd) Exec() error {

func (a *MsgRpcCmd) runE() error {
return startrpc.Start(a.ctx, &a.msgConfig.Discovery, &a.msgConfig.RpcConfig.Prometheus, a.msgConfig.RpcConfig.RPC.ListenIP,
a.msgConfig.RpcConfig.RPC.RegisterIP, a.msgConfig.RpcConfig.RPC.AutoSetPorts, a.msgConfig.RpcConfig.RPC.Ports,
a.Index(), a.msgConfig.Discovery.RpcService.Msg, &a.msgConfig.Share, a.msgConfig, msg.Start)
}
1 change: 1 addition & 0 deletions pkg/common/cmd/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,6 @@ func (a *PushRpcCmd) Exec() error {

func (a *PushRpcCmd) runE() error {
return startrpc.Start(a.ctx, &a.pushConfig.Discovery, &a.pushConfig.RpcConfig.Prometheus, a.pushConfig.RpcConfig.RPC.ListenIP,
a.pushConfig.RpcConfig.RPC.RegisterIP, a.pushConfig.RpcConfig.RPC.AutoSetPorts, a.pushConfig.RpcConfig.RPC.Ports,
a.Index(), a.pushConfig.Discovery.RpcService.Push, &a.pushConfig.Share, a.pushConfig, push.Start)
}
1 change: 1 addition & 0 deletions pkg/common/cmd/third.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,6 @@ func (a *ThirdRpcCmd) Exec() error {

func (a *ThirdRpcCmd) runE() error {
return startrpc.Start(a.ctx, &a.thirdConfig.Discovery, &a.thirdConfig.RpcConfig.Prometheus, a.thirdConfig.RpcConfig.RPC.ListenIP,
a.thirdConfig.RpcConfig.RPC.RegisterIP, a.thirdConfig.RpcConfig.RPC.AutoSetPorts, a.thirdConfig.RpcConfig.RPC.Ports,
a.Index(), a.thirdConfig.Discovery.RpcService.Third, &a.thirdConfig.Share, a.thirdConfig, third.Start)
}
1 change: 1 addition & 0 deletions pkg/common/cmd/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,6 @@ func (a *UserRpcCmd) Exec() error {

func (a *UserRpcCmd) runE() error {
return startrpc.Start(a.ctx, &a.userConfig.Discovery, &a.userConfig.RpcConfig.Prometheus, a.userConfig.RpcConfig.RPC.ListenIP,
a.userConfig.RpcConfig.RPC.RegisterIP, a.userConfig.RpcConfig.RPC.AutoSetPorts, a.userConfig.RpcConfig.RPC.Ports,
a.Index(), a.userConfig.Discovery.RpcService.User, &a.userConfig.Share, a.userConfig, user.Start)
}
Loading

0 comments on commit 69ccbb2

Please sign in to comment.