mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-10-28 22:58:10 +08:00
feat: add all options
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
This commit is contained in:
parent
b02d65bf9a
commit
84c7cc1801
@ -1,15 +0,0 @@
|
||||
[Unit]
|
||||
Description=OPENIM OPENIM RPC CONVERSATION
|
||||
Documentation=https://github.com/OpenIMSDK/Open-IM-Server/blob/main/deployment/init/README.md
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=${OPENIM_DATA_DIR}/openim-rpc-conversation
|
||||
ExecStartPre=/usr/bin/mkdir -p ${OPENIM_DATA_DIR}/openim-rpc-conversation
|
||||
ExecStartPre=/usr/bin/mkdir -p ${OPENIM_LOG_DIR}
|
||||
ExecStart=${OPENIM_INSTALL_DIR}/bin/openim-rpc-conversation --config=${OPENIM_CONFIG_DIR}/openim-rpc-conversation.yaml
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
StartLimitInterval=0
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@ -1,15 +0,0 @@
|
||||
[Unit]
|
||||
Description=OPENIM OPENIM RPC FRIEND
|
||||
Documentation=https://github.com/OpenIMSDK/Open-IM-Server/blob/main/deployment/init/README.md
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=${OPENIM_DATA_DIR}/openim-rpc-friend
|
||||
ExecStartPre=/usr/bin/mkdir -p ${OPENIM_DATA_DIR}/openim-rpc-friend
|
||||
ExecStartPre=/usr/bin/mkdir -p ${OPENIM_LOG_DIR}
|
||||
ExecStart=${OPENIM_INSTALL_DIR}/bin/openim-rpc-friend --config=${OPENIM_CONFIG_DIR}/openim-rpc-friend.yaml
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
StartLimitInterval=0
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@ -1,15 +0,0 @@
|
||||
[Unit]
|
||||
Description=OPENIM OPENIM RPC GROUP
|
||||
Documentation=https://github.com/OpenIMSDK/Open-IM-Server/blob/main/deployment/init/README.md
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=${OPENIM_DATA_DIR}/openim-rpc-group
|
||||
ExecStartPre=/usr/bin/mkdir -p ${OPENIM_DATA_DIR}/openim-rpc-group
|
||||
ExecStartPre=/usr/bin/mkdir -p ${OPENIM_LOG_DIR}
|
||||
ExecStart=${OPENIM_INSTALL_DIR}/bin/openim-rpc-group --config=${OPENIM_CONFIG_DIR}/openim-rpc-group.yaml
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
StartLimitInterval=0
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@ -1,15 +0,0 @@
|
||||
[Unit]
|
||||
Description=OPENIM OPENIM RPC MSG
|
||||
Documentation=https://github.com/OpenIMSDK/Open-IM-Server/blob/main/deployment/init/README.md
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=${OPENIM_DATA_DIR}/openim-rpc-msg
|
||||
ExecStartPre=/usr/bin/mkdir -p ${OPENIM_DATA_DIR}/openim-rpc-msg
|
||||
ExecStartPre=/usr/bin/mkdir -p ${OPENIM_LOG_DIR}
|
||||
ExecStart=${OPENIM_INSTALL_DIR}/bin/openim-rpc-msg --config=${OPENIM_CONFIG_DIR}/openim-rpc-msg.yaml
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
StartLimitInterval=0
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@ -1,15 +0,0 @@
|
||||
[Unit]
|
||||
Description=OPENIM OPENIM RPC THIRD
|
||||
Documentation=https://github.com/OpenIMSDK/Open-IM-Server/blob/main/deployment/init/README.md
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=${OPENIM_DATA_DIR}/openim-rpc-third
|
||||
ExecStartPre=/usr/bin/mkdir -p ${OPENIM_DATA_DIR}/openim-rpc-third
|
||||
ExecStartPre=/usr/bin/mkdir -p ${OPENIM_LOG_DIR}
|
||||
ExecStart=${OPENIM_INSTALL_DIR}/bin/openim-rpc-third --config=${OPENIM_CONFIG_DIR}/openim-rpc-third.yaml
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
StartLimitInterval=0
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@ -1,15 +0,0 @@
|
||||
[Unit]
|
||||
Description=OPENIM OPENIM RPC USER
|
||||
Documentation=https://github.com/OpenIMSDK/Open-IM-Server/blob/main/deployment/init/README.md
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=${OPENIM_DATA_DIR}/openim-rpc-user
|
||||
ExecStartPre=/usr/bin/mkdir -p ${OPENIM_DATA_DIR}/openim-rpc-user
|
||||
ExecStartPre=/usr/bin/mkdir -p ${OPENIM_LOG_DIR}
|
||||
ExecStart=${OPENIM_INSTALL_DIR}/bin/openim-rpc-user --config=${OPENIM_CONFIG_DIR}/openim-rpc-user.yaml
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
StartLimitInterval=0
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@ -1,17 +0,0 @@
|
||||
# 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.
|
||||
|
||||
name: openim-cmdutils
|
||||
description: "This is a description for openim-cmdutils"
|
||||
type: "service"
|
||||
@ -1,384 +0,0 @@
|
||||
# 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.
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# This config file is the template file
|
||||
# --| source: scripts/template/config-tmpl/config.yaml
|
||||
# --| env: scripts/install/environment.sh
|
||||
# --| target: config/config.yaml
|
||||
# -----------------------------------------------------------------
|
||||
|
||||
###################### Zookeeper ######################
|
||||
# Zookeeper configuration
|
||||
# It's not recommended to modify the schema
|
||||
#
|
||||
# Zookeeper address
|
||||
# Zookeeper username
|
||||
# Zookeeper password
|
||||
zookeeper:
|
||||
schema: "openim"
|
||||
address: [ "127.0.0.1:2181" ]
|
||||
username: ""
|
||||
password: ""
|
||||
|
||||
###################### Mysql ######################
|
||||
# MySQL configuration
|
||||
# Currently, only single machine setup is supported
|
||||
#
|
||||
# Maximum number of open connections
|
||||
# Maximum number of idle connections
|
||||
# Maximum lifetime in seconds a connection can be reused
|
||||
# Log level: 1=slient, 2=error, 3=warn, 4=info
|
||||
# Slow query threshold in milliseconds
|
||||
mysql:
|
||||
address: [ "127.0.0.1:13306" ]
|
||||
username: "root"
|
||||
password: "openIM123"
|
||||
database: "openIM_v3"
|
||||
maxOpenConn: "1000"
|
||||
maxIdleConn: "100"
|
||||
maxLifeTime: "60"
|
||||
logLevel: "4"
|
||||
slowThreshold: "500"
|
||||
|
||||
###################### Mongo ######################
|
||||
# MongoDB configuration
|
||||
# If uri is not empty, it will be used directly
|
||||
#
|
||||
# MongoDB address for standalone setup, Mongos address for sharded cluster setup
|
||||
# Default MongoDB database name
|
||||
# Maximum connection pool size
|
||||
mongo:
|
||||
uri: ""
|
||||
address: [ "127.0.0.1:37017" ]
|
||||
database: "openIM_v3"
|
||||
username: "root"
|
||||
password: "openIM123"
|
||||
maxPoolSize: "100"
|
||||
|
||||
###################### Redis configuration information ######################
|
||||
# Redis configuration
|
||||
#
|
||||
# Username is required only for Redis version 6.0+
|
||||
redis:
|
||||
address: [ "127.0.0.1:16379" ]
|
||||
username: ""
|
||||
password: "openIM123"
|
||||
|
||||
###################### Kafka configuration information ######################
|
||||
# Kafka configuration
|
||||
#
|
||||
# Kafka username
|
||||
# Kafka password
|
||||
# It's not recommended to modify this topic name
|
||||
# Consumer group ID, it's not recommended to modify
|
||||
kafka:
|
||||
username: ""
|
||||
password: ""
|
||||
addr: [ "127.0.0.1:9092" ]
|
||||
latestMsgToRedis:
|
||||
topic: "latestMsgToRedis"
|
||||
offlineMsgToMongo:
|
||||
topic: "offlineMsgToMongoMysql"
|
||||
msgToPush:
|
||||
topic: "msgToPush"
|
||||
consumerGroupID:
|
||||
msgToRedis: "redis"
|
||||
msgToMongo: "mongo"
|
||||
msgToMySql: "mysql"
|
||||
msgToPush: "push"
|
||||
|
||||
###################### RPC configuration information ######################
|
||||
# RPC configuration
|
||||
#
|
||||
# IP address to register with zookeeper when starting RPC, the IP and corresponding rpcPort should be accessible by api/gateway
|
||||
# Default listen IP is 0.0.0.0
|
||||
rpc:
|
||||
registerIP: ""
|
||||
listenIP: "0.0.0.0"
|
||||
|
||||
###################### API configuration information ######################
|
||||
# API configuration
|
||||
#
|
||||
# API service port
|
||||
# Default listen IP is 0.0.0.0
|
||||
api:
|
||||
openImApiPort: [ "10002" ]
|
||||
listenIP: "0.0.0.0"
|
||||
|
||||
###################### Object configuration information ######################
|
||||
# Object storage configuration
|
||||
#
|
||||
# Use minio for object storage
|
||||
# API URL should be accessible by the app
|
||||
# It's not recommended to modify the bucket name
|
||||
# Endpoint should be accessible by the app
|
||||
# Session token
|
||||
# Configuration for Tencent COS
|
||||
# Configuration for Aliyun OSS
|
||||
# It can be set by an environment variable or by a script
|
||||
object:
|
||||
enable: "minio"
|
||||
apiURL: "http://127.0.0.1:10002/object/"
|
||||
minio:
|
||||
bucket: "openim"
|
||||
endpoint: "http://113.90.83.134:10005"
|
||||
accessKeyID: "root"
|
||||
secretAccessKey: "openIM123"
|
||||
sessionToken: ""
|
||||
cos:
|
||||
bucketURL: "https://temp-1252357374.cos.ap-chengdu.myqcloud.com"
|
||||
secretID: ""
|
||||
secretKey: ""
|
||||
sessionToken: ""
|
||||
oss:
|
||||
endpoint: "https://oss-cn-chengdu.aliyuncs.com"
|
||||
bucket: "demo-9999999"
|
||||
bucketURL: "https://demo-9999999.oss-cn-chengdu.aliyuncs.com"
|
||||
accessKeyID: "root"
|
||||
accessKeySecret: ""
|
||||
sessionToken: ""
|
||||
|
||||
|
||||
###################### RPC Port Configuration ######################
|
||||
# RPC service ports
|
||||
# These ports are passed into the program by the script and are not recommended to modify
|
||||
# For launching multiple programs, just fill in multiple ports separated by commas
|
||||
# For example, [10110, 10111]
|
||||
rpcPort:
|
||||
openImUserPort: [ "10110" ]
|
||||
openImFriendPort: [ "10120" ]
|
||||
openImMessagePort: [ "10130" ]
|
||||
openImMessageGatewayPort: [ "10140" ]
|
||||
openImGroupPort: [ "10150" ]
|
||||
openImAuthPort: [ "10160" ]
|
||||
openImPushPort: [ "10170" ]
|
||||
openImConversationPort: [ "10180" ]
|
||||
openImThirdPort: [ "10190" ]
|
||||
|
||||
###################### RPC Register Name Configuration ######################
|
||||
# RPC service names for registration, it's not recommended to modify these
|
||||
rpcRegisterName:
|
||||
openImUserName: "User"
|
||||
openImFriendName: "Friend"
|
||||
openImMsgName: "Msg"
|
||||
openImPushName: "Push"
|
||||
openImMessageGatewayName: "MessageGateway"
|
||||
openImGroupName: "Group"
|
||||
openImAuthName: "Auth"
|
||||
openImConversationName: "Conversation"
|
||||
openImThirdName: "Third"
|
||||
|
||||
###################### Log Configuration ######################
|
||||
# Log configuration
|
||||
#
|
||||
# Storage directory
|
||||
# Log rotation time
|
||||
# Maximum number of logs to retain
|
||||
# Log level, 6 means all levels
|
||||
# Whether to output to stdout
|
||||
# Whether to output in json format
|
||||
# Whether to include stack trace in logs
|
||||
log:
|
||||
storageLocation: "/root/workspaces/openim/openim-server/log/"
|
||||
rotationTime: 24
|
||||
remainRotationCount: 2
|
||||
remainLogLevel: 6
|
||||
isStdout: false
|
||||
isJson: false
|
||||
withStack: false
|
||||
|
||||
###################### Variables definition ######################
|
||||
# Long connection server configuration
|
||||
#
|
||||
# Websocket port for msg_gateway
|
||||
# Maximum number of websocket connections
|
||||
# Maximum length of websocket request package
|
||||
# Websocket connection handshake timeout
|
||||
longConnSvr:
|
||||
openImWsPort: [ "10001" ]
|
||||
websocketMaxConnNum: 100000
|
||||
websocketMaxMsgLen: 4096
|
||||
websocketTimeout: 10
|
||||
|
||||
# Push notification service configuration
|
||||
#
|
||||
# Use GeTui for push notifications
|
||||
# GeTui offline push configuration
|
||||
# FCM offline push configuration
|
||||
# Account file, place it in the config directory
|
||||
# JPush configuration, modify these after applying in JPush backend
|
||||
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: ""
|
||||
|
||||
# App manager configuration
|
||||
#
|
||||
# Built-in app manager user IDs
|
||||
# Built-in app manager nicknames
|
||||
manager:
|
||||
userID: [ "openIM123456", "openIM654321", "openIMAdmin" ]
|
||||
nickname: [ "system1", "system2", "system3" ]
|
||||
|
||||
# Multi-platform login policy
|
||||
# For each platform(Android, iOS, Windows, Mac, web), only one can be online at a time
|
||||
multiLoginPolicy: 1
|
||||
|
||||
# Whether to store messages in MySQL, messages in MySQL are only used for management background
|
||||
chatPersistenceMysql: true
|
||||
|
||||
# Message cache timeout in seconds, it's not recommended to modify
|
||||
msgCacheTimeout: 86400
|
||||
|
||||
# Whether to enable read receipts for group chat
|
||||
groupMessageHasReadReceiptEnable: true
|
||||
|
||||
# Whether to enable read receipts for single chat
|
||||
singleMessageHasReadReceiptEnable: true
|
||||
|
||||
# MongoDB offline message retention period in days
|
||||
retainChatRecords: 365
|
||||
|
||||
# Schedule to clear expired messages(older than retainChatRecords days) in MongoDB every Wednesday at 2am
|
||||
# This deletion is just for cleaning up disk usage according to previous configuration retainChatRecords, no notification will be sent
|
||||
chatRecordsClearTime: "0 2 * * *"
|
||||
|
||||
# Schedule to auto delete messages every day at 2am
|
||||
# This deletion is for messages that have been retained for more than msg_destruct_time (seconds) in the conversation field
|
||||
msgDestructTime: "0 2 * * *"
|
||||
|
||||
# Secret key
|
||||
secret: "openIM123"
|
||||
|
||||
# Token policy
|
||||
#
|
||||
# Token expiration period in days
|
||||
tokenPolicy:
|
||||
expire: 90
|
||||
|
||||
# Message verification policy
|
||||
#
|
||||
# Whether to verify friendship when sending messages
|
||||
messageVerify:
|
||||
friendVerify: false
|
||||
|
||||
# iOS push notification configuration
|
||||
#
|
||||
# iOS push notification sound
|
||||
# Whether to count badge
|
||||
# Whether it's production environment
|
||||
iosPush:
|
||||
pushSound: "xxx"
|
||||
badgeCount: true
|
||||
production: false
|
||||
|
||||
###################### Third-party service configuration ######################
|
||||
# Callback configuration
|
||||
#
|
||||
# Callback URL
|
||||
# Whether to enable this callback event
|
||||
# Timeout in seconds
|
||||
# Whether to continue execution if callback fails
|
||||
callback:
|
||||
url:
|
||||
beforeSendSingleMsg:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
afterSendSingleMsg:
|
||||
enable: false
|
||||
timeout: 5
|
||||
beforeSendGroupMsg:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
afterSendGroupMsg:
|
||||
enable: false
|
||||
timeout: 5
|
||||
msgModify:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
userOnline:
|
||||
enable: false
|
||||
timeout: 5
|
||||
userOffline:
|
||||
enable: false
|
||||
timeout: 5
|
||||
userKickOff:
|
||||
enable: false
|
||||
timeout: 5
|
||||
offlinePush:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
onlinePush:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
superGroupOnlinePush:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
beforeAddFriend:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
beforeCreateGroup:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
beforeMemberJoinGroup:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
beforeSetGroupMemberInfo:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
setMessageReactionExtensions:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
|
||||
###################### Prometheus ######################
|
||||
# Prometheus configuration for various services
|
||||
# The number of Prometheus ports per service needs to correspond to rpcPort
|
||||
# The number of ports needs to be consistent with msg_transfer_service_num in script/path_info.sh
|
||||
prometheus:
|
||||
enable: "false"
|
||||
userPrometheusPort: [ "20110" ]
|
||||
friendPrometheusPort: [ "20120" ]
|
||||
messagePrometheusPort: [ "20130" ]
|
||||
messageGatewayPrometheusPort: [ "20140" ]
|
||||
groupPrometheusPort: [ "20150" ]
|
||||
authPrometheusPort: [ "20160" ]
|
||||
pushPrometheusPort: [ "20170" ]
|
||||
conversationPrometheusPort: [ "20230" ]
|
||||
rtcPrometheusPort: [ "21300" ]
|
||||
thirdPrometheusPort: [ "21301" ]
|
||||
messageTransferPrometheusPort: [ "21400, 21401, 21402, 21403" ] # List of ports
|
||||
@ -1,17 +0,0 @@
|
||||
# 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.
|
||||
|
||||
name: openim-msggateway
|
||||
description: "This is a description for openim-msggateway"
|
||||
type: "service"
|
||||
@ -1,17 +0,0 @@
|
||||
# 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.
|
||||
|
||||
name: openim-msgtransfer
|
||||
description: "This is a description for openim-msgtransfer"
|
||||
type: "service"
|
||||
@ -1,17 +0,0 @@
|
||||
# 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.
|
||||
|
||||
name: openim-push
|
||||
description: "This is a description for openim-push"
|
||||
type: "service"
|
||||
@ -1,17 +0,0 @@
|
||||
# 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.
|
||||
|
||||
name: openim-rpc-auth
|
||||
description: "This is a description for openim-rpc-auth"
|
||||
type: "service"
|
||||
@ -1,17 +0,0 @@
|
||||
# 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.
|
||||
|
||||
name: openim-rpc-conversation
|
||||
description: "This is a description for openim-rpc-conversation"
|
||||
type: "service"
|
||||
@ -1,17 +0,0 @@
|
||||
# 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.
|
||||
|
||||
name: openim-rpc-friend
|
||||
description: "This is a description for openim-rpc-friend"
|
||||
type: "service"
|
||||
@ -1,17 +0,0 @@
|
||||
# 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.
|
||||
|
||||
name: openim-rpc-group
|
||||
description: "This is a description for openim-rpc-group"
|
||||
type: "service"
|
||||
@ -1,17 +0,0 @@
|
||||
# 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.
|
||||
|
||||
name: openim-rpc-msg
|
||||
description: "This is a description for openim-rpc-msg"
|
||||
type: "service"
|
||||
@ -1,17 +0,0 @@
|
||||
# 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.
|
||||
|
||||
name: openim-rpc-third
|
||||
description: "This is a description for openim-rpc-third"
|
||||
type: "service"
|
||||
@ -1,17 +0,0 @@
|
||||
# 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.
|
||||
|
||||
name: openim-rpc-user
|
||||
description: "This is a description for openim-rpc-user"
|
||||
type: "service"
|
||||
@ -1,387 +0,0 @@
|
||||
# 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/openim.yaml
|
||||
# --| env: scripts/install/environment
|
||||
# --| target: config/config.yaml
|
||||
# -----------------------------------------------------------------
|
||||
|
||||
###################### Zookeeper ######################
|
||||
# Zookeeper configuration
|
||||
# It's not recommended to modify the schema
|
||||
#
|
||||
# Zookeeper address
|
||||
# Zookeeper username
|
||||
# Zookeeper password
|
||||
zookeeper:
|
||||
schema: ${ZOOKEEPER_SCHEMA}
|
||||
address: [ ${ZOOKEEPER_ADDRESS}:${ZOOKEEPER_PORT} ]
|
||||
username: ${ZOOKEEPER_USERNAME}
|
||||
password: ${ZOOKEEPER_PASSWORD}
|
||||
|
||||
###################### Mysql ######################
|
||||
# MySQL configuration
|
||||
# Currently, only single machine setup is supported
|
||||
#
|
||||
# Maximum number of open connections
|
||||
# Maximum number of idle connections
|
||||
# Maximum lifetime in seconds a connection can be reused
|
||||
# Log level: 1=slient, 2=error, 3=warn, 4=info
|
||||
# Slow query threshold in milliseconds
|
||||
mysql:
|
||||
address: [ ${MYSQL_ADDRESS}:${MYSQL_PORT} ]
|
||||
username: ${MYSQL_USERNAME}
|
||||
password: ${MYSQL_PASSWORD}
|
||||
database: ${MYSQL_DATABASE}
|
||||
maxOpenConn: ${MYSQL_MAX_OPEN_CONN}
|
||||
maxIdleConn: ${MYSQL_MAX_IDLE_CONN}
|
||||
maxLifeTime: ${MYSQL_MAX_LIFETIME}
|
||||
logLevel: ${MYSQL_LOG_LEVEL}
|
||||
slowThreshold: ${MYSQL_SLOW_THRESHOLD}
|
||||
|
||||
###################### Mongo ######################
|
||||
# MongoDB configuration
|
||||
# If uri is not empty, it will be used directly
|
||||
#
|
||||
# MongoDB address for standalone setup, Mongos address for sharded cluster setup
|
||||
# Default MongoDB database name
|
||||
# Maximum connection pool size
|
||||
mongo:
|
||||
uri: ${MONGO_URI}
|
||||
address: [ ${MONGO_ADDRESS}:${MONGO_PORT} ]
|
||||
database: ${MONGO_DATABASE}
|
||||
username: ${MONGO_USERNAME}
|
||||
password: ${MONGO_PASSWORD}
|
||||
maxPoolSize: ${MONGO_MAX_POOL_SIZE}
|
||||
|
||||
###################### Redis configuration information ######################
|
||||
# Redis configuration
|
||||
#
|
||||
# Username is required only for Redis version 6.0+
|
||||
redis:
|
||||
address: [ ${REDIS_ADDRESS}:${REDIS_PORT} ]
|
||||
username: ${REDIS_USERNAME}
|
||||
password: ${REDIS_PASSWORD}
|
||||
|
||||
###################### Kafka configuration information ######################
|
||||
# Kafka configuration
|
||||
#
|
||||
# Kafka username
|
||||
# Kafka password
|
||||
# It's not recommended to modify this topic name
|
||||
# Consumer group ID, it's not recommended to modify
|
||||
kafka:
|
||||
username: ${KAFKA_USERNAME}
|
||||
password: ${KAFKA_PASSWORD}
|
||||
addr: [ ${KAFKA_ADDR}:${KAFKA_PORT} ]
|
||||
latestMsgToRedis:
|
||||
topic: "${KAFKA_LATESTMSG_REDIS_TOPIC}"
|
||||
offlineMsgToMongo:
|
||||
topic: "${KAFKA_OFFLINEMSG_MONGO_TOPIC}"
|
||||
msgToPush:
|
||||
topic: "${KAFKA_MSG_PUSH_TOPIC}"
|
||||
consumerGroupID:
|
||||
msgToRedis: ${KAFKA_CONSUMERGROUPID_REDIS}
|
||||
msgToMongo: ${KAFKA_CONSUMERGROUPID_MONGO}
|
||||
msgToMySql: ${KAFKA_CONSUMERGROUPID_MYSQL}
|
||||
msgToPush: ${KAFKA_CONSUMERGROUPID_PUSH}
|
||||
|
||||
###################### RPC configuration information ######################
|
||||
# RPC configuration
|
||||
#
|
||||
# IP address to register with zookeeper when starting RPC, the IP and corresponding rpcPort should be accessible by api/gateway
|
||||
# Default listen IP is 0.0.0.0
|
||||
rpc:
|
||||
registerIP: ${RPC_REGISTER_IP}
|
||||
listenIP: ${RPC_LISTEN_IP}
|
||||
|
||||
###################### API configuration information ######################
|
||||
# API configuration
|
||||
#
|
||||
# API service port
|
||||
# Default listen IP is 0.0.0.0
|
||||
api:
|
||||
openImApiPort: [ ${API_OPENIM_PORT} ]
|
||||
listenIP: ${API_LISTEN_IP}
|
||||
|
||||
###################### Object configuration information ######################
|
||||
# Object storage configuration
|
||||
#
|
||||
# Use minio for object storage
|
||||
# API URL should be accessible by the app
|
||||
# It's not recommended to modify the bucket name
|
||||
# Endpoint should be accessible by the app
|
||||
# Session token
|
||||
# Configuration for Tencent COS
|
||||
# Configuration for Aliyun OSS
|
||||
# apiURL is the address of the api, the access address of the app, use s3 must be configured
|
||||
# minio.endpoint can be configured as an intranet address,
|
||||
# minio.signEndpoint is minio public network address
|
||||
object:
|
||||
enable: "${OBJECT_ENABLE}"
|
||||
apiURL: "${OBJECT_APIURL}"
|
||||
minio:
|
||||
bucket: "${MINIO_BUCKET}"
|
||||
endpoint: "${MINIO_ENDPOINT}"
|
||||
accessKeyID: "${MINIO_ACCESS_KEY}"
|
||||
secretAccessKey: "${MINIO_SECRET_KEY}"
|
||||
sessionToken: ${MINIO_SESSION_TOKEN}
|
||||
signEndpoint: "${MINIO_SIGN_ENDPOINT}"
|
||||
cos:
|
||||
bucketURL: ${COS_BUCKET_URL}
|
||||
secretID: ${COS_SECRET_ID}
|
||||
secretKey: ${COS_SECRET_KEY}
|
||||
sessionToken: ${COS_SESSION_TOKEN}
|
||||
oss:
|
||||
endpoint: "${OSS_ENDPOINT}"
|
||||
bucket: "${OSS_BUCKET}"
|
||||
bucketURL: "${OSS_BUCKET_URL}"
|
||||
accessKeyID: ${OSS_ACCESS_KEY_ID}
|
||||
accessKeySecret: ${OSS_ACCESS_KEY_SECRET}
|
||||
sessionToken: ${OSS_SESSION_TOKEN}
|
||||
|
||||
|
||||
###################### RPC Port Configuration ######################
|
||||
# RPC service ports
|
||||
# These ports are passed into the program by the script and are not recommended to modify
|
||||
# For launching multiple programs, just fill in multiple ports separated by commas
|
||||
# For example, [10110, 10111]
|
||||
rpcPort:
|
||||
openImUserPort: [ ${OPENIM_USER_PORT} ]
|
||||
openImFriendPort: [ ${OPENIM_FRIEND_PORT} ]
|
||||
openImMessagePort: [ ${OPENIM_MESSAGE_PORT} ]
|
||||
openImMessageGatewayPort: [ ${OPENIM_MESSAGE_GATEWAY_PORT} ]
|
||||
openImGroupPort: [ ${OPENIM_GROUP_PORT} ]
|
||||
openImAuthPort: [ ${OPENIM_AUTH_PORT} ]
|
||||
openImPushPort: [ ${OPENIM_PUSH_PORT} ]
|
||||
openImConversationPort: [ ${OPENIM_CONVERSATION_PORT} ]
|
||||
openImThirdPort: [ ${OPENIM_THIRD_PORT} ]
|
||||
|
||||
###################### RPC Register Name Configuration ######################
|
||||
# RPC service names for registration, it's not recommended to modify these
|
||||
rpcRegisterName:
|
||||
openImUserName: ${OPENIM_USER_NAME}
|
||||
openImFriendName: ${OPENIM_FRIEND_NAME}
|
||||
openImMsgName: ${OPENIM_MSG_NAME}
|
||||
openImPushName: ${OPENIM_PUSH_NAME}
|
||||
openImMessageGatewayName: ${OPENIM_MESSAGE_GATEWAY_NAME}
|
||||
openImGroupName: ${OPENIM_GROUP_NAME}
|
||||
openImAuthName: ${OPENIM_AUTH_NAME}
|
||||
openImConversationName: ${OPENIM_CONVERSATION_NAME}
|
||||
openImThirdName: ${OPENIM_THIRD_NAME}
|
||||
|
||||
###################### Log Configuration ######################
|
||||
# Log configuration
|
||||
#
|
||||
# Storage directory
|
||||
# Log rotation time
|
||||
# Maximum number of logs to retain
|
||||
# Log level, 6 means all levels
|
||||
# Whether to output to stdout
|
||||
# Whether to output in json format
|
||||
# Whether to include stack trace in logs
|
||||
log:
|
||||
storageLocation: ${LOG_STORAGE_LOCATION}
|
||||
rotationTime: ${LOG_ROTATION_TIME}
|
||||
remainRotationCount: ${LOG_REMAIN_ROTATION_COUNT}
|
||||
remainLogLevel: ${LOG_REMAIN_LOG_LEVEL}
|
||||
isStdout: ${LOG_IS_STDOUT}
|
||||
isJson: ${LOG_IS_JSON}
|
||||
withStack: ${LOG_WITH_STACK}
|
||||
|
||||
###################### Variables definition ######################
|
||||
# Long connection server configuration
|
||||
#
|
||||
# Websocket port for msg_gateway
|
||||
# Maximum number of websocket connections
|
||||
# Maximum length of websocket request package
|
||||
# Websocket connection handshake timeout
|
||||
longConnSvr:
|
||||
openImWsPort: [ ${OPENIM_WS_PORT} ]
|
||||
websocketMaxConnNum: ${WEBSOCKET_MAX_CONN_NUM}
|
||||
websocketMaxMsgLen: ${WEBSOCKET_MAX_MSG_LEN}
|
||||
websocketTimeout: ${WEBSOCKET_TIMEOUT}
|
||||
|
||||
# Push notification service configuration
|
||||
#
|
||||
# Use GeTui for push notifications
|
||||
# GeTui offline push configuration
|
||||
# FCM offline push configuration
|
||||
# Account file, place it in the config directory
|
||||
# JPush configuration, modify these after applying in JPush backend
|
||||
push:
|
||||
enable: ${PUSH_ENABLE}
|
||||
geTui:
|
||||
pushUrl: "${GETUI_PUSH_URL}"
|
||||
masterSecret: ""
|
||||
appKey: ""
|
||||
intent: ""
|
||||
channelID: ""
|
||||
channelName: ""
|
||||
fcm:
|
||||
serviceAccount: ${FCM_SERVICE_ACCOUNT}
|
||||
jpns:
|
||||
appKey:
|
||||
masterSecret:
|
||||
pushUrl:
|
||||
pushIntent:
|
||||
|
||||
# App manager configuration
|
||||
#
|
||||
# Built-in app manager user IDs
|
||||
# Built-in app manager nicknames
|
||||
manager:
|
||||
userID: [ "${MANAGER_USERID_1}", "${MANAGER_USERID_2}", "${MANAGER_USERID_3}" ]
|
||||
nickname: [ "${NICKNAME_1}", "${NICKNAME_2}", "${NICKNAME_3}" ]
|
||||
|
||||
# Multi-platform login policy
|
||||
# For each platform(Android, iOS, Windows, Mac, web), only one can be online at a time
|
||||
multiLoginPolicy: ${MULTILOGIN_POLICY}
|
||||
|
||||
# Whether to store messages in MySQL, messages in MySQL are only used for management background
|
||||
chatPersistenceMysql: ${CHAT_PERSISTENCE_MYSQL}
|
||||
|
||||
# Message cache timeout in seconds, it's not recommended to modify
|
||||
msgCacheTimeout: ${MSG_CACHE_TIMEOUT}
|
||||
|
||||
# Whether to enable read receipts for group chat
|
||||
groupMessageHasReadReceiptEnable: ${GROUP_MSG_READ_RECEIPT}
|
||||
|
||||
# Whether to enable read receipts for single chat
|
||||
singleMessageHasReadReceiptEnable: ${SINGLE_MSG_READ_RECEIPT}
|
||||
|
||||
# MongoDB offline message retention period in days
|
||||
retainChatRecords: ${RETAIN_CHAT_RECORDS}
|
||||
|
||||
# Schedule to clear expired messages(older than retainChatRecords days) in MongoDB every Wednesday at 2am
|
||||
# This deletion is just for cleaning up disk usage according to previous configuration retainChatRecords, no notification will be sent
|
||||
chatRecordsClearTime: "${CHAT_RECORDS_CLEAR_TIME}"
|
||||
|
||||
# Schedule to auto delete messages every day at 2am
|
||||
# This deletion is for messages that have been retained for more than msg_destruct_time (seconds) in the conversation field
|
||||
msgDestructTime: "${MSG_DESTRUCT_TIME}"
|
||||
|
||||
# Secret key
|
||||
secret: ${SECRET}
|
||||
|
||||
# Token policy
|
||||
#
|
||||
# Token expiration period in days
|
||||
tokenPolicy:
|
||||
expire: ${TOKEN_EXPIRE}
|
||||
|
||||
# Message verification policy
|
||||
#
|
||||
# Whether to verify friendship when sending messages
|
||||
messageVerify:
|
||||
friendVerify: false
|
||||
|
||||
# iOS push notification configuration
|
||||
#
|
||||
# iOS push notification sound
|
||||
# Whether to count badge
|
||||
# Whether it's production environment
|
||||
iosPush:
|
||||
pushSound: "xxx"
|
||||
badgeCount: true
|
||||
production: false
|
||||
|
||||
###################### Third-party service configuration ######################
|
||||
# Callback configuration
|
||||
#
|
||||
# Callback URL
|
||||
# Whether to enable this callback event
|
||||
# Timeout in seconds
|
||||
# Whether to continue execution if callback fails
|
||||
callback:
|
||||
url:
|
||||
beforeSendSingleMsg:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
afterSendSingleMsg:
|
||||
enable: false
|
||||
timeout: 5
|
||||
beforeSendGroupMsg:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
afterSendGroupMsg:
|
||||
enable: false
|
||||
timeout: 5
|
||||
msgModify:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
userOnline:
|
||||
enable: false
|
||||
timeout: 5
|
||||
userOffline:
|
||||
enable: false
|
||||
timeout: 5
|
||||
userKickOff:
|
||||
enable: false
|
||||
timeout: 5
|
||||
offlinePush:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
onlinePush:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
superGroupOnlinePush:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
beforeAddFriend:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
beforeCreateGroup:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
beforeMemberJoinGroup:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
beforeSetGroupMemberInfo:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
setMessageReactionExtensions:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
|
||||
###################### Prometheus ######################
|
||||
# Prometheus configuration for various services
|
||||
# The number of Prometheus ports per service needs to correspond to rpcPort
|
||||
# The number of ports needs to be consistent with msg_transfer_service_num in script/path_info.sh
|
||||
prometheus:
|
||||
enable: ${PROMETHEUS_ENABLE}
|
||||
userPrometheusPort: [ ${USER_PROM_PORT} ]
|
||||
friendPrometheusPort: [ ${FRIEND_PROM_PORT} ]
|
||||
messagePrometheusPort: [ ${MESSAGE_PROM_PORT} ]
|
||||
messageGatewayPrometheusPort: [ ${MSG_GATEWAY_PROM_PORT} ]
|
||||
groupPrometheusPort: [ ${GROUP_PROM_PORT} ]
|
||||
authPrometheusPort: [ ${AUTH_PROM_PORT} ]
|
||||
pushPrometheusPort: [ ${PUSH_PROM_PORT} ]
|
||||
conversationPrometheusPort: [ ${CONVERSATION_PROM_PORT} ]
|
||||
rtcPrometheusPort: [ ${RTC_PROM_PORT} ]
|
||||
thirdPrometheusPort: [ ${THIRD_PROM_PORT} ]
|
||||
messageTransferPrometheusPort: [ ${MSG_TRANSFER_PROM_PORT} ] # List of ports
|
||||
@ -26,3 +26,90 @@ source ${OPENIM_ROOT}/scripts/install/openim-crontask.sh
|
||||
source ${OPENIM_ROOT}/scripts/install/openim-api.sh
|
||||
source ${OPENIM_ROOT}/scripts/install/test.sh
|
||||
source ${OPENIM_ROOT}/scripts/install/man.sh
|
||||
|
||||
# Detailed help function
|
||||
function show_help() {
|
||||
echo "OpenIM Installer"
|
||||
echo "Usage: $0 <command> [options]"
|
||||
echo ""
|
||||
echo "Commands:"
|
||||
echo " -i, --install Install all OpenIM components."
|
||||
echo " -u, --uninstall Remove all OpenIM components."
|
||||
echo " -s, --status Check the current status of OpenIM components."
|
||||
echo " -h, --help Show this help menu."
|
||||
echo ""
|
||||
echo "Example: "
|
||||
echo " $0 -i Will install all OpenIM components."
|
||||
echo " $0 --install Same as above."
|
||||
}
|
||||
|
||||
function openim::install::install_openim()
|
||||
{
|
||||
openim::log::info "check openim dependency"
|
||||
openim::util::check_ports ${OPENIM_DEPENDENCY_PORT_LISTARIES[@]}
|
||||
|
||||
openim::msggateway::install || return 1
|
||||
openim::msgtransfer::install || return 1
|
||||
openim::push::install || return 1
|
||||
openim::rpc::install || return 1
|
||||
openim::crontask::install || return 1
|
||||
openim::api::install || return 1
|
||||
|
||||
openim::log::success "openim install success"
|
||||
}
|
||||
|
||||
function openim::uninstall::uninstall_openim()
|
||||
{
|
||||
openim::log::info "uninstall openim"
|
||||
|
||||
openim::msggateway::uninstall || return 1
|
||||
openim::msgtransfer::uninstall || return 1
|
||||
openim::push::uninstall || return 1
|
||||
openim::rpc::uninstall || return 1
|
||||
openim::crontask::uninstall || return 1
|
||||
openim::api::uninstall || return 1
|
||||
|
||||
openim::log::success "openim uninstall success"
|
||||
}
|
||||
|
||||
function openim::install::status()
|
||||
{
|
||||
openim::log::info "check openim status"
|
||||
|
||||
openim::msggateway::status || return 1
|
||||
openim::msgtransfer::status || return 1
|
||||
openim::push::status || return 1
|
||||
openim::rpc::status || return 1
|
||||
openim::crontask::status || return 1
|
||||
openim::api::status || return 1
|
||||
|
||||
openim::log::success "openim status success"
|
||||
}
|
||||
|
||||
# Argument parsing to call functions based on user input
|
||||
while (( "$#" )); do
|
||||
case "$1" in
|
||||
-i|--install)
|
||||
openim::install::install_openim
|
||||
shift
|
||||
;;
|
||||
-u|--uninstall)
|
||||
openim::uninstall::uninstall_openim
|
||||
shift
|
||||
;;
|
||||
-s|--status)
|
||||
openim::install::status
|
||||
shift
|
||||
;;
|
||||
-h|--help|*)
|
||||
show_help
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# If no arguments are provided, show help
|
||||
if [[ $# -eq 0 ]]; then
|
||||
show_help
|
||||
exit 0
|
||||
fi
|
||||
@ -1,83 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# 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.
|
||||
|
||||
# The root of the build/dist directory
|
||||
OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/../..
|
||||
|
||||
[[ -z ${COMMON_SOURCED} ]] && source ${OPENIM_ROOT}/scripts/install/common.sh
|
||||
|
||||
# 安装后打印必要的信息
|
||||
function openim::mariadb::info() {
|
||||
cat << EOF
|
||||
MariaDB Login: mysql -h127.0.0.1 -u${MARIADB_ADMIN_USERNAME} -p'${MARIADB_ADMIN_PASSWORD}'
|
||||
EOF
|
||||
}
|
||||
|
||||
# 安装
|
||||
function openim::mariadb::install()
|
||||
{
|
||||
# 1. 配置 MariaDB 10.5 apt 源
|
||||
openim::common::sudo "apt-get install software-properties-common dirmngr apt-transport-https"
|
||||
echo ${LINUX_PASSWORD} | sudo -S apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'
|
||||
# add /etc/apt/sources.list
|
||||
echo ${LINUX_PASSWORD} | sudo -S add-apt-repository 'deb [arch=amd64,arm64,ppc64el,s390x] https://mirrors.aliyun.com/mariadb/repo/10.5/ubuntu focal main'
|
||||
|
||||
# 2. 安装 MariaDB 和 MariaDB 客户端
|
||||
openim::common::sudo "apt update"
|
||||
openim::common::sudo "apt -y install mariadb-server"
|
||||
|
||||
# 3. 启动 MariaDB,并设置开机启动
|
||||
openim::common::sudo "systemctl enable mariadb"
|
||||
openim::common::sudo "systemctl start mariadb"
|
||||
|
||||
# 4. 设置 root 初始密码
|
||||
openim::common::sudo "mysqladmin -u${MARIADB_ADMIN_USERNAME} password ${MARIADB_ADMIN_PASSWORD}"
|
||||
|
||||
openim::mariadb::status || return 1
|
||||
openim::mariadb::info
|
||||
openim::log::info "install MariaDB successfully"
|
||||
}
|
||||
|
||||
# 卸载
|
||||
function openim::mariadb::uninstall()
|
||||
{
|
||||
set +o errexit
|
||||
openim::common::sudo "systemctl stop mariadb"
|
||||
openim::common::sudo "systemctl disable mariadb"
|
||||
openim::common::sudo "apt-get -y remove mariadb-server"
|
||||
openim::common::sudo "rm -rf /var/lib/mysql"
|
||||
set -o errexit
|
||||
openim::log::info "uninstall MariaDB successfully"
|
||||
}
|
||||
|
||||
# 状态检查
|
||||
function openim::mariadb::status()
|
||||
{
|
||||
# 查看 mariadb 运行状态,如果输出中包含 active (running) 字样说明 mariadb 成功启动。
|
||||
systemctl status mariadb |grep -q 'active' || {
|
||||
openim::log::error "mariadb failed to start, maybe not installed properly"
|
||||
return 1
|
||||
}
|
||||
|
||||
mysql -u${MARIADB_ADMIN_USERNAME} -p${MARIADB_ADMIN_PASSWORD} -e quit &>/dev/null || {
|
||||
openim::log::error "can not login with root, mariadb maybe not initialized properly"
|
||||
return 1
|
||||
}
|
||||
openim::log::info "MariaDB status active"
|
||||
}
|
||||
|
||||
if [[ "$*" =~ openim::mariadb:: ]];then
|
||||
eval $*
|
||||
fi
|
||||
@ -86,3 +86,22 @@ done
|
||||
|
||||
OPENIM_API_PORT_STRINGARIES=( $(openim::util::list-to-string ${OPENIM_API_PORT_LISTARIES[@]}) )
|
||||
openim::util::check_ports ${OPENIM_API_PORT_STRINGARIES[@]}
|
||||
|
||||
###################################### Linux Systemd ######################################
|
||||
SYSTEM_FILE_PATH="/etc/systemd/system/${SERVER_NAME}.service"
|
||||
|
||||
function openim::api::install() {
|
||||
|
||||
}
|
||||
|
||||
function openim::api::uninstall() {
|
||||
|
||||
}
|
||||
|
||||
function openim::api::status() {
|
||||
|
||||
}
|
||||
|
||||
if [[ "$*" =~ ${SERVER_NAME}:: ]];then
|
||||
eval $*
|
||||
fi
|
||||
@ -126,3 +126,22 @@ done
|
||||
|
||||
openim::util::check_ports ${OPENIM_RPC_PORT_TARGETS[@]}
|
||||
# openim::util::check_ports ${OPENIM_RPC_PROM_PORT_TARGETS[@]}
|
||||
|
||||
###################################### Linux Systemd ######################################
|
||||
SYSTEM_FILE_PATH="/etc/systemd/system/${SERVER_NAME}.service"
|
||||
|
||||
function openim::rpc::install() {
|
||||
|
||||
}
|
||||
|
||||
function openim::rpc::uninstall() {
|
||||
|
||||
}
|
||||
|
||||
function openim::rpc::status() {
|
||||
|
||||
}
|
||||
|
||||
if [[ "$*" =~ ${SERVER_NAME}:: ]];then
|
||||
eval $*
|
||||
fi
|
||||
@ -1,89 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# 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.
|
||||
|
||||
|
||||
# The root of the build/dist directory
|
||||
IAM_ROOT=$(dirname "${BASH_SOURCE[0]}")/../..
|
||||
[[ -z ${COMMON_SOURCED} ]] && source ${IAM_ROOT}/scripts/install/common.sh
|
||||
|
||||
# Print the necessary information after installation
|
||||
function openim::redis::info() {
|
||||
cat << EOF
|
||||
Redis Login: redis-cli --no-auth-warning -h ${REDIS_HOST} -p ${REDIS_PORT} -a '${REDIS_PASSWORD}'
|
||||
EOF
|
||||
}
|
||||
|
||||
# 安装
|
||||
function openim::redis::install()
|
||||
{
|
||||
# 1. 安装 Redis
|
||||
openim::common::sudo "apt-get -y install redis-server"
|
||||
|
||||
# 2. 配置 Redis
|
||||
# 2.1 修改 `/etc/redis/redis.conf` 文件,将 daemonize 由 no 改成 yes,表示允许 Redis 在后台启动
|
||||
echo ${LINUX_PASSWORD} | sudo -S sed -i '/^daemonize/{s/no/yes/}' /etc/redis/redis.conf
|
||||
|
||||
# 2.2 在 `bind 127.0.0.1` 前面添加 `#` 将其注释掉,默认情况下只允许本地连接,注释掉后外网可以连接 Redis
|
||||
echo ${LINUX_PASSWORD} | sudo -S sed -i '/^# bind 127.0.0.1/{s/# //}' /etc/redis/redis.conf
|
||||
|
||||
# 2.3 修改 requirepass 配置,设置 Redis 密码
|
||||
echo ${LINUX_PASSWORD} | sudo -S sed -i 's/^# requirepass.*$/requirepass '"${REDIS_PASSWORD}"'/' /etc/redis/redis.conf
|
||||
|
||||
# 2.4 因为我们上面配置了密码登录,需要将 protected-mode 设置为 no,关闭保护模式
|
||||
echo ${LINUX_PASSWORD} | sudo -S sed -i '/^protected-mode/{s/yes/no/}' /etc/redis/redis.conf
|
||||
|
||||
# 3. 为了能够远程连上 Redis,需要执行以下命令关闭防火墙,并禁止防火墙开机启动(如果不需要远程连接,可忽略此步骤)
|
||||
openim::common::sudo "sudo ufw disable"
|
||||
openim::common::sudo "sudo ufw status"
|
||||
|
||||
# 4. 启动 Redis
|
||||
openim::common::sudo "redis-server /etc/redis/redis.conf"
|
||||
|
||||
openim::redis::status || return 1
|
||||
openim::redis::info
|
||||
openim::log::info "install Redis successfully"
|
||||
}
|
||||
|
||||
# 卸载
|
||||
function openim::redis::uninstall()
|
||||
{
|
||||
set +o errexit
|
||||
openim::common::sudo "/etc/init.d/redis-server stop"
|
||||
openim::common::sudo "apt-get -y remove redis-server"
|
||||
openim::common::sudo "rm -rf /var/lib/redis"
|
||||
set -o errexit
|
||||
openim::log::info "uninstall Redis successfully"
|
||||
}
|
||||
|
||||
# 状态检查
|
||||
function openim::redis::status()
|
||||
{
|
||||
if [[ -z "`pgrep redis-server`" ]];then
|
||||
openim::log::error_exit "Redis not running, maybe not installed properly"
|
||||
return 1
|
||||
fi
|
||||
|
||||
redis-cli --no-auth-warning -h ${REDIS_HOST} -p ${REDIS_PORT} -a "${REDIS_PASSWORD}" --hotkeys || {
|
||||
openim::log::error "can not login with ${REDIS_USERNAME}, redis maybe not initialized properly"
|
||||
return 1
|
||||
}
|
||||
|
||||
openim::log::info "redis-server status active"
|
||||
}
|
||||
|
||||
#eval $*
|
||||
if [[ "$*" =~ openim::redis:: ]];then
|
||||
eval $*
|
||||
fi
|
||||
@ -1,42 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# 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.
|
||||
|
||||
#Include shell font styles and some basic information
|
||||
SCRIPTS_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
|
||||
#Include shell font styles and some basic information
|
||||
source $SCRIPTS_ROOT/style_info.sh
|
||||
source $SCRIPTS_ROOT/path_info.sh
|
||||
source $SCRIPTS_ROOT/function.sh
|
||||
|
||||
echo -e "${YELLOW_PREFIX}=======>SCRIPTS_ROOT=$SCRIPTS_ROOT${COLOR_SUFFIX}"
|
||||
echo -e "${YELLOW_PREFIX}=======>OPENIM_ROOT=$OPENIM_ROOT${COLOR_SUFFIX}"
|
||||
echo -e "${YELLOW_PREFIX}=======>pwd=$PWD${COLOR_SUFFIX}"
|
||||
|
||||
bin_dir="$BIN_DIR"
|
||||
logs_dir="$OPENIM_ROOT/logs"
|
||||
|
||||
cd ${component_check_binary_root}
|
||||
echo -e "${YELLOW_PREFIX}=======>$PWD${COLOR_SUFFIX}"
|
||||
cmd="./${component_check}"
|
||||
echo "==========================start components checking===========================">>$OPENIM_ROOT/logs/openIM.log
|
||||
$cmd
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
@ -1,7 +1,3 @@
|
||||
// Copyright 2020 Lingfei Kong <colin404@foxmail.com>. All rights reserved.
|
||||
// Use of this source code is governed by a MIT style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
|
||||
49
tools/imctl/cmd/genman/README.md
Normal file
49
tools/imctl/cmd/genman/README.md
Normal file
@ -0,0 +1,49 @@
|
||||
# OpenIM `man` Module README
|
||||
|
||||
Welcome to the `man` module of OpenIM, the comprehensive guide for using OpenIM's range of powerful commands. Here, you'll find in-depth details for each command, its options, and examples to help you harness the full power of the OpenIM suite.
|
||||
|
||||
## Overview
|
||||
|
||||
OpenIM is a robust instant messaging solution. To ensure users can effectively harness its capabilities, OpenIM provides a suite of commands that serve different functionalities, from the API level to RPC calls and utilities.
|
||||
|
||||
The `man` module ensures that users, both new and experienced, have a reliable source of information and documentation to use these commands effectively.
|
||||
|
||||
## Available Commands
|
||||
|
||||
The OpenIM commands are divided into core services and tools. Below is a brief overview of each:
|
||||
|
||||
### Core Services
|
||||
|
||||
- **openim-api**: Interface to the main functionalities of OpenIM.
|
||||
- **openim-cmdutils**: Utilities for executing common tasks.
|
||||
- **openim-crontask**: Schedule and manage routine tasks within OpenIM.
|
||||
- **openim-msggateway**: Gateway for managing messages within the OpenIM system.
|
||||
- **openim-msgtransfer**: Handle message transfers across different parts of OpenIM.
|
||||
- **openim-push**: Service for pushing notifications and updates.
|
||||
- **openim-rpc-auth**: RPC interface for authentication tasks.
|
||||
- **openim-rpc-conversation**: RPC service for handling conversations.
|
||||
- **openim-rpc-friend**: Manage friend lists and related functionalities through RPC.
|
||||
- **openim-rpc-group**: Group management via RPC.
|
||||
- **openim-rpc-msg**: Message handling at the RPC level.
|
||||
- **openim-rpc-third**: Third-party integrations and related tasks through RPC.
|
||||
- **openim-rpc-user**: User management and tasks via RPC.
|
||||
|
||||
### Tools
|
||||
|
||||
- **changelog**: Track and manage changes in OpenIM.
|
||||
- **component**: Utilities related to different components within OpenIM.
|
||||
- **infra**: Infrastructure and backend management tools.
|
||||
- **ncpu**: Monitor and manage CPU usage and related tasks.
|
||||
- **yamlfmt**: A tool for formatting and linting YAML files within the OpenIM configuration.
|
||||
|
||||
## How to Use
|
||||
|
||||
To view the manual page for any of the OpenIM commands, use the `man` command followed by the command name. For example:
|
||||
|
||||
```
|
||||
man openim-api
|
||||
```
|
||||
|
||||
## Contributions
|
||||
|
||||
We welcome contributions to enhance the `man` pages. If you discover inconsistencies, errors, or areas where further details are required, feel free to raise an issue or submit a pull request.
|
||||
31
tools/imctl/cmd/genman/genman.go
Normal file
31
tools/imctl/cmd/genman/genman.go
Normal file
@ -0,0 +1,31 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"k8s.io/kubernetes/cmd/genutils"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// use os.Args instead of "flags" because "flags" will mess up the man pages!
|
||||
path := "docs/man/man1"
|
||||
module := ""
|
||||
if len(os.Args) == 3 {
|
||||
path = os.Args[1]
|
||||
module = os.Args[2]
|
||||
} else {
|
||||
fmt.Fprintf(os.Stderr, "usage: %s [output directory] [module] \n", os.Args[0])
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
outDir, err := genutils.OutDir(path)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "failed to get output directory: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// Set environment variables used by command so the output is consistent,
|
||||
// regardless of where we run.
|
||||
os.Setenv("HOME", "/home/username")
|
||||
}
|
||||
@ -1,7 +1,3 @@
|
||||
// Copyright 2020 Lingfei Kong <colin404@foxmail.com>. All rights reserved.
|
||||
// Use of this source code is governed by a MIT style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package term
|
||||
|
||||
import (
|
||||
|
||||
@ -1,7 +1,3 @@
|
||||
// Copyright 2020 Lingfei Kong <colin404@foxmail.com>. All rights reserved.
|
||||
// Use of this source code is governed by a MIT style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package term provides structures and helper functions to work with
|
||||
// terminal (state, sizes).
|
||||
package term
|
||||
|
||||
@ -1,7 +1,3 @@
|
||||
// Copyright 2020 Lingfei Kong <colin404@foxmail.com>. All rights reserved.
|
||||
// Use of this source code is governed by a MIT style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package term
|
||||
|
||||
import (
|
||||
@ -20,9 +16,11 @@ type wordWrapWriter struct {
|
||||
// NewResponsiveWriter creates a Writer that detects the column width of the
|
||||
// terminal we are in, and adjusts every line width to fit and use recommended
|
||||
// terminal sizes for better readability. Does proper word wrapping automatically.
|
||||
//
|
||||
// if terminal width >= 120 columns use 120 columns
|
||||
// if terminal width >= 100 columns use 100 columns
|
||||
// if terminal width >= 80 columns use 80 columns
|
||||
//
|
||||
// In case we're not in a terminal or if it's smaller than 80 columns width,
|
||||
// doesn't do any wrapping.
|
||||
func NewResponsiveWriter(w io.Writer) io.Writer {
|
||||
|
||||
@ -1,7 +1,3 @@
|
||||
// Copyright 2020 Lingfei Kong <colin404@foxmail.com>. All rights reserved.
|
||||
// Use of this source code is governed by a MIT style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package term
|
||||
|
||||
import (
|
||||
|
||||
47
tools/ncpu/README.md
Normal file
47
tools/ncpu/README.md
Normal file
@ -0,0 +1,47 @@
|
||||
# ncpu
|
||||
|
||||
**ncpu** is a simple utility to fetch the number of CPU cores across different operating systems.
|
||||
|
||||
## Introduction
|
||||
|
||||
In various scenarios, especially while compiling code, it's beneficial to know the number of available CPU cores to optimize the build process. However, the command to fetch the CPU core count differs between operating systems. For example, on Linux, we use `nproc`, while on macOS, it's `sysctl -n hw.ncpu`. The `ncpu` utility provides a unified way to obtain this number, regardless of the platform.
|
||||
|
||||
## Usage
|
||||
|
||||
To retrieve the number of CPU cores, simply use the `ncpu` command:
|
||||
|
||||
```bash
|
||||
$ ncpu
|
||||
```
|
||||
|
||||
This will return an integer representing the number of available CPU cores.
|
||||
|
||||
### Example:
|
||||
|
||||
Let's say you're compiling a project using `make`. To utilize all the CPU cores for the compilation process, you can use:
|
||||
|
||||
```bash
|
||||
$ make -j $(ncpu) build # or any other build command
|
||||
```
|
||||
|
||||
The above command will ensure the build process takes advantage of all the available CPU cores, thereby potentially speeding up the compilation.
|
||||
|
||||
## Why use `ncpu`?
|
||||
|
||||
- **Cross-platform compatibility**: No need to remember or detect which OS-specific command to use. Just use `ncpu`!
|
||||
|
||||
- **Ease of use**: A simple and intuitive command that's easy to incorporate into scripts or command-line operations.
|
||||
|
||||
- **Consistency**: Ensures consistent behavior and output across different systems and environments.
|
||||
|
||||
## Installation
|
||||
|
||||
(Include installation steps here, e.g., how to clone the repo, build the tool, or install via package manager.)
|
||||
|
||||
## Contributing
|
||||
|
||||
If you have any suggestions, bug reports, or wish to contribute to the development of `ncpu`, please refer to our contribution guidelines (link to guidelines).
|
||||
|
||||
## License
|
||||
|
||||
`ncpu` is released under the [LICENSE_NAME](LINK_TO_LICENSE). Please refer to the license file for more details.
|
||||
Loading…
x
Reference in New Issue
Block a user