demo merge into project

This commit is contained in:
Gordon
2021-12-01 12:16:02 +08:00
parent bd62da8e1a
commit 15660663f6
20 changed files with 788 additions and 7 deletions
+1
View File
@@ -14,6 +14,7 @@ service_port_name=(
openImPushPort
openImWsPort
openImSdkWsPort
openImDemoPort
)
for i in ${service_port_name[*]}; do
list=$(cat $config_path | grep -w ${i} | awk -F '[:]' '{print $NF}')
+47
View File
@@ -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 )
if [[ ${switch} -ne 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_source_root}
for ((i = 0; i < ${#rpc_ports[@]}; i++)); do
nohup ./${demo_server_name} -port ${rpc_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
+1
View File
@@ -10,6 +10,7 @@ need_to_start_server_shell=(
msg_transfer_start.sh
sdk_svr_start.sh
timer_start.sh
demo_svr_start.sh
)
#fixme The 10 second delay to start the project is for the docker-compose one-click to start openIM when the infrastructure dependencies are not started
+6
View File
@@ -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_sdk_server"
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}
)
+1
View File
@@ -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