mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-08 11:05:59 +08:00
feat: use robot to migrate code
Signed-off-by: kubbot & kubecub <3293172751ysy@gmail.com>
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
USER=root
|
||||
PASSWORD=openIMPassword
|
||||
DATA_DIR=./
|
||||
@@ -9,7 +9,6 @@ need_to_start_server_shell=(
|
||||
push_start.sh
|
||||
msg_transfer_start.sh
|
||||
sdk_svr_start.sh
|
||||
demo_svr_start.sh
|
||||
)
|
||||
time=`date +"%Y-%m-%d %H:%M:%S"`
|
||||
echo "==========================================================">>../logs/openIM.log 2>&1 &
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
version=errcode
|
||||
repository=${1}
|
||||
if [[ -z ${repository} ]]
|
||||
then
|
||||
echo "repository is empty"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
set +e
|
||||
echo "repository: ${repository}"
|
||||
source ./path_info.cfg
|
||||
echo "start to build docker images"
|
||||
currentPwd=`pwd`
|
||||
echo ${currentPwd}
|
||||
i=0
|
||||
for path in ${service_source_root[*]}
|
||||
do
|
||||
cd ${path}
|
||||
make build
|
||||
image="${repository}/${image_names[${i}]}:$version"
|
||||
echo ${image}
|
||||
docker build -t $image . -f ./deploy.Dockerfile
|
||||
echo "build ${image} success"
|
||||
docker push ${image}
|
||||
echo "push ${image} success"
|
||||
echo "=============================="
|
||||
i=$((i + 1))
|
||||
cd ${currentPwd}
|
||||
done
|
||||
|
||||
echo "build all images success"
|
||||
+11
-23
@@ -6,9 +6,7 @@ source ./function.sh
|
||||
service_port_name=(
|
||||
openImWsPort
|
||||
openImApiPort
|
||||
openImSdkWsPort
|
||||
openImDemoPort
|
||||
openImCmsApiPort
|
||||
#openImSdkWsPort
|
||||
openImUserPort
|
||||
openImFriendPort
|
||||
openImMessagePort
|
||||
@@ -16,24 +14,14 @@ service_port_name=(
|
||||
openImGroupPort
|
||||
openImAuthPort
|
||||
openImPushPort
|
||||
openImStatisticsPort
|
||||
openImMessageCmsPort
|
||||
openImAdminCmsPort
|
||||
openImOfficePort
|
||||
openImOrganizationPort
|
||||
openImConversationPort
|
||||
openImThirdPort
|
||||
)
|
||||
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
|
||||
port=$(netstat -netulp | grep ./open_im | awk '{print $4}' | grep -w ${j} | awk -F '[:]' '{print $NF}')
|
||||
port=$(ss -tunlp| grep open_im | awk '{print $5}' | grep -w ${j} | awk -F '[:]' '{print $NF}')
|
||||
if [[ ${port} -ne ${j} ]]; then
|
||||
echo -e ${YELLOW_PREFIX}${i}${COLOR_SUFFIX}${RED_PREFIX}" service does not start normally,not initiated port is "${COLOR_SUFFIX}${YELLOW_PREFIX}${j}${COLOR_SUFFIX}
|
||||
echo -e ${RED_PREFIX}"please check ../logs/openIM.log "${COLOR_SUFFIX}
|
||||
@@ -55,13 +43,13 @@ else
|
||||
fi
|
||||
|
||||
|
||||
#check=$(ps aux | grep -w ./${timer_task_name} | grep -v grep | wc -l)
|
||||
#if [ $check -ge 1 ]; then
|
||||
# echo -e ${GREEN_PREFIX}"none port has been listening,belongs service is openImMsgTimer"${COLOR_SUFFIX}
|
||||
#else
|
||||
# echo -e ${RED_PREFIX}"openImMsgTimer service does not start normally"${COLOR_SUFFIX}
|
||||
# echo -e ${RED_PREFIX}"please check ../logs/openIM.log "${COLOR_SUFFIX}
|
||||
# exit -1
|
||||
#fi
|
||||
check=$(ps aux | grep -w ./${cron_task_name} | grep -v grep | wc -l)
|
||||
if [ $check -ge 1 ]; then
|
||||
echo -e ${GREEN_PREFIX}"none port has been listening,belongs service is openImCronTask"${COLOR_SUFFIX}
|
||||
else
|
||||
echo -e ${RED_PREFIX}"cron_task_name service does not start normally"${COLOR_SUFFIX}
|
||||
echo -e ${RED_PREFIX}"please check ../logs/openIM.log "${COLOR_SUFFIX}
|
||||
exit -1
|
||||
fi
|
||||
|
||||
echo -e ${YELLOW_PREFIX}"all services launch success"${COLOR_SUFFIX}
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
#!/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
|
||||
@@ -3,10 +3,10 @@ echo "docker-compose ps..........................."
|
||||
docker-compose ps
|
||||
|
||||
echo "check OpenIM, waiting 30s...................."
|
||||
sleep 30
|
||||
sleep 60
|
||||
|
||||
echo "check OpenIM................................"
|
||||
./check_all.sh
|
||||
chmod +x ./enterprise/*.sh
|
||||
./enterprise/check_all.sh
|
||||
# chmod +x ./enterprise/*.sh
|
||||
# ./enterprise/check_all.sh
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ need_to_start_server_shell=(
|
||||
push_start.sh
|
||||
msg_transfer_start.sh
|
||||
sdk_svr_start.sh
|
||||
demo_svr_start.sh
|
||||
start_cron.sh
|
||||
)
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ service_port_name=(
|
||||
openImAdminPort
|
||||
openImChatPort
|
||||
)
|
||||
switch=$(cat $config_path | grep demoswitch |awk -F '[:]' '{print $NF}')
|
||||
|
||||
for i in ${service_port_name[*]}; do
|
||||
list=$(cat $config_path | grep -w ${i} | awk -F '[:]' '{print $NF}')
|
||||
list_to_string $list
|
||||
|
||||
@@ -7,7 +7,7 @@ demo_server_binary_root="../bin/"
|
||||
|
||||
|
||||
#Global configuration file default dir
|
||||
config_path="../docker-compose_cfg/config.yaml"
|
||||
config_path="../.docker-compose_cfg/config.yaml"
|
||||
|
||||
#servicefile dir path
|
||||
service_source_root=(
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
echo "your user is:$USER"
|
||||
echo "your password is:$PASSWORD"
|
||||
echo "your minio endPoint is:$MINIO_ENDPOINT"
|
||||
echo "your data dir is $DATA_DIR"
|
||||
|
||||
sed -i "/^\([[:space:]]*dbMysqlUserName: *\).*/s//\1$USER/;0,/\([[:space:]]*dbUserName: *\).*/s//\1 $USER/;/\([[:space:]]*accessKeyID: *\).*/s//\1 $USER/;/\([[:space:]]*endpoint: *\).*/s//\1\"abc\"/;" ../config/config.yaml
|
||||
sed -i "/^\([[:space:]]*dbMysqlPassword: *\).*/s//\1$PASSWORD/;/\([[:space:]]*dbPassword: *\).*/s//\1$PASSWORD/;/\([[:space:]]*secret: *\).*/s//\1$PASSWORD/;/\([[:space:]]*secretAccessKey: *\).*/s//\1$PASSWORD/;" ../config/config.yaml
|
||||
|
||||
sed -i "/\([[:space:]]*endpoint: *\).*/s##\1$MINIO_ENDPOINT#;" ../config/config.yaml
|
||||
sed -i "/\([[:space:]]*dbPassWord: *\).*/s//\1$PASSWORD/;" ../config/config.yaml
|
||||
sed -i "/\([[:space:]]*secret: *\).*/s//\1$PASSWORD/;" ../.docker-compose_cfg/config.yaml
|
||||
@@ -0,0 +1,12 @@
|
||||
mongo -- "$MONGO_INITDB_DATABASE" <<EOF
|
||||
db = db.getSiblingDB('admin')
|
||||
db.auth('$MONGO_INITDB_ROOT_USERNAME', '$MONGO_INITDB_ROOT_PASSWORD')
|
||||
db = db.getSiblingDB('$MONGO_INITDB_DATABASE')
|
||||
db.createUser({
|
||||
user: "$MONGO_USERNAME",
|
||||
pwd: "$MONGO_PASSWORD",
|
||||
roles: [
|
||||
{ role: 'root', db: '$MONGO_INITDB_DATABASE' }
|
||||
]
|
||||
})
|
||||
EOF
|
||||
@@ -7,13 +7,16 @@ ulimit -n 200000
|
||||
|
||||
list1=$(cat $config_path | grep openImMessageGatewayPort | awk -F '[:]' '{print $NF}')
|
||||
list2=$(cat $config_path | grep openImWsPort | awk -F '[:]' '{print $NF}')
|
||||
list3=$(cat $config_path | grep messageGatewayPrometheusPort | awk -F '[:]' '{print $NF}')
|
||||
list_to_string $list1
|
||||
rpc_ports=($ports_array)
|
||||
list_to_string $list2
|
||||
ws_ports=($ports_array)
|
||||
list_to_string $list3
|
||||
prome_ports=($ports_array)
|
||||
if [ ${#rpc_ports[@]} -ne ${#ws_ports[@]} ]; then
|
||||
|
||||
echo -e ${RED_PREFIX}"ws_ports does not match push_rpc_ports in quantity!!!"${COLOR_SUFFIX}
|
||||
echo -e ${RED_PREFIX}"ws_ports does not match push_rpc_ports or prome_ports in quantity!!!"${COLOR_SUFFIX}
|
||||
exit -1
|
||||
|
||||
fi
|
||||
@@ -28,7 +31,8 @@ fi
|
||||
sleep 1
|
||||
cd ${msg_gateway_binary_root}
|
||||
for ((i = 0; i < ${#ws_ports[@]}; i++)); do
|
||||
nohup ./${msg_gateway_name} -rpc_port ${rpc_ports[$i]} -ws_port ${ws_ports[$i]} >>../logs/openIM.log 2>&1 &
|
||||
echo "==========================start msg_gateway server===========================">>../logs/openIM.log
|
||||
nohup ./${msg_gateway_name} --port ${rpc_ports[$i]} --ws_port ${ws_ports[$i]} --prometheus_port ${prome_ports[$i]} >>../logs/openIM.log 2>&1 &
|
||||
done
|
||||
|
||||
#Check launched service process
|
||||
|
||||
@@ -2,7 +2,11 @@
|
||||
#Include shell font styles and some basic information
|
||||
source ./style_info.cfg
|
||||
source ./path_info.cfg
|
||||
source ./function.sh
|
||||
|
||||
list1=$(cat $config_path | grep messageTransferPrometheusPort | awk -F '[:]' '{print $NF}')
|
||||
list_to_string $list1
|
||||
prome_ports=($ports_array)
|
||||
|
||||
|
||||
#Check if the service exists
|
||||
@@ -18,7 +22,13 @@ sleep 1
|
||||
|
||||
cd ${msg_transfer_binary_root}
|
||||
for ((i = 0; i < ${msg_transfer_service_num}; i++)); do
|
||||
nohup ./${msg_transfer_name} >>../logs/openIM.log 2>&1 &
|
||||
prome_port=${prome_ports[$i]}
|
||||
cmd="nohup ./${msg_transfer_name}"
|
||||
if [ $prome_port != "" ]; then
|
||||
cmd="$cmd --prometheus_port $prome_port"
|
||||
fi
|
||||
echo "==========================start msg_transfer server===========================">>../logs/openIM.log
|
||||
$cmd >>../logs/openIM.log 2>&1 &
|
||||
done
|
||||
|
||||
#Check launched service process
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
source ./style_info.cfg
|
||||
source ./path_info.cfg
|
||||
source ./function.sh
|
||||
|
||||
#define database attributes
|
||||
address=$(cat $config_path | grep -w dbMysqlAddress)
|
||||
list_to_string ${address}
|
||||
hostAndPort=($ports_array)
|
||||
DATABASE_HOST=$(echo $hostAndPort | awk -F '[:]' '{print $1}')
|
||||
DATABASE_PORT=$(echo $hostAndPort | awk -F '[:]' '{print $NF}')
|
||||
DATABASE_USERNAME=$(cat $config_path | grep -w dbMysqlUserName | awk -F '[:]' '{print $NF}')
|
||||
DATABASE_PWD=`eval echo $(cat $config_path | grep -w dbMysqlPassword | awk -F '[:]' '{print $NF}')`
|
||||
DATABASE_NAME=$(cat $config_path | grep -w dbMysqlDatabaseName | awk -F '[:]' '{print $NF}')
|
||||
SQL_FILE="../config/mysql_sql_file/openIM.sql"
|
||||
|
||||
|
||||
create_data_sql="create database IF NOT EXISTS $DATABASE_NAME"
|
||||
set_character_code_sql="alter database $DATABASE_NAME character set utf8mb4 collate utf8mb4_general_ci"
|
||||
|
||||
echo -e "${SKY_BLUE_PREFIX}start to create database.....$COLOR_SUFFIX"
|
||||
mysql -h $DATABASE_HOST -P $DATABASE_PORT -u $DATABASE_USERNAME -p$DATABASE_PWD -e "$create_data_sql"
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo -e "${SKY_BLUE_PREFIX}create database ${DATABASE_NAME} successfully$COLOR_SUFFIX"
|
||||
mysql -h $DATABASE_HOST -P $DATABASE_PORT -u $DATABASE_USERNAME -p$DATABASE_PWD -e "$set_character_code_sql"
|
||||
else
|
||||
echo -e "${RED_PREFIX}create database failed or exists the database$COLOR_SUFFIX\n"
|
||||
fi
|
||||
|
||||
echo -e "${SKY_BLUE_PREFIX}start to source openIM.sql .....$COLOR_SUFFIX"
|
||||
mysql -h $DATABASE_HOST -P $DATABASE_PORT -u $DATABASE_USERNAME -p$DATABASE_PWD -D $DATABASE_NAME <$SQL_FILE
|
||||
if [ $? -eq 0 ]; then
|
||||
echo -e "${SKY_BLUE_PREFIX}source openIM.sql successfully$COLOR_SUFFIX"
|
||||
else
|
||||
echo -e "${RED_PREFIX}source openIM.sql failed$COLOR_SUFFIX\n"
|
||||
fi
|
||||
+43
-37
@@ -1,36 +1,37 @@
|
||||
#Don't put the space between "="
|
||||
msg_gateway_name="open_im_msg_gateway"
|
||||
msg_gateway_binary_root="../bin/"
|
||||
msg_gateway_source_root="../cmd/open_im_msg_gateway/"
|
||||
msg_gateway_source_root="../cmd/msggateway/"
|
||||
|
||||
msg_name="open_im_msg"
|
||||
msg_binary_root="../bin/"
|
||||
msg_source_root="../cmd/rpc/open_im_msg/"
|
||||
msg_source_root="../cmd/rpc/msg/"
|
||||
|
||||
push_name="open_im_push"
|
||||
push_binary_root="../bin/"
|
||||
push_source_root="../cmd/open_im_push/"
|
||||
push_source_root="../cmd/push/"
|
||||
|
||||
|
||||
|
||||
msg_transfer_name="open_im_msg_transfer"
|
||||
msg_transfer_binary_root="../bin/"
|
||||
msg_transfer_source_root="../cmd/open_im_msg_transfer/"
|
||||
msg_transfer_service_num=2
|
||||
msg_transfer_source_root="../cmd/msgtransfer/"
|
||||
msg_transfer_service_num=4
|
||||
|
||||
|
||||
timer_task_name="open_im_timer_task"
|
||||
timer_task_binary_root="../bin/"
|
||||
timer_task_source_root="../cmd/open_im_timer_task/"
|
||||
|
||||
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/"
|
||||
|
||||
cron_task_name="open_im_cron_task"
|
||||
cron_task_binary_root="../bin/"
|
||||
cron_task_source_root="../cmd/crontask/"
|
||||
|
||||
|
||||
cmd_utils_name="open_im_cmd_utils"
|
||||
cmd_utils_binary_root="../bin/"
|
||||
cmd_utils_source_root="../cmd/cmduitls/"
|
||||
|
||||
#Global configuration file default dir
|
||||
config_path="../config/config.yaml"
|
||||
@@ -38,49 +39,54 @@ config_path="../config/config.yaml"
|
||||
#servicefile dir path
|
||||
service_source_root=(
|
||||
#api service file
|
||||
../cmd/open_im_api/
|
||||
../cmd/open_im_cms_api/
|
||||
../cmd/api/
|
||||
#rpc service file
|
||||
../cmd/rpc/open_im_user/
|
||||
../cmd/rpc/open_im_friend/
|
||||
../cmd/rpc/open_im_group/
|
||||
../cmd/rpc/open_im_auth/
|
||||
../cmd/rpc/open_im_admin_cms/
|
||||
../cmd/rpc/open_im_message_cms/
|
||||
../cmd/rpc/open_im_statistics/
|
||||
../cmd/rpc/open_im_office/
|
||||
../cmd/rpc/open_im_organization/
|
||||
../cmd/rpc/open_im_conversation/
|
||||
../cmd/rpc/user/
|
||||
../cmd/rpc/friend/
|
||||
../cmd/rpc/group/
|
||||
../cmd/rpc/auth/
|
||||
../cmd/rpc/conversation/
|
||||
../cmd/rpc/third/
|
||||
../cmd/crontask
|
||||
${msg_gateway_source_root}
|
||||
${msg_transfer_source_root}
|
||||
${msg_transfer_source_root/}
|
||||
${msg_source_root}
|
||||
${push_source_root}
|
||||
${sdk_server_source_root}
|
||||
${demo_server_source_root}
|
||||
# ${sdk_server_source_root}
|
||||
)
|
||||
#service filename
|
||||
service_names=(
|
||||
#api service filename
|
||||
open_im_api
|
||||
open_im_cms_api
|
||||
#rpc service filename
|
||||
open_im_user
|
||||
open_im_friend
|
||||
open_im_group
|
||||
open_im_auth
|
||||
open_im_admin_cms
|
||||
open_im_message_cms
|
||||
open_im_statistics
|
||||
open_im_office
|
||||
open_im_organization
|
||||
open_im_conversation
|
||||
open_im_third
|
||||
open_im_cron_task
|
||||
${msg_gateway_name}
|
||||
${msg_transfer_name}
|
||||
${msg_name}
|
||||
${push_name}
|
||||
${sdk_server_name}
|
||||
${demo_server_name}
|
||||
# ${sdk_server_name}
|
||||
)
|
||||
|
||||
|
||||
|
||||
image_names=(
|
||||
#api service file
|
||||
api
|
||||
#rpc service file
|
||||
user
|
||||
friend
|
||||
group
|
||||
auth
|
||||
conversation
|
||||
third
|
||||
cron_task
|
||||
msg_gateway
|
||||
msg_transfer
|
||||
msg
|
||||
push
|
||||
# sdk_server
|
||||
)
|
||||
@@ -7,8 +7,11 @@ source ./function.sh
|
||||
|
||||
|
||||
list1=$(cat $config_path | grep openImPushPort | awk -F '[:]' '{print $NF}')
|
||||
list2=$(cat $config_path | grep pushPrometheusPort | awk -F '[:]' '{print $NF}')
|
||||
list_to_string $list1
|
||||
rpc_ports=($ports_array)
|
||||
list_to_string $list2
|
||||
prome_ports=($ports_array)
|
||||
|
||||
#Check if the service exists
|
||||
#If it is exists,kill this process
|
||||
@@ -22,7 +25,8 @@ sleep 1
|
||||
cd ${push_binary_root}
|
||||
|
||||
for ((i = 0; i < ${#rpc_ports[@]}; i++)); do
|
||||
nohup ./${push_name} -port ${rpc_ports[$i]} >>../logs/openIM.log 2>&1 &
|
||||
echo "==========================start push server===========================">>../logs/openIM.log
|
||||
nohup ./${push_name} --port ${rpc_ports[$i]} --prometheus_port ${prome_ports[$i]} >>../logs/openIM.log 2>&1 &
|
||||
done
|
||||
|
||||
sleep 3
|
||||
|
||||
@@ -5,17 +5,12 @@ source ./path_info.cfg
|
||||
source ./function.sh
|
||||
ulimit -n 200000
|
||||
|
||||
list1=$(cat $config_path | grep openImApiPort | awk -F '[:]' '{print $NF}')
|
||||
list2=$(cat $config_path | grep openImWsPort | awk -F '[:]' '{print $NF}')
|
||||
ws_address=$(cat $config_path | grep openImWsAddress | awk -F '[ ]' '{print $NF}')
|
||||
api_address=$(cat $config_path | grep openImApiAddress | awk -F '[ ]' '{print $NF}')
|
||||
list3=$(cat $config_path | grep openImSdkWsPort | awk -F '[:]' '{print $NF}')
|
||||
logLevel=$(cat $config_path | grep remainLogLevel | awk -F '[:]' '{print $NF}')
|
||||
list_to_string $list1
|
||||
api_ports=($ports_array)
|
||||
list_to_string $list2
|
||||
ws_ports=($ports_array)
|
||||
list_to_string $list3
|
||||
sdk_ws_ports=($ports_array)
|
||||
list_to_string $list4
|
||||
sdkws_ports=($ports_array)
|
||||
|
||||
|
||||
|
||||
@@ -29,7 +24,8 @@ fi
|
||||
#Waiting port recycling
|
||||
sleep 1
|
||||
cd ${sdk_server_binary_root}
|
||||
nohup ./${sdk_server_name} -openIM_api_port ${api_ports[0]} -openIM_ws_port ${ws_ports[0]} -sdk_ws_port ${sdk_ws_ports[0]} -openIM_log_level ${logLevel} >>../logs/openIM.log 2>&1 &
|
||||
echo "==========================start js sdk server===========================">>../logs/openIM.log
|
||||
nohup ./${sdk_server_name} -openIM_ws_address ${ws_address} -sdk_ws_port ${sdkws_ports[0]} -openIM_api_address ${api_address} -openIM_log_level ${logLevel} >>../logs/openIM.log 2>&1 &
|
||||
|
||||
#Check launched service process
|
||||
sleep 3
|
||||
|
||||
+2
-2
@@ -5,11 +5,10 @@
|
||||
#fixme Put the shell script name here
|
||||
need_to_start_server_shell=(
|
||||
start_rpc_service.sh
|
||||
msg_gateway_start.sh
|
||||
push_start.sh
|
||||
msg_transfer_start.sh
|
||||
sdk_svr_start.sh
|
||||
demo_svr_start.sh
|
||||
msg_gateway_start.sh
|
||||
start_cron.sh
|
||||
)
|
||||
time=`date +"%Y-%m-%d %H:%M:%S"`
|
||||
@@ -23,6 +22,7 @@ echo "==========================================================">>../logs/openI
|
||||
|
||||
for i in ${need_to_start_server_shell[*]}; do
|
||||
chmod +x $i
|
||||
echo "=====================exec ${i}======================">>../logs/openIM.log
|
||||
./$i
|
||||
if [ $? -ne 0 ]; then
|
||||
exit -1
|
||||
|
||||
@@ -18,7 +18,8 @@ sleep 1
|
||||
|
||||
cd ${cron_task_binary_root}
|
||||
#for ((i = 0; i < ${cron_task_service_num}; i++)); do
|
||||
nohup ./${cron_task_name} >>../logs/openIM.log 2>&1 &
|
||||
echo "==========================start cron_task process===========================">>../logs/openIM.log
|
||||
nohup ./${cron_task_name} >>../logs/openIM.log 2>&1 &
|
||||
#done
|
||||
|
||||
#Check launched service process
|
||||
|
||||
+33
-16
@@ -8,38 +8,41 @@ source ./function.sh
|
||||
service_filename=(
|
||||
#api
|
||||
open_im_api
|
||||
open_im_cms_api
|
||||
#rpc
|
||||
open_im_user
|
||||
open_im_friend
|
||||
open_im_group
|
||||
open_im_auth
|
||||
open_im_admin_cms
|
||||
open_im_message_cms
|
||||
open_im_statistics
|
||||
${msg_name}
|
||||
open_im_office
|
||||
open_im_organization
|
||||
open_im_conversation
|
||||
open_im_third
|
||||
)
|
||||
|
||||
#service config port name
|
||||
service_port_name=(
|
||||
#api port name
|
||||
openImApiPort
|
||||
openImCmsApiPort
|
||||
#rpc port name
|
||||
openImUserPort
|
||||
openImFriendPort
|
||||
openImGroupPort
|
||||
openImAuthPort
|
||||
openImAdminCmsPort
|
||||
openImMessageCmsPort
|
||||
openImStatisticsPort
|
||||
openImMessagePort
|
||||
openImOfficePort
|
||||
openImOrganizationPort
|
||||
openImConversationPort
|
||||
openImThirdPort
|
||||
)
|
||||
|
||||
service_prometheus_port_name=(
|
||||
#api port name
|
||||
openImApiPort
|
||||
#rpc port name
|
||||
userPrometheusPort
|
||||
friendPrometheusPort
|
||||
groupPrometheusPort
|
||||
authPrometheusPort
|
||||
messagePrometheusPort
|
||||
conversationPrometheusPort
|
||||
thirdPrometheusPort
|
||||
)
|
||||
|
||||
for ((i = 0; i < ${#service_filename[*]}; i++)); do
|
||||
@@ -59,13 +62,27 @@ for ((i = 0; i < ${#service_filename[*]}; i++)); do
|
||||
#Get the rpc port in the configuration file
|
||||
portList=$(cat $config_path | grep ${service_port_name[$i]} | awk -F '[:]' '{print $NF}')
|
||||
list_to_string ${portList}
|
||||
service_ports=($ports_array)
|
||||
|
||||
portList2=$(cat $config_path | grep ${service_prometheus_port_name[$i]} | awk -F '[:]' '{print $NF}')
|
||||
list_to_string $portList2
|
||||
prome_ports=($ports_array)
|
||||
#Start related rpc services based on the number of ports
|
||||
for j in ${ports_array}; do
|
||||
for ((j = 0; j < ${#service_ports[*]}; j++)); do
|
||||
#Start the service in the background
|
||||
# ./${service_filename[$i]} -port $j &
|
||||
nohup ./${service_filename[$i]} -port $j >>../logs/openIM.log 2>&1 &
|
||||
if [ -z "${prome_ports[$j]}" ]; then
|
||||
cmd="./${service_filename[$i]} --port ${service_ports[$j]}"
|
||||
else
|
||||
cmd="./${service_filename[$i]} --port ${service_ports[$j]} --prometheus_port ${prome_ports[$j]}"
|
||||
fi
|
||||
if [ $i -eq 0 -o $i -eq 1 ]; then
|
||||
cmd="./${service_filename[$i]} --port ${service_ports[$j]}"
|
||||
fi
|
||||
echo $cmd
|
||||
echo "=====================start ${service_filename[$i]}======================">>../logs/openIM.log
|
||||
nohup $cmd >>../logs/openIM.log 2>&1 &
|
||||
sleep 1
|
||||
pid="netstat -ntlp|grep $j |awk '{printf \$7}'|cut -d/ -f1"
|
||||
echo -e "${GREEN_PREFIX}${service_filename[$i]} start success,port number:$j pid:$(eval $pid)$COLOR_SUFFIX"
|
||||
echo -e "${GREEN_PREFIX}${service_filename[$i]} start success,port number:${service_ports[$j]} pid:$(eval $pid)$COLOR_SUFFIX"
|
||||
done
|
||||
done
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#Include shell font styles and some basic information
|
||||
source ./style_info.cfg
|
||||
source ./path_info.cfg
|
||||
|
||||
|
||||
|
||||
#Check if the service exists
|
||||
#If it is exists,kill this process
|
||||
check=`ps aux | grep -w ./${timer_task_name} | grep -v grep| wc -l`
|
||||
if [ $check -ge 1 ]
|
||||
then
|
||||
oldPid=`ps aux | grep -w ./${timer_task_name} | grep -v grep|awk '{print $2}'`
|
||||
kill -9 $oldPid
|
||||
fi
|
||||
#Waiting port recycling
|
||||
sleep 1
|
||||
|
||||
cd ${timer_task_binary_root}
|
||||
nohup ./${timer_task_name} >>../logs/openIM.log 2>&1 &
|
||||
|
||||
|
||||
#Check launched service process
|
||||
check=`ps aux | grep -w ./${timer_task_name} | grep -v grep| wc -l`
|
||||
if [ $check -ge 1 ]
|
||||
then
|
||||
newPid=`ps aux | grep -w ./${timer_task_name} | grep -v grep|awk '{print $2}'`
|
||||
allPorts=""
|
||||
echo -e ${SKY_BLUE_PREFIX}"SERVICE START SUCCESS "${COLOR_SUFFIX}
|
||||
echo -e ${SKY_BLUE_PREFIX}"SERVICE_NAME: "${COLOR_SUFFIX}${YELLOW_PREFIX}${timer_task_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}${timer_task_name}${COLOR_SUFFIX}${RED_PREFIX}"SERVICE START ERROR, PLEASE CHECK openIM.log"${COLOR_SUFFIX}
|
||||
fi
|
||||
Reference in New Issue
Block a user