diff --git a/cmd/api/Makefile b/cmd/api/Makefile index 1f96bca5a..31ad8d958 100644 --- a/cmd/api/Makefile +++ b/cmd/api/Makefile @@ -7,7 +7,7 @@ BIN_DIR=../../bin/ all: gotool build build: - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o ${BINARY_NAME} run: @go run ./ diff --git a/cmd/cmdutils/Makefile b/cmd/cmdutils/Makefile index 7f0bcbbe5..0693a4a93 100644 --- a/cmd/cmdutils/Makefile +++ b/cmd/cmdutils/Makefile @@ -7,7 +7,7 @@ BIN_DIR=../../bin/ all: gotool build build: - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o ${BINARY_NAME} run: @go run ./ diff --git a/cmd/crontask/Makefile b/cmd/crontask/Makefile index e14b3da77..aca29a89d 100644 --- a/cmd/crontask/Makefile +++ b/cmd/crontask/Makefile @@ -6,7 +6,7 @@ BIN_DIR=../../bin/ all: gotool build build: - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o ${BINARY_NAME} run: @go run ./ diff --git a/cmd/msggateway/Makefile b/cmd/msggateway/Makefile index 566d8d9c2..c4e807d5d 100644 --- a/cmd/msggateway/Makefile +++ b/cmd/msggateway/Makefile @@ -6,7 +6,7 @@ BIN_DIR=../../bin/ all: gotool build build: - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o ${BINARY_NAME} run: @go run ./ diff --git a/cmd/msgtransfer/Makefile b/cmd/msgtransfer/Makefile index 6a67b9bee..783ad93c7 100644 --- a/cmd/msgtransfer/Makefile +++ b/cmd/msgtransfer/Makefile @@ -7,7 +7,7 @@ BIN_DIR=../../bin/ all: gotool build build: - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o ${BINARY_NAME} run: @go run ./ diff --git a/cmd/push/Makefile b/cmd/push/Makefile index df7b9e88a..6f0e394a3 100644 --- a/cmd/push/Makefile +++ b/cmd/push/Makefile @@ -6,7 +6,7 @@ BIN_DIR=../../bin/ all: gotool build build: - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o ${BINARY_NAME} run: @go run ./ diff --git a/cmd/rpc/auth/Makefile b/cmd/rpc/auth/Makefile index da280c3b5..4f5e00dad 100644 --- a/cmd/rpc/auth/Makefile +++ b/cmd/rpc/auth/Makefile @@ -6,7 +6,7 @@ BIN_DIR=../../../bin/ all: gotool build build: - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o ${BINARY_NAME} run: @go run ./ diff --git a/cmd/rpc/conversation/Makefile b/cmd/rpc/conversation/Makefile index c1a5578bc..384e66d7e 100644 --- a/cmd/rpc/conversation/Makefile +++ b/cmd/rpc/conversation/Makefile @@ -6,7 +6,7 @@ BIN_DIR=../../../bin/ all: gotool build build: - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o ${BINARY_NAME} run: @go run ./ diff --git a/cmd/rpc/friend/Makefile b/cmd/rpc/friend/Makefile index c47cbcf1d..082f52724 100644 --- a/cmd/rpc/friend/Makefile +++ b/cmd/rpc/friend/Makefile @@ -6,7 +6,7 @@ BIN_DIR=../../../bin/ all: gotool build build: - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o ${BINARY_NAME} run: @go run ./ diff --git a/cmd/rpc/group/Makefile b/cmd/rpc/group/Makefile index e7d1cb29d..bc9f319cc 100644 --- a/cmd/rpc/group/Makefile +++ b/cmd/rpc/group/Makefile @@ -6,7 +6,7 @@ BIN_DIR=../../../bin/ all: gotool build build: - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o ${BINARY_NAME} run: @go run ./ diff --git a/cmd/rpc/msg/Makefile b/cmd/rpc/msg/Makefile index 7214d3fe1..c4d82d1f4 100644 --- a/cmd/rpc/msg/Makefile +++ b/cmd/rpc/msg/Makefile @@ -6,7 +6,7 @@ BIN_DIR=../../../bin/ all: gotool build build: - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o ${BINARY_NAME} run: @go run ./ diff --git a/cmd/rpc/third/Makefile b/cmd/rpc/third/Makefile new file mode 100644 index 000000000..8f3b85cb9 --- /dev/null +++ b/cmd/rpc/third/Makefile @@ -0,0 +1,25 @@ +.PHONY: all build run gotool install clean help + +BINARY_NAME=open_im_third +BIN_DIR=../../../bin/ + +all: gotool build + +build: + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o ${BINARY_NAME} + +run: + @go run ./ + +gotool: + go fmt ./ + go vet ./ + +install: + make build + mv ${BINARY_NAME} ${BIN_DIR} + +clean: + @if [ -f ${BINARY_NAME} ] ; then rm ${BINARY_NAME} ; fi + + diff --git a/cmd/rpc/third/main.go b/cmd/rpc/third/main.go index 16ef29073..d5409a8c8 100644 --- a/cmd/rpc/third/main.go +++ b/cmd/rpc/third/main.go @@ -10,7 +10,7 @@ func main() { if err := config.InitConfig(); err != nil { panic(err.Error()) } - if err := startrpc.Start(config.Config.RpcPort.OpenImUserPort[0], config.Config.RpcRegisterName.OpenImUserName, config.Config.Prometheus.UserPrometheusPort[0], third.Start); err != nil { + if err := startrpc.Start(config.Config.RpcPort.OpenImThirdPort[0], config.Config.RpcRegisterName.OpenImThirdName, config.Config.Prometheus.ThirdPrometheusPort[0], third.Start); err != nil { panic(err.Error()) } } diff --git a/cmd/rpc/user/Makefile b/cmd/rpc/user/Makefile index c379db284..df561075c 100644 --- a/cmd/rpc/user/Makefile +++ b/cmd/rpc/user/Makefile @@ -6,7 +6,7 @@ BIN_DIR=../../../bin/ all: gotool build build: - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o ${BINARY_NAME} run: @go run ./ diff --git a/config/config.yaml b/config/config.yaml index d4da27081..e6282ec15 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -80,16 +80,6 @@ rpcRegisterIP: #默认即可 listenIP: 0.0.0.0 -# endpoints 内部组件间访问的端点host名称,访问时,可以内部直接访问 host:port 来访问 -endpoints: - api: openim_api - push: openim_push - msg_gateway: openim_msg_gateway - rpc_auth: openim_rpc_auth - rpc_friend: openim_rpc_friend - rpc_group: openim_rpc_group - rpc_msg: openim_rpc_msg - rpc_user: openim_rpc_user api: openImApiPort: [ 10002 ] #api服务端口,默认即可,需要开放此端口或做nginx转发 @@ -149,9 +139,9 @@ rpcport: #rpc服务端口 默认即可 openImGroupPort: [ 10150 ] openImAuthPort: [ 10160 ] openImPushPort: [ 10170 ] - openImConversationPort: [ 10230 ] - openImRtcPort: [ 11300 ] - + openImConversationPort: [ 10180 ] + openImRtcPort: [ 10190 ] + openImThirdPort : [ 10200 ] rpcregistername: #rpc注册服务名,默认即可 openImUserName: User @@ -163,6 +153,7 @@ rpcregistername: #rpc注册服务名,默认即可 openImAuthName: Auth openImConversationName: Conversation openImRtcName: Rtc + openImThirdName: Third log: storageLocation: ../logs/ @@ -326,5 +317,5 @@ prometheus: authPrometheusPort: [ 20160 ] pushPrometheusPort: [ 20170 ] conversationPrometheusPort: [ 20230 ] - RtcPrometheusPort: [ 21300 ] + rtcPrometheusPort: [ 21300 ] messageTransferPrometheusPort: [ 21400, 21401, 21402, 21403 ] # 端口数量和 script/path_info.cfg msg_transfer_service_num保持一致 diff --git a/pkg/common/config/config.go b/pkg/common/config/config.go index 76165666d..f2382ba23 100644 --- a/pkg/common/config/config.go +++ b/pkg/common/config/config.go @@ -152,6 +152,7 @@ type config struct { OpenImConversationPort []int `yaml:"openImConversationPort"` OpenImCachePort []int `yaml:"openImCachePort"` OpenImRtcPort []int `yaml:"openImRtcPort"` + OpenImThirdPort []int `yaml:"openImThirdPort"` } RpcRegisterName struct { OpenImUserName string `yaml:"openImUserName"` @@ -301,8 +302,9 @@ type config struct { AuthPrometheusPort []int `yaml:"authPrometheusPort"` PushPrometheusPort []int `yaml:"pushPrometheusPort"` ConversationPrometheusPort []int `yaml:"conversationPrometheusPort"` - RtcPrometheusPort []int `yaml:"RtcPrometheusPort"` + RtcPrometheusPort []int `yaml:"rtcPrometheusPort"` MessageTransferPrometheusPort []int `yaml:"messageTransferPrometheusPort"` + ThirdPrometheusPort []int `yaml:"thirdPrometheusPort"` } `yaml:"prometheus"` } diff --git a/script/path_info.cfg b/script/path_info.cfg index f2c3c8c60..b32483725 100644 --- a/script/path_info.cfg +++ b/script/path_info.cfg @@ -46,6 +46,7 @@ service_source_root=( ../cmd/rpc/group/ ../cmd/rpc/auth/ ../cmd/rpc/conversation/ + ../cmd/rpc/third/ ../cmd/crontask ../cmd/cmdutils # ${msg_gateway_source_root} @@ -64,6 +65,7 @@ service_names=( open_im_group open_im_auth open_im_conversation + open_im_third open_im_cron_task open_im_cmd_utils ${msg_gateway_name} diff --git a/script/start_rpc_service.sh b/script/start_rpc_service.sh index eaeff132a..4f8f22508 100644 --- a/script/start_rpc_service.sh +++ b/script/start_rpc_service.sh @@ -15,6 +15,7 @@ service_filename=( open_im_auth ${msg_name} open_im_conversation + open_im_third ) #service config port name @@ -28,6 +29,7 @@ service_port_name=( openImAuthPort openImMessagePort openImConversationPort + openImThirdPort ) service_prometheus_port_name=( @@ -40,6 +42,7 @@ service_prometheus_port_name=( authPrometheusPort messagePrometheusPort conversationPrometheusPort + thirdPrometheusPort ) for ((i = 0; i < ${#service_filename[*]}; i++)); do