From 80e7c44cf5a93ead96fa861108172038694a9653 Mon Sep 17 00:00:00 2001 From: Gordon <1432970085@qq.com> Date: Wed, 1 Dec 2021 14:57:27 +0800 Subject: [PATCH 1/2] config update --- config/config.yaml | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/config/config.yaml b/config/config.yaml index c4b0e49fc..7dd3403b0 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -8,7 +8,7 @@ etcd: etcdAddr: [ 127.0.0.1:2379 ] mysql: - dbMysqlAddress: [ 127.0.0.1:3306 ] + dbMysqlAddress: [ 127.0.0.1:13306 ] dbMysqlUserName: root dbMysqlPassword: openIM dbMysqlDatabaseName: openIM @@ -19,7 +19,7 @@ mysql: dbMaxLifeTime: 120 mongo: - dbAddress: [ 127.0.0.1:27017 ] + dbAddress: [ 127.0.0.1:37017 ] dbDirect: false dbTimeout: 10 dbDatabase: openIM @@ -30,7 +30,7 @@ mongo: dbRetainChatRecords: 7 redis: - dbAddress: 127.0.0.1:6379 + dbAddress: 127.0.0.1:16379 dbMaxIdle: 128 dbMaxActive: 0 dbIdleTimeout: 120 @@ -55,7 +55,7 @@ kafka: # The service ip default is empty, # automatically obtain the machine's valid network card ip as the service ip, # otherwise the configuration ip is preferred -serverip: +serverip: 0.0.0.0 api: openImApiPort: [ 10000 ] @@ -130,10 +130,7 @@ manager: secret: tuoyun -multiloginpolicy: - onlyOneTerminalAccess: false - mobileAndPCTerminalAccessButOtherTerminalKickEachOther: true - allTerminalAccess: false +multiloginpolicy: 1 #token config tokenpolicy: @@ -143,4 +140,27 @@ tokenpolicy: messagecallback: callbackSwitch: false - callbackUrl: "http://www.xxx.com/msg/judge" \ No newline at end of file + callbackUrl: "http://www.xxx.com/msg/judge" + #TimeOut use second as unit + callbackTimeOut: 10 + + +#---------------demo configuration---------------------# +#The following configuration items are applied to openIM Demo configuration +demoswitch: true +demo: + openImDemoPort: [ 42233 ] + alismsverify: + accessKeyId: LTAI5tJPkn4HuuePdiLdGqe71 + accessKeySecret: 4n9OJ7ZCVN1U6KeHDAtOyNeVZcjOuV1 + signName: OpenIM Corporation + verificationCodeTemplateCode: SMS_2268101641 + superCode: 666666 + mail: + title: "openIM" + senderMail: "1765567899@qq.com" + senderAuthorizationCode: "1gxyausfoevlzbfag" + smtpAddr: "smtp.qq.com" + smtpPort: 25 + + From 1d4b47f5e65747a137bc7be5c11a23e83a594830 Mon Sep 17 00:00:00 2001 From: Gordon <1432970085@qq.com> Date: Wed, 1 Dec 2021 15:01:15 +0800 Subject: [PATCH 2/2] script update --- script/check_all.sh | 7 ++++++ script/demo_svr_start.sh | 47 ++++++++++++++++++++++++++++++++++++++++ script/path_info.cfg | 6 +++++ script/start_all.sh | 1 + 4 files changed, 61 insertions(+) create mode 100644 script/demo_svr_start.sh diff --git a/script/check_all.sh b/script/check_all.sh index 9e6d45db4..0c7313743 100644 --- a/script/check_all.sh +++ b/script/check_all.sh @@ -14,8 +14,15 @@ service_port_name=( openImPushPort openImWsPort openImSdkWsPort + openImDemoPort ) +switch=$(cat $config_path | grep demoswitch |awk -F '[:]' '{print $NF}') for i in ${service_port_name[*]}; do + if [ ${switch} != "true" ]; then + if [ ${i} == "openImDemoPort"]; then + continue + fi + fi list=$(cat $config_path | grep -w ${i} | awk -F '[:]' '{print $NF}') list_to_string $list for j in ${ports_array}; do diff --git a/script/demo_svr_start.sh b/script/demo_svr_start.sh new file mode 100644 index 000000000..55aaa88b1 --- /dev/null +++ b/script/demo_svr_start.sh @@ -0,0 +1,47 @@ +#!/usr/bin/env bash +#Include shell font styles and some basic information +source ./style_info.cfg +source ./path_info.cfg +source ./function.sh +switch=$(cat $config_path | grep demoswitch |awk -F '[:]' '{print $NF}') +if [ ${switch} != "true" ]; then + echo -e ${YELLOW_PREFIX}" demo service switch is false not start demo "${COLOR_SUFFIX} + exit 0 +fi +list1=$(cat $config_path | grep openImDemoPort | awk -F '[:]' '{print $NF}') +list_to_string $list1 +api_ports=($ports_array) + +#Check if the service exists +#If it is exists,kill this process +check=$(ps aux | grep -w ./${demo_server_name} | grep -v grep | wc -l) +if [ $check -ge 1 ]; then + oldPid=$(ps aux | grep -w ./${demo_server_name} | grep -v grep | awk '{print $2}') + kill -9 $oldPid +fi +#Waiting port recycling +sleep 1 +cd ${demo_server_binary_root} + +for ((i = 0; i < ${#api_ports[@]}; i++)); do + nohup ./${demo_server_name} -port ${api_ports[$i]} >>../logs/openIM.log 2>&1 & +done + +sleep 3 +#Check launched service process +check=$(ps aux | grep -w ./${demo_server_name} | grep -v grep | wc -l) +if [ $check -ge 1 ]; then + newPid=$(ps aux | grep -w ./${demo_server_name} | grep -v grep | awk '{print $2}') + ports=$(netstat -netulp | grep -w ${newPid} | awk '{print $4}' | awk -F '[:]' '{print $NF}') + allPorts="" + + for i in $ports; do + allPorts=${allPorts}"$i " + done + echo -e ${SKY_BLUE_PREFIX}"SERVICE START SUCCESS "${COLOR_SUFFIX} + echo -e ${SKY_BLUE_PREFIX}"SERVICE_NAME: "${COLOR_SUFFIX}${YELLOW_PREFIX}${demo_server_name}${COLOR_SUFFIX} + echo -e ${SKY_BLUE_PREFIX}"PID: "${COLOR_SUFFIX}${YELLOW_PREFIX}${newPid}${COLOR_SUFFIX} + echo -e ${SKY_BLUE_PREFIX}"LISTENING_PORT: "${COLOR_SUFFIX}${YELLOW_PREFIX}${allPorts}${COLOR_SUFFIX} +else + echo -e ${YELLOW_PREFIX}${demo_server_name}${COLOR_SUFFIX}${RED_PREFIX}"SERVICE START ERROR, PLEASE CHECK openIM.log"${COLOR_SUFFIX} +fi diff --git a/script/path_info.cfg b/script/path_info.cfg index b97588e61..ea9fa76e9 100644 --- a/script/path_info.cfg +++ b/script/path_info.cfg @@ -27,6 +27,10 @@ sdk_server_name="open_im_sdk_server" sdk_server_binary_root="../bin/" sdk_server_source_root="../cmd/Open-IM-SDK-Core/" +demo_server_name="open_im_demo" +demo_server_binary_root="../bin/" +demo_server_source_root="../cmd/open_im_demo/" + #Global configuration file default dir config_path="../config/config.yaml" @@ -46,6 +50,7 @@ service_source_root=( ${push_source_root} ${sdk_server_source_root} ${timer_task_source_root} + ${demo_server_source_root} ) #service filename service_names=( @@ -62,6 +67,7 @@ service_names=( ${push_name} ${sdk_server_name} ${timer_task_name} + ${demo_server_name} ) diff --git a/script/start_all.sh b/script/start_all.sh index 956bc0d51..dd9420adc 100644 --- a/script/start_all.sh +++ b/script/start_all.sh @@ -10,6 +10,7 @@ need_to_start_server_shell=( msg_transfer_start.sh sdk_svr_start.sh timer_start.sh + demo_svr_start.sh ) for i in ${need_to_start_server_shell[*]}; do