mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-12-10 23:07:30 +08:00
run anywhere
This commit is contained in:
parent
1a61598322
commit
e48ea6f056
20
script/batch_build_all_service.sh
Normal file → Executable file
20
script/batch_build_all_service.sh
Normal file → Executable file
@ -1,12 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
dir_name=`dirname $0`
|
||||
if [ "${dir_name:0:1}" = "/" ]; then
|
||||
cur_dir="`dirname $0`"
|
||||
else
|
||||
cur_dir="`pwd`"/"`dirname $0`"
|
||||
fi
|
||||
|
||||
source ./style_info.cfg
|
||||
source ./path_info.cfg
|
||||
source ./function.sh
|
||||
source "$cur_dir/style_info.cfg"
|
||||
source "$cur_dir/path_info.cfg"
|
||||
source "$cur_dir/function.sh"
|
||||
|
||||
bin_dir="../bin"
|
||||
logs_dir="../logs"
|
||||
sdk_db_dir="../db/sdk/"
|
||||
bin_dir="$cur_dir/../bin"
|
||||
logs_dir="$cur_dir/../logs"
|
||||
sdk_db_dir="$cur_dir/../db/sdk/"
|
||||
#Automatically created when there is no bin, logs folder
|
||||
if [ ! -d $bin_dir ]; then
|
||||
mkdir -p $bin_dir
|
||||
@ -19,7 +25,7 @@ if [ ! -d $sdk_db_dir ]; then
|
||||
fi
|
||||
|
||||
#begin path
|
||||
begin_path=$PWD
|
||||
begin_path=$cur_dir
|
||||
|
||||
|
||||
build_pid_array=()
|
||||
|
||||
25
script/batch_start_all.sh
Normal file → Executable file
25
script/batch_start_all.sh
Normal file → Executable file
@ -3,6 +3,13 @@
|
||||
#fixme The full name of the shell script that needs to be started is placed in the need_to_start_server_shell array
|
||||
|
||||
#fixme Put the shell script name here
|
||||
dir_name=`dirname $0`
|
||||
if [ "${dir_name:0:1}" = "/" ]; then
|
||||
cur_dir="`dirname $0`"
|
||||
else
|
||||
cur_dir="`pwd`"/"`dirname $0`"
|
||||
fi
|
||||
|
||||
need_to_start_server_shell=(
|
||||
start_rpc_service.sh
|
||||
msg_gateway_start.sh
|
||||
@ -12,19 +19,19 @@ need_to_start_server_shell=(
|
||||
demo_svr_start.sh
|
||||
)
|
||||
time=`date +"%Y-%m-%d %H:%M:%S"`
|
||||
echo "==========================================================">>../logs/openIM.log 2>&1 &
|
||||
echo "==========================================================">>../logs/openIM.log 2>&1 &
|
||||
echo "==========================================================">>../logs/openIM.log 2>&1 &
|
||||
echo "==========server start time:${time}===========">>../logs/openIM.log 2>&1 &
|
||||
echo "==========================================================">>../logs/openIM.log 2>&1 &
|
||||
echo "==========================================================">>../logs/openIM.log 2>&1 &
|
||||
echo "==========================================================">>../logs/openIM.log 2>&1 &
|
||||
echo "==========================================================">>$cur_dir/../logs/openIM.log 2>&1 &
|
||||
echo "==========================================================">>$cur_dir/../logs/openIM.log 2>&1 &
|
||||
echo "==========================================================">>$cur_dir/../logs/openIM.log 2>&1 &
|
||||
echo "==========server start time:${time}===========">>$cur_dir/../logs/openIM.log 2>&1 &
|
||||
echo "==========================================================">>$cur_dir/../logs/openIM.log 2>&1 &
|
||||
echo "==========================================================">>$cur_dir/../logs/openIM.log 2>&1 &
|
||||
echo "==========================================================">>$cur_dir/../logs/openIM.log 2>&1 &
|
||||
|
||||
build_pid_array=()
|
||||
idx=0
|
||||
for i in ${need_to_start_server_shell[*]}; do
|
||||
chmod +x $i
|
||||
./$i &
|
||||
chmod +x $cur_dir/$i
|
||||
$cur_dir/$i &
|
||||
build_pid=$!
|
||||
echo "build_pid " $build_pid
|
||||
build_pid_array[idx]=$build_pid
|
||||
|
||||
21
script/build_all_service.sh
Normal file → Executable file
21
script/build_all_service.sh
Normal file → Executable file
@ -1,12 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
dir_name=`dirname $0`
|
||||
if [ "${dir_name:0:1}" = "/" ]; then
|
||||
cur_dir="`dirname $0`"
|
||||
else
|
||||
cur_dir="`pwd`"/"`dirname $0`"
|
||||
fi
|
||||
source "$cur_dir/style_info.cfg"
|
||||
source "$cur_dir/path_info.cfg"
|
||||
source "$cur_dir/function.sh"
|
||||
|
||||
source ./style_info.cfg
|
||||
source ./path_info.cfg
|
||||
source ./function.sh
|
||||
|
||||
bin_dir="../bin"
|
||||
logs_dir="../logs"
|
||||
sdk_db_dir="../db/sdk/"
|
||||
bin_dir="$cur_dir/../bin"
|
||||
logs_dir="$cur_dir/../logs"
|
||||
sdk_db_dir="$cur_dir/../db/sdk/"
|
||||
#Automatically created when there is no bin, logs folder
|
||||
if [ ! -d $bin_dir ]; then
|
||||
mkdir -p $bin_dir
|
||||
@ -19,7 +24,7 @@ if [ ! -d $sdk_db_dir ]; then
|
||||
fi
|
||||
|
||||
#begin path
|
||||
begin_path=$PWD
|
||||
begin_path=$cur_dir
|
||||
|
||||
for ((i = 0; i < ${#service_source_root[*]}; i++)); do
|
||||
cd $begin_path
|
||||
|
||||
13
script/check_all.sh
Normal file → Executable file
13
script/check_all.sh
Normal file → Executable file
@ -1,8 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
source ./style_info.cfg
|
||||
source ./path_info.cfg
|
||||
source ./function.sh
|
||||
dir_name=`dirname $0`
|
||||
if [ "${dir_name:0:1}" = "/" ]; then
|
||||
cur_dir="`dirname $0`"
|
||||
else
|
||||
cur_dir="`pwd`"/"`dirname $0`"
|
||||
fi
|
||||
source "$cur_dir/style_info.cfg"
|
||||
source "$cur_dir/path_info.cfg"
|
||||
source "$cur_dir/function.sh"
|
||||
service_port_name=(
|
||||
openImWsPort
|
||||
openImApiPort
|
||||
|
||||
17
script/demo_svr_start.sh
Normal file → Executable file
17
script/demo_svr_start.sh
Normal file → Executable file
@ -1,8 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
#Include shell font styles and some basic information
|
||||
source ./style_info.cfg
|
||||
source ./path_info.cfg
|
||||
source ./function.sh
|
||||
dir_name=`dirname $0`
|
||||
if [ "${dir_name:0:1}" = "/" ]; then
|
||||
cur_dir="`dirname $0`"
|
||||
else
|
||||
cur_dir="`pwd`"/"`dirname $0`"
|
||||
fi
|
||||
|
||||
source "$cur_dir/style_info.cfg"
|
||||
source "$cur_dir/path_info.cfg"
|
||||
source "$cur_dir/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}
|
||||
@ -24,7 +31,7 @@ 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 &
|
||||
nohup ./${demo_server_name} -port ${api_ports[$i]} >>$cur_dir/../logs/openIM.log 2>&1 &
|
||||
done
|
||||
|
||||
sleep 3
|
||||
@ -44,4 +51,4 @@ if [ $check -ge 1 ]; then
|
||||
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
|
||||
fi
|
||||
|
||||
@ -1,8 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
#Include shell font styles and some basic information
|
||||
source ./style_info.cfg
|
||||
source ./path_info.cfg
|
||||
source ./function.sh
|
||||
dir_name=`dirname $0`
|
||||
if [ "${dir_name:0:1}" = "/" ]; then
|
||||
cur_dir="`dirname $0`"
|
||||
else
|
||||
cur_dir="`pwd`"/"`dirname $0`"
|
||||
fi
|
||||
|
||||
source "$cur_dir/style_info.cfg"
|
||||
source "$cur_dir/path_info.cfg"
|
||||
source "$cur_dir/function.sh"
|
||||
ulimit -n 200000
|
||||
|
||||
list1=$(cat $config_path | grep openImMessageGatewayPort | awk -F '[:]' '{print $NF}')
|
||||
@ -31,7 +38,7 @@ 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]} -prometheus_port ${prome_ports[$i]} >>../logs/openIM.log 2>&1 &
|
||||
nohup ./${msg_gateway_name} -rpc_port ${rpc_ports[$i]} -ws_port ${ws_ports[$i]} -prometheus_port ${prome_ports[$i]} >>$cur_path/../logs/openIM.log 2>&1 &
|
||||
done
|
||||
|
||||
#Check launched service process
|
||||
|
||||
@ -1,8 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
#Include shell font styles and some basic information
|
||||
source ./style_info.cfg
|
||||
source ./path_info.cfg
|
||||
source ./function.sh
|
||||
dir_name=`dirname $0`
|
||||
if [ "${dir_name:0:1}" = "/" ]; then
|
||||
cur_dir="`dirname $0`"
|
||||
else
|
||||
cur_dir="`pwd`"/"`dirname $0`"
|
||||
fi
|
||||
|
||||
source "$cur_dir/style_info.cfg"
|
||||
source "$cur_dir/path_info.cfg"
|
||||
source "$cur_dir/function.sh"
|
||||
|
||||
list1=$(cat $config_path | grep messageTransferPrometheusPort | awk -F '[:]' '{print $NF}')
|
||||
list_to_string $list1
|
||||
@ -27,7 +34,7 @@ for ((i = 0; i < ${msg_transfer_service_num}; i++)); do
|
||||
if [ $prome_port != "" ]; then
|
||||
cmd="$cmd -prometheus_port $prome_port"
|
||||
fi
|
||||
$cmd >>../logs/openIM.log 2>&1 &
|
||||
$cmd >>$cur_dir/../logs/openIM.log 2>&1 &
|
||||
done
|
||||
|
||||
#Check launched service process
|
||||
|
||||
@ -1,56 +1,63 @@
|
||||
#Don't put the space between "="
|
||||
dir_name=`dirname $0`
|
||||
if [ "${dir_name:0:1}" = "/" ]; then
|
||||
cur_path="`dirname $0`"
|
||||
else
|
||||
cur_path="`pwd`"/"`dirname $0`"
|
||||
fi
|
||||
|
||||
msg_gateway_name="open_im_msg_gateway"
|
||||
msg_gateway_binary_root="../bin/"
|
||||
msg_gateway_source_root="../cmd/open_im_msg_gateway/"
|
||||
msg_gateway_binary_root="$cur_path/../bin/"
|
||||
msg_gateway_source_root="$cur_path/../cmd/open_im_msg_gateway/"
|
||||
|
||||
msg_name="open_im_msg"
|
||||
msg_binary_root="../bin/"
|
||||
msg_source_root="../cmd/rpc/open_im_msg/"
|
||||
msg_binary_root="$cur_path/../bin/"
|
||||
msg_source_root="$cur_path/../cmd/rpc/open_im_msg/"
|
||||
|
||||
push_name="open_im_push"
|
||||
push_binary_root="../bin/"
|
||||
push_source_root="../cmd/open_im_push/"
|
||||
push_binary_root="$cur_path/../bin/"
|
||||
push_source_root="$cur_path/../cmd/open_im_push/"
|
||||
|
||||
|
||||
|
||||
msg_transfer_name="open_im_msg_transfer"
|
||||
msg_transfer_binary_root="../bin/"
|
||||
msg_transfer_source_root="../cmd/open_im_msg_transfer/"
|
||||
msg_transfer_binary_root="$cur_path/../bin/"
|
||||
msg_transfer_source_root="$cur_path/../cmd/open_im_msg_transfer/"
|
||||
msg_transfer_service_num=4
|
||||
|
||||
|
||||
sdk_server_name="open_im_sdk_server"
|
||||
sdk_server_binary_root="../bin/"
|
||||
sdk_server_binary_root="$cur_path/../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/"
|
||||
demo_server_binary_root="$cur_path/../bin/"
|
||||
demo_server_source_root="$cur_path/../cmd/open_im_demo/"
|
||||
|
||||
cron_task_name="open_im_cron_task"
|
||||
cron_task_binary_root="../bin/"
|
||||
cron_task_source_root="../cmd/open_im_cron_task/"
|
||||
cron_task_binary_root="$cur_path/../bin/"
|
||||
cron_task_source_root="$cur_path/../cmd/open_im_cron_task/"
|
||||
|
||||
|
||||
#Global configuration file default dir
|
||||
config_path="../config/config.yaml"
|
||||
config_path="$cur_path/../config/config.yaml"
|
||||
|
||||
#servicefile dir path
|
||||
service_source_root=(
|
||||
#api service file
|
||||
../cmd/open_im_api/
|
||||
../cmd/open_im_cms_api/
|
||||
$cur_path/../cmd/open_im_api/
|
||||
$cur_path/../cmd/open_im_cms_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_office/
|
||||
../cmd/rpc/open_im_organization/
|
||||
../cmd/rpc/open_im_conversation/
|
||||
../cmd/rpc/open_im_cache/
|
||||
../cmd/open_im_cron_task
|
||||
$cur_path/../cmd/rpc/open_im_user/
|
||||
$cur_path/../cmd/rpc/open_im_friend/
|
||||
$cur_path/../cmd/rpc/open_im_group/
|
||||
$cur_path/../cmd/rpc/open_im_auth/
|
||||
$cur_path/../cmd/rpc/open_im_admin_cms/
|
||||
$cur_path/../cmd/rpc/open_im_office/
|
||||
$cur_path/../cmd/rpc/open_im_organization/
|
||||
$cur_path/../cmd/rpc/open_im_conversation/
|
||||
$cur_path/../cmd/rpc/open_im_cache/
|
||||
$cur_path/../cmd/open_im_cron_task
|
||||
${msg_gateway_source_root}
|
||||
${msg_transfer_source_root}
|
||||
${msg_source_root}
|
||||
|
||||
13
script/push_start.sh
Normal file → Executable file
13
script/push_start.sh
Normal file → Executable file
@ -1,8 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
#Include shell font styles and some basic information
|
||||
source ./style_info.cfg
|
||||
source ./path_info.cfg
|
||||
source ./function.sh
|
||||
dir_name=`dirname $0`
|
||||
if [ "${dir_name:0:1}" = "/" ]; then
|
||||
cur_dir="`dirname $0`"
|
||||
else
|
||||
cur_dir="`pwd`"/"`dirname $0`"
|
||||
fi
|
||||
|
||||
source "$cur_dir/style_info.cfg"
|
||||
source "$cur_dir/path_info.cfg"
|
||||
source "$cur_dir/function.sh"
|
||||
|
||||
|
||||
|
||||
|
||||
13
script/sdk_svr_start.sh
Normal file → Executable file
13
script/sdk_svr_start.sh
Normal file → Executable file
@ -1,8 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
#Include shell font styles and some basic information
|
||||
source ./style_info.cfg
|
||||
source ./path_info.cfg
|
||||
source ./function.sh
|
||||
dir_name=`dirname $0`
|
||||
if [ "${dir_name:0:1}" = "/" ]; then
|
||||
cur_dir="`dirname $0`"
|
||||
else
|
||||
cur_dir="`pwd`"/"`dirname $0`"
|
||||
fi
|
||||
|
||||
source "$cur_dir/style_info.cfg"
|
||||
source "$cur_dir/path_info.cfg"
|
||||
source "$cur_dir/function.sh"
|
||||
ulimit -n 200000
|
||||
|
||||
ws_address=$(cat $config_path | grep openImWsAddress | awk -F '[ ]' '{print $NF}')
|
||||
|
||||
35
script/start_all.sh
Normal file → Executable file
35
script/start_all.sh
Normal file → Executable file
@ -3,27 +3,34 @@
|
||||
#fixme The full name of the shell script that needs to be started is placed in the need_to_start_server_shell array
|
||||
|
||||
#fixme Put the shell script name here
|
||||
dir_name=`dirname $0`
|
||||
if [ "${dir_name:0:1}" = "/" ]; then
|
||||
cur_dir="`dirname $0`"
|
||||
else
|
||||
cur_dir="`pwd`"/"`dirname $0`"
|
||||
fi
|
||||
|
||||
need_to_start_server_shell=(
|
||||
start_rpc_service.sh
|
||||
push_start.sh
|
||||
msg_transfer_start.sh
|
||||
sdk_svr_start.sh
|
||||
msg_gateway_start.sh
|
||||
demo_svr_start.sh
|
||||
$cur_dir/start_rpc_service.sh
|
||||
$cur_dir/push_start.sh
|
||||
$cur_dir/msg_transfer_start.sh
|
||||
$cur_dir/sdk_svr_start.sh
|
||||
$cur_dir/msg_gateway_start.sh
|
||||
$cur_dir/demo_svr_start.sh
|
||||
# start_cron.sh
|
||||
)
|
||||
time=`date +"%Y-%m-%d %H:%M:%S"`
|
||||
echo "==========================================================">>../logs/openIM.log 2>&1 &
|
||||
echo "==========================================================">>../logs/openIM.log 2>&1 &
|
||||
echo "==========================================================">>../logs/openIM.log 2>&1 &
|
||||
echo "==========server start time:${time}===========">>../logs/openIM.log 2>&1 &
|
||||
echo "==========================================================">>../logs/openIM.log 2>&1 &
|
||||
echo "==========================================================">>../logs/openIM.log 2>&1 &
|
||||
echo "==========================================================">>../logs/openIM.log 2>&1 &
|
||||
echo "==========================================================">>$cur_dir/../logs/openIM.log 2>&1 &
|
||||
echo "==========================================================">>$cur_dir/../logs/openIM.log 2>&1 &
|
||||
echo "==========================================================">>$cur_dir/../logs/openIM.log 2>&1 &
|
||||
echo "==========server start time:${time}===========">>$cur_dir/../logs/openIM.log 2>&1 &
|
||||
echo "==========================================================">>$cur_dir/../logs/openIM.log 2>&1 &
|
||||
echo "==========================================================">>$cur_dir/../logs/openIM.log 2>&1 &
|
||||
echo "==========================================================">>$cur_dir/../logs/openIM.log 2>&1 &
|
||||
|
||||
for i in ${need_to_start_server_shell[*]}; do
|
||||
chmod +x $i
|
||||
./$i
|
||||
$i
|
||||
if [ $? -ne 0 ]; then
|
||||
exit -1
|
||||
fi
|
||||
|
||||
0
script/start_cron.sh
Normal file → Executable file
0
script/start_cron.sh
Normal file → Executable file
16
script/start_rpc_service.sh
Normal file → Executable file
16
script/start_rpc_service.sh
Normal file → Executable file
@ -1,8 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
dir_name=`dirname $0`
|
||||
if [ "${dir_name:0:1}" = "/" ]; then
|
||||
cur_dir="`dirname $0`"
|
||||
else
|
||||
cur_dir="`pwd`"/"`dirname $0`"
|
||||
fi
|
||||
|
||||
source ./style_info.cfg
|
||||
source ./path_info.cfg
|
||||
source ./function.sh
|
||||
source "$cur_dir/style_info.cfg"
|
||||
source "$cur_dir/path_info.cfg"
|
||||
source "$cur_dir/function.sh"
|
||||
|
||||
#service filename
|
||||
service_filename=(
|
||||
@ -70,7 +76,7 @@ for ((i = 0; i < ${#service_filename[*]}; i++)); do
|
||||
kill -9 $(eval $pid)
|
||||
sleep 0.5
|
||||
fi
|
||||
cd ../bin
|
||||
cd "$cur_dir/../bin"
|
||||
#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}
|
||||
@ -87,7 +93,7 @@ for ((i = 0; i < ${#service_filename[*]}; i++)); do
|
||||
cmd="./${service_filename[$i]} -port ${service_ports[$j]}"
|
||||
fi
|
||||
echo $cmd
|
||||
nohup $cmd >>../logs/openIM.log 2>&1 &
|
||||
nohup $cmd >>$cur_dir/../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:${service_ports[$j]} pid:$(eval $pid)$COLOR_SUFFIX"
|
||||
|
||||
10
script/stop_all.sh
Normal file → Executable file
10
script/stop_all.sh
Normal file → Executable file
@ -1,8 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
#fixme This script is to stop the service
|
||||
dir_name=`dirname $0`
|
||||
if [ "${dir_name:0:1}" = "/" ]; then
|
||||
cur_dir="`dirname $0`"
|
||||
else
|
||||
cur_dir="`pwd`"/"`dirname $0`"
|
||||
fi
|
||||
|
||||
source ./style_info.cfg
|
||||
source ./path_info.cfg
|
||||
source "$cur_dir/style_info.cfg"
|
||||
source "$cur_dir/path_info.cfg"
|
||||
|
||||
|
||||
for i in ${service_names[*]}; do
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user