mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-04-28 06:19:20 +08:00
feat: add scripts (#525)
This commit is contained in:
@@ -35,8 +35,8 @@ echo -e "${BOLD_PREFIX}_________________________________________________________
|
||||
|
||||
|
||||
bin_dir="$BIN_DIR"
|
||||
logs_dir="../logs"
|
||||
sdk_db_dir="../db/sdk/"
|
||||
logs_dir="$OPENIM_ROOT/logs"
|
||||
sdk_db_dir="$OPENIM_ROOT/db/sdk/"
|
||||
# Automatically created when there is no bin, logs folder
|
||||
if [ ! -d $bin_dir ]; then
|
||||
mkdir -p $bin_dir
|
||||
|
||||
@@ -43,7 +43,7 @@ for i in ${service_port_name[*]}; do
|
||||
port=$(ss -tunlp| grep openim | awk '{print $5}' | grep -w ${j} | awk -F '[:]' '{print $NF}')
|
||||
if [[ ${port} -ne ${j} ]]; then
|
||||
echo -e ${BACKGROUND_GREEN}${i}${COLOR_SUFFIX}${RED_PREFIX}" service does not start normally,not initiated port is "${COLOR_SUFFIX}${BACKGROUND_GREEN}${j}${COLOR_SUFFIX}
|
||||
echo -e ${RED_PREFIX}"please check $OPENIM_ROOT/logs/openIM.log "${COLOR_SUFFIX}
|
||||
echo -e ${RED_PREFIX}"please check $OPENIM_ROOT/logs/openIM.log"${COLOR_SUFFIX}
|
||||
exit -1
|
||||
else
|
||||
echo -e ${j}${GREEN_PREFIX}" port has been listening,belongs service is "${i}${COLOR_SUFFIX}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
LC_ALL=C
|
||||
|
||||
local_branch="$(git rev-parse --abbrev-ref HEAD)"
|
||||
valid_branch_regex="^(main|master|develop|release)$|(feature|feat|openim|hotfix|test|bug|ci|cicd|style|)\/[a-z0-9._-]+$|^HEAD$"
|
||||
valid_branch_regex="^(main|master|develop|release(-[a-zA-Z0-9._-]+)?)$|(feature|feat|openim|hotfix|test|bug|ci|cicd|style|)\/[a-z0-9._-]+$|^HEAD$"
|
||||
|
||||
YELLOW="\e[93m"
|
||||
GREEN="\e[32m"
|
||||
|
||||
@@ -21,6 +21,9 @@ GREEN="\e[32m"
|
||||
RED="\e[31m"
|
||||
ENDCOLOR="\e[0m"
|
||||
|
||||
local_branch="$(git rev-parse --abbrev-ref HEAD)"
|
||||
valid_branch_regex="^(main|master|develop|release(-[a-zA-Z0-9._-]+)?)$|(feature|feat|openim|hotfix|test|bug|ci|cicd|style|)\/[a-z0-9._-]+$|^HEAD$"
|
||||
|
||||
printMessage() {
|
||||
printf "${YELLOW}OpenIM : $1${ENDCOLOR}\n"
|
||||
}
|
||||
@@ -96,6 +99,14 @@ print_color "Added Files: ${added_files}" "${BACKGROUND_GREEN}"
|
||||
print_color "Modified Files: ${modified_files}" "${BACKGROUND_GREEN}"
|
||||
print_color "Deleted Files: ${deleted_files}" "${BACKGROUND_GREEN}"
|
||||
|
||||
if [[ ! $local_branch =~ $valid_branch_regex ]]
|
||||
then
|
||||
printError "There is something wrong with your branch name. Branch names in this project must adhere to this contract: $valid_branch_regex.
|
||||
Your commit will be rejected. You should rename your branch to a valid name(feat/name OR bug/name) and try again."
|
||||
printError "For more on this, read on: https://gist.github.com/cubxxw/126b72104ac0b0ca484c9db09c3e5694"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#
|
||||
#printMessage "Running the Flutter analyzer"
|
||||
#flutter analyze
|
||||
|
||||
@@ -61,7 +61,7 @@ sleep 1
|
||||
cd ${msg_gateway_binary_root}
|
||||
for ((i = 0; i < ${#ws_ports[@]}; i++)); do
|
||||
echo "==========================start msg_gateway server===========================">>$OPENIM_ROOT/logs/openIM.log
|
||||
nohup ./${openim_msggateway} --port ${rpc_ports[$i]} --ws_port ${ws_ports[$i]} --prometheus_port ${prome_ports[$i]} --config_folder_path ${configfile_path} >>$OPENIM_ROOT/logs/openIM.log 2>&1 &
|
||||
nohup ./${openim_msggateway} --port ${rpc_ports[$i]} --ws_port ${ws_ports[$i]} --prometheus_port ${prome_ports[$i]} --config_folder_path ${configfile_path} --configFolderPath ${log_path} >>$OPENIM_ROOT/logs/openIM.log 2>&1 &
|
||||
done
|
||||
|
||||
#Check launched service process
|
||||
|
||||
@@ -55,9 +55,9 @@ sleep 1
|
||||
cd ${msg_transfer_binary_root}
|
||||
for ((i = 0; i < ${msg_transfer_service_num}; i++)); do
|
||||
prome_port=${prome_ports[$i]}
|
||||
cmd="nohup ./${openim_msgtransfer} --config_folder_path ${configfile_path}"
|
||||
cmd="nohup ./${openim_msgtransfer} --config_folder_path ${configfile_path} --configFolderPath ${log_path}"
|
||||
if [ $prome_port != "" ]; then
|
||||
cmd="$cmd --prometheus_port $prome_port --config_folder_path ${configfile_path}"
|
||||
cmd="$cmd --prometheus_port $prome_port --config_folder_path ${configfile_path} --configFolderPath ${log_path}"
|
||||
fi
|
||||
echo "==========================start msg_transfer server===========================">>$OPENIM_ROOT/logs/openIM.log
|
||||
$cmd >>$OPENIM_ROOT/logs/openIM.log 2>&1 &
|
||||
|
||||
@@ -82,6 +82,7 @@ cmd_utils_source_root="$OPENIM_ROOT/cmd/openim-cmdutils/"
|
||||
# Global configuration file default dir
|
||||
config_path="$OPENIM_ROOT/config/config.yaml"
|
||||
configfile_path="$OPENIM_ROOT/config"
|
||||
log_path="$OPENIM_ROOT/log"
|
||||
|
||||
# servicefile dir path
|
||||
service_source_root=(
|
||||
|
||||
@@ -35,6 +35,18 @@ bin_dir="$BIN_DIR"
|
||||
logs_dir="$OPENIM_ROOT/logs"
|
||||
sdk_db_dir="$OPENIM_ROOT/sdk/db/"
|
||||
|
||||
if [ ! -d "$bin_dir" ]; then
|
||||
mkdir -p "$bin_dir"
|
||||
fi
|
||||
|
||||
if [ ! -d "$logs_dir" ]; then
|
||||
mkdir -p "$logs_dir"
|
||||
fi
|
||||
|
||||
if [ ! -d "$sdk_db_dir" ]; then
|
||||
mkdir -p "$sdk_db_dir"
|
||||
fi
|
||||
|
||||
# Print title
|
||||
echo -e "${BOLD_PREFIX}${BLUE_PREFIX}================> OpenIM Server Start${COLOR_SUFFIX}"
|
||||
|
||||
|
||||
@@ -100,9 +100,9 @@ for ((i = 0; i < ${#service_filename[*]}; i++)); do
|
||||
for ((j = 0; j < ${#service_ports[*]}; j++)); do
|
||||
#Start the service in the background
|
||||
if [ -z "${prome_ports[$j]}" ]; then
|
||||
cmd="./${service_filename[$i]} --port ${service_ports[$j]} --config_folder_path ${configfile_path}"
|
||||
cmd="./${service_filename[$i]} --port ${service_ports[$j]} --config_folder_path ${configfile_path} --configFolderPath ${log_path}"
|
||||
else
|
||||
cmd="./${service_filename[$i]} --port ${service_ports[$j]} --prometheus_port ${prome_ports[$j]} --config_folder_path ${configfile_path}"
|
||||
cmd="./${service_filename[$i]} --port ${service_ports[$j]} --prometheus_port ${prome_ports[$j]} --config_folder_path ${configfile_path} --configFolderPath ${log_path}"
|
||||
fi
|
||||
if [ $i -eq 0 -o $i -eq 1 ]; then
|
||||
cmd="./${service_filename[$i]} --port ${service_ports[$j]}"
|
||||
|
||||
Reference in New Issue
Block a user