diff --git a/.golangci.yml b/.golangci.yml index c32d53fe1..6b8469b62 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -338,14 +338,36 @@ linters-settings: local-prefixes: github.com/openimsdk/open-im-server gomnd: - settings: - mnd: - # the list of enabled checks, see https://github.com/tommy-muehle/go-mnd/#checks for description. - # checks: - # ignored-numbers: 1000 - ignored-files: magic_.*.go, test_.*.go, .*_test.go - ignored-functions: math.* - + # List of enabled checks, see https://github.com/tommy-muehle/go-mnd/#checks for description. + # Default: ["argument", "case", "condition", "operation", "return", "assign"] + checks: + - argument + - case + - condition + - operation + - return + - assign + # List of numbers to exclude from analysis. + # The numbers should be written as string. + # Values always ignored: "1", "1.0", "0" and "0.0" + # Default: [] + ignored-numbers: + - '0666' + - '0755' + - '42' + # List of file patterns to exclude from analysis. + # Values always ignored: `.+_test.go` + # Default: [] + ignored-files: + - 'magic1_.+\.go$' + # List of function patterns to exclude from analysis. + # Following functions are always ignored: `time.Date`, + # `strconv.FormatInt`, `strconv.FormatUint`, `strconv.FormatFloat`, + # `strconv.ParseInt`, `strconv.ParseUint`, `strconv.ParseFloat`. + # Default: [] + ignored-functions: + - '^math\.' + - '^http\.StatusText$' gomoddirectives: # Allow local `replace` directives. Default is false. replace-local: true @@ -421,9 +443,6 @@ linters-settings: checks: [ "all" ] govet: - # report about shadowed variables - check-shadowing: false - # settings per analyzer settings: printf: # analyzer name, run `go tool vet help` to see all analyzers @@ -508,9 +527,6 @@ linters-settings: line-length: 250 # tab width in spaces. Default to 1. tab-width: 4 - maligned: - # print struct with more effective memory layout or not, false by default - suggest-new: true misspell: # Correct spellings using locale preferences for US or UK. # Default is to use a neutral variety of English. @@ -751,6 +767,7 @@ linters: - reassign - tparallel - unconvert + - fieldalignment - dupl - dupword - errname diff --git a/cmd/openim-rpc/openim-rpc-auth/main.go b/cmd/openim-rpc/openim-rpc-auth/main.go index 832b6b2f7..d00b2ad7d 100644 --- a/cmd/openim-rpc/openim-rpc-auth/main.go +++ b/cmd/openim-rpc/openim-rpc-auth/main.go @@ -28,4 +28,4 @@ func main() { program.ExitWithError(err) } -} +} \ No newline at end of file diff --git a/config/kafka-config.yaml b/config/kafka-config.yaml new file mode 100644 index 000000000..0fcdb0156 --- /dev/null +++ b/config/kafka-config.yaml @@ -0,0 +1,15 @@ +kafka: + username: '' + password: '' + addr: [ 172.28.0.1:19094 ] + latestMsgToRedis: + topic: "latestMsgToRedis" + offlineMsgToMongo: + topic: "offlineMsgToMongoMysql" + msgToPush: + topic: "msgToPush" + consumerGroupID: + msgToRedis: redis + msgToMongo: mongo + msgToMySql: mysql + msgToPush: push diff --git a/config/mongo-config.yaml b/config/mongo-config.yaml new file mode 100644 index 000000000..1ac9740c7 --- /dev/null +++ b/config/mongo-config.yaml @@ -0,0 +1,7 @@ +mongo: + uri: '' + address: [ 172.28.0.1:37017 ] + database: openim_v3 + username: openIM + password: openIM123 + maxPoolSize: 100 diff --git a/config/object-storage-config.yaml b/config/object-storage-config.yaml new file mode 100644 index 000000000..fdf42b6b2 --- /dev/null +++ b/config/object-storage-config.yaml @@ -0,0 +1,40 @@ +object: + enable: "minio" + apiURL: "http://240e:47e:3060:8cc:f664:1fee:9c86:9455:10002" + minio: + bucket: "openim" + endpoint: "http://172.28.0.1:10005" + accessKeyID: "root" + secretAccessKey: "openIM123" + sessionToken: '' + signEndpoint: "http://240e:47e:3060:8cc:f664:1fee:9c86:9455:10005" + publicRead: false + cos: + bucketURL: https://temp-1252357374.cos.ap-chengdu.myqcloud.com + secretID: '' + secretKey: '' + sessionToken: '' + publicRead: false + oss: + endpoint: "https://oss-cn-chengdu.aliyuncs.com" + bucket: "demo-9999999" + bucketURL: "https://demo-9999999.oss-cn-chengdu.aliyuncs.com" + accessKeyID: '' + accessKeySecret: '' + sessionToken: '' + publicRead: false + kodo: + endpoint: "http://s3.cn-east-1.qiniucs.com" + bucket: "demo-9999999" + bucketURL: "http://your.domain.com" + accessKeyID: '' + accessKeySecret: '' + sessionToken: '' + publicRead: false + aws: + endpoint: "''" + region: "us-east-1" + bucket: "demo-9999999" + accessKeyID: '' + accessKeySecret: '' + publicRead: false diff --git a/config/openim-api.yml b/config/openim-api.yml new file mode 100644 index 000000000..3ebaa0f48 --- /dev/null +++ b/config/openim-api.yml @@ -0,0 +1,3 @@ +api: + openImApiPort: [ 10002 ] + listenIP: 0.0.0.0 diff --git a/config/openim-cmdutils.yml b/config/openim-cmdutils.yml new file mode 100644 index 000000000..d57b17b8e --- /dev/null +++ b/config/openim-cmdutils.yml @@ -0,0 +1,3 @@ +cmdUtils: + toolName: + configOption: value diff --git a/config/openim-crontask.yml b/config/openim-crontask.yml new file mode 100644 index 000000000..bdc2f9e1a --- /dev/null +++ b/config/openim-crontask.yml @@ -0,0 +1,3 @@ +cronTasks: + chatRecordsClearTime: "0 2 * * 3" + msgDestructTime: "0 2 * * *" diff --git a/config/openim-msggateway.yml b/config/openim-msggateway.yml new file mode 100644 index 000000000..e69de29bb diff --git a/config/openim-msgtransfer.yml b/config/openim-msgtransfer.yml new file mode 100644 index 000000000..e69de29bb diff --git a/config/openim-push.yml b/config/openim-push.yml new file mode 100644 index 000000000..b067924aa --- /dev/null +++ b/config/openim-push.yml @@ -0,0 +1,16 @@ +push: + enable: getui + geTui: + pushUrl: "https://restapi.getui.com/v2/$appId" + masterSecret: '' + appKey: '' + intent: '' + channelID: '' + channelName: '' + fcm: + serviceAccount: "x.json" + jpns: + appKey: '' + masterSecret: '' + pushUrl: '' + pushIntent: '' diff --git a/config/openim-rpc-auth.yml b/config/openim-rpc-auth.yml new file mode 100644 index 000000000..ec264ae37 --- /dev/null +++ b/config/openim-rpc-auth.yml @@ -0,0 +1,7 @@ +rpc: + registerIP: '' + listenIP: 0.0.0.0 +rpcPort: + openImAuthPort: [ 10160 ] +rpcRegisterName: + openImAuthName: Auth diff --git a/config/openim-rpc-conversation.yml b/config/openim-rpc-conversation.yml new file mode 100644 index 000000000..62e7f35c1 --- /dev/null +++ b/config/openim-rpc-conversation.yml @@ -0,0 +1,7 @@ +rpc: + registerIP: '' + listenIP: 0.0.0.0 +rpcPort: + openImConversationPort: [ 10180 ] +rpcRegisterName: + openImConversationName: Conversation diff --git a/config/openim-rpc-friend.yml b/config/openim-rpc-friend.yml new file mode 100644 index 000000000..c45c9c95f --- /dev/null +++ b/config/openim-rpc-friend.yml @@ -0,0 +1,7 @@ +rpc: + registerIP: '' + listenIP: 0.0.0.0 +rpcPort: + openImFriendPort: [ 10120 ] +rpcRegisterName: + openImFriendName: Friend diff --git a/config/openim-rpc-group.yml b/config/openim-rpc-group.yml new file mode 100644 index 000000000..e7825502c --- /dev/null +++ b/config/openim-rpc-group.yml @@ -0,0 +1,7 @@ +rpc: + registerIP: '' + listenIP: 0.0.0.0 +rpcPort: + openImGroupPort: [ 10150 ] +rpcRegisterName: + openImGroupName: Group diff --git a/config/openim-rpc-msg.yml b/config/openim-rpc-msg.yml new file mode 100644 index 000000000..1bb324f2f --- /dev/null +++ b/config/openim-rpc-msg.yml @@ -0,0 +1,7 @@ +rpc: + registerIP: '' + listenIP: 0.0.0.0 +rpcPort: + openImMessagePort: [ 10130 ] +rpcRegisterName: + openImMsgName: Msg diff --git a/config/openim-rpc-third.yml b/config/openim-rpc-third.yml new file mode 100644 index 000000000..e6bc56f46 --- /dev/null +++ b/config/openim-rpc-third.yml @@ -0,0 +1,7 @@ +rpc: + registerIP: '' + listenIP: 0.0.0.0 +rpcPort: + openImThirdPort: [ 10190 ] +rpcRegisterName: + openImThirdName: Third diff --git a/config/openim-rpc-user.yml b/config/openim-rpc-user.yml new file mode 100644 index 000000000..183139c9e --- /dev/null +++ b/config/openim-rpc-user.yml @@ -0,0 +1,7 @@ +rpc: + registerIP: '' + listenIP: 0.0.0.0 +rpcPort: + openImUserPort: [ 10110 ] +rpcRegisterName: + openImUserName: User diff --git a/config/redis-config.yaml b/config/redis-config.yaml new file mode 100644 index 000000000..8f774ce37 --- /dev/null +++ b/config/redis-config.yaml @@ -0,0 +1,4 @@ +redis: + address: [ 172.28.0.1:16379 ] + username: '' + password: openIM123 diff --git a/config/templates/config.yaml.template b/config/templates/config.yaml.template index 03413c595..0e67b4668 100644 --- a/config/templates/config.yaml.template +++ b/config/templates/config.yaml.template @@ -1,24 +1,3 @@ -# Copyright © 2023 OpenIM. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the License); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# ----------------------------------------------------------------- -# TODO: This config file is the template file -# --| source: deployments/templates/config.yaml -# --| env: scripts/install/environment -# --| target: config/config.yaml -# ----------------------------------------------------------------- - envs: discovery: zookeeper @@ -122,14 +101,14 @@ api: # minio.signEndpoint is minio public network address object: enable: "minio" - apiURL: "http://172.28.0.1:10002" + apiURL: "http://240e:47e:3060:8cc:f664:1fee:9c86:9455:10002" minio: bucket: "openim" endpoint: "http://172.28.0.1:10005" accessKeyID: "root" secretAccessKey: "openIM123" sessionToken: '' - signEndpoint: "http://172.28.0.1:10005" + signEndpoint: "http://240e:47e:3060:8cc:f664:1fee:9c86:9455:10005" publicRead: false cos: bucketURL: https://temp-1252357374.cos.ap-chengdu.myqcloud.com @@ -154,8 +133,8 @@ object: sessionToken: '' publicRead: false aws: - endpoint: "" - region: "" + endpoint: "''" # This might not be necessary unless you're using a custom endpoint + region: "us-east-1" bucket: "demo-9999999" accessKeyID: '' accessKeySecret: '' @@ -200,7 +179,7 @@ rpcRegisterName: # Whether to output in json format # Whether to include stack trace in logs log: - storageLocation: /workspaces/open-im-server/logs/ + storageLocation: /data/workspaces/open-im-server/_output/logs/ rotationTime: 24 remainRotationCount: 2 remainLogLevel: 6 @@ -250,9 +229,10 @@ push: # # Built-in app manager user IDs # Built-in app manager nicknames +# Attention, this configure is discarded. If you have used him before, configure your own manager: - userID: [ "openIM123456", "openIM654321", "openIMAdmin" ] - nickname: [ "system1", "system2", "system3" ] + userID: + nickname: # chatAdmin, use for send notification # @@ -336,7 +316,7 @@ callback: timeout: 5 failedContinue: true afterSendSingleMsg: - enable: true + enable: false timeout: 5 failedContinue: true beforeSendGroupMsg: @@ -521,7 +501,7 @@ callback: # The number of ports needs to be consistent with msg_transfer_service_num in script/path_info.sh prometheus: enable: true - grafanaUrl: http://172.28.0.1:13000/ + grafanaUrl: http://240e:47e:3060:8cc:f664:1fee:9c86:9455:13000/ apiPrometheusPort: [20100] userPrometheusPort: [ 20110 ] friendPrometheusPort: [ 20120 ] @@ -534,3 +514,39 @@ prometheus: rtcPrometheusPort: [ 21300 ] thirdPrometheusPort: [ 21301 ] messageTransferPrometheusPort: [ 21400, 21401, 21402, 21403 ] # List of ports + +###################### LocalCache configuration information ###################### +# topic: redis subscriber channel +# slotNum: number of slots, multiple slots can prevent too many keys from competing for a lock +# slotSize: number of slots, the number of cached keys per slot, the overall cache quantity is slotNum * slotSize +# successExpire: successful cache time seconds +# failedExpire: failed cache time seconds +# disable local caching and annotate topic, slotNum, and slotSize +localCache: + user: + topic: DELETE_CACHE_USER + slotNum: 100 + slotSize: 2000 + successExpire: 300 + failedExpire: 5 + + group: + topic: DELETE_CACHE_GROUP + slotNum: 100 + slotSize: 2000 + successExpire: 300 + failedExpire: 5 + + friend: + topic: DELETE_CACHE_FRIEND + slotNum: 100 + slotSize: 2000 + successExpire: 300 + failedExpire: 5 + + conversation: + topic: DELETE_CACHE_CONVERSATION + slotNum: 100 + slotSize: 2000 + successExpire: 300 + failedExpire: 5 diff --git a/config/templates/env.template b/config/templates/env.template index 7a095b2bb..1d8d61aa0 100644 --- a/config/templates/env.template +++ b/config/templates/env.template @@ -25,7 +25,7 @@ # Data storage directory for persistent data. # Example: DATA_DIR=/path/to/data -DATA_DIR=/workspaces/open-im-server +DATA_DIR=/data/workspaces/open-im-server # Docker image registry. Uncomment the preferred one. # Options: ghcr.io/openimsdk, openim, registry.cn-hangzhou.aliyuncs.com/openimsdk @@ -91,7 +91,7 @@ ALERT_MANAGER_NETWORK_ADDRESS=172.28.0.14 # ============================================================================== # Local IP address of the service. Modify if necessary. # Example: OPENIM_IP=172.28.0.1, -OPENIM_IP=172.28.0.1 +OPENIM_IP=240e:47e:3060:8cc:f664:1fee:9c86:9455 # ----- ZooKeeper Configuration ----- # Port for ZooKeeper service. @@ -100,7 +100,7 @@ ZOOKEEPER_PORT=12181 # MongoDB service port configuration. # Default: MONGO_PORT=37017 -# MONGO_PORT=37017 +MONGO_PORT=37017 # Password for MongoDB admin user. Used for service authentication. # Default: MONGO_PASSWORD=openIM123 @@ -143,7 +143,7 @@ KAFKA_LATESTMSG_REDIS_TOPIC=latestMsgToRedis # MINIO_PORT # ---------- # MINIO_PORT sets the port for the MinIO object storage service. -# Upon changing this port, the MinIO endpoint URLs in the file must be updated +# Upon changing this port, the MinIO endpoint URLs in the config/config.yaml file must be updated # to reflect this change. The endpoints include both the 'endpoint' and 'signEndpoint' # under the MinIO configuration. # diff --git a/config/zookeeper-config.yaml b/config/zookeeper-config.yaml new file mode 100644 index 000000000..74d6c4550 --- /dev/null +++ b/config/zookeeper-config.yaml @@ -0,0 +1,5 @@ +zookeeper: + schema: openim + address: [ 172.28.0.1:12181 ] + username: '' + password: '' diff --git a/scripts/start-all.sh b/scripts/start-all.sh index 3b95dace1..acc926f59 100755 --- a/scripts/start-all.sh +++ b/scripts/start-all.sh @@ -73,7 +73,6 @@ openim::log::status "Start the pre-start tools:" # exit 1 # fi - openim::log::colorless "pre-start has been successfully completed!" result=$("${OPENIM_ROOT}"/scripts/stop-all.sh)