mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
feat: add all page
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
This commit is contained in:
parent
f7bd391ed7
commit
d6a89567e5
@ -22,7 +22,6 @@ need_to_start_server_shell=(
|
|||||||
msg_gateway_start.sh
|
msg_gateway_start.sh
|
||||||
push_start.sh
|
push_start.sh
|
||||||
msg_transfer_start.sh
|
msg_transfer_start.sh
|
||||||
sdk_svr_start.sh
|
|
||||||
)
|
)
|
||||||
time=`date +"%Y-%m-%d %H:%M:%S"`
|
time=`date +"%Y-%m-%d %H:%M:%S"`
|
||||||
echo "==========================================================">>../logs/openIM.log 2>&1 &
|
echo "==========================================================">>../logs/openIM.log 2>&1 &
|
||||||
@ -70,5 +69,3 @@ if [ $success_num == ${#need_to_start_server_shell[*]} ]
|
|||||||
then
|
then
|
||||||
echo -e ${YELLOW_PREFIX}"all services build success"${COLOR_SUFFIX}
|
echo -e ${YELLOW_PREFIX}"all services build success"${COLOR_SUFFIX}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,11 +17,18 @@
|
|||||||
source ./style_info.cfg
|
source ./style_info.cfg
|
||||||
source ./path_info.cfg
|
source ./path_info.cfg
|
||||||
source ./function.sh
|
source ./function.sh
|
||||||
|
echo -e "\n"
|
||||||
|
|
||||||
|
echo -e "${BACKGROUND_BLUE}===============> Building all using make build binary files ${COLOR_SUFFIX}"
|
||||||
|
|
||||||
|
echo -e "\n"
|
||||||
|
echo -e "${BOLD_PREFIX}_____ _ _ _____ _____ _____ _____ _____ _____ _____ _____ _____ ${COLOR_SUFFIX}"
|
||||||
|
|
||||||
|
|
||||||
bin_dir="../bin"
|
bin_dir="../bin"
|
||||||
logs_dir="../logs"
|
logs_dir="../logs"
|
||||||
sdk_db_dir="../db/sdk/"
|
sdk_db_dir="../db/sdk/"
|
||||||
#Automatically created when there is no bin, logs folder
|
# Automatically created when there is no bin, logs folder
|
||||||
if [ ! -d $bin_dir ]; then
|
if [ ! -d $bin_dir ]; then
|
||||||
mkdir -p $bin_dir
|
mkdir -p $bin_dir
|
||||||
fi
|
fi
|
||||||
@ -32,19 +39,86 @@ if [ ! -d $sdk_db_dir ]; then
|
|||||||
mkdir -p $sdk_db_dir
|
mkdir -p $sdk_db_dir
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#begin path
|
# OpenIM root path
|
||||||
begin_path=$PWD
|
OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||||
|
|
||||||
for ((i = 0; i < ${#service_source_root[*]}; i++)); do
|
source ./style_info.cfg
|
||||||
cd $begin_path
|
source ./path_info.cfg
|
||||||
service_path=${service_source_root[$i]}
|
source ./function.sh
|
||||||
cd $service_path
|
|
||||||
make install
|
#!/bin/bash
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo -e "${RED_PREFIX}${service_names[$i]} build failed ${COLOR_SUFFIX}\n"
|
cd $OPENIM_ROOT
|
||||||
exit -1
|
|
||||||
else
|
# Execute 'make build'
|
||||||
echo -e "${GREEN_PREFIX}${service_names[$i]} successfully be built ${COLOR_SUFFIX}\n"
|
make build
|
||||||
fi
|
|
||||||
|
# Get the current operating system and architecture
|
||||||
|
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
|
||||||
|
ARCH=$(uname -m)
|
||||||
|
|
||||||
|
# Select the repository home directory based on the operating system and architecture
|
||||||
|
if [[ "$OS" == "darwin" ]]; then
|
||||||
|
if [[ "$ARCH" == "x86_64" ]]; then
|
||||||
|
REPO_DIR="darwin/amd64"
|
||||||
|
else
|
||||||
|
REPO_DIR="darwin/386"
|
||||||
|
fi
|
||||||
|
elif [[ "$OS" == "linux" ]]; then
|
||||||
|
if [[ "$ARCH" == "x86_64" ]]; then
|
||||||
|
REPO_DIR="linux/amd64"
|
||||||
|
elif [[ "$ARCH" == "arm64" ]]; then
|
||||||
|
REPO_DIR="linux/arm64"
|
||||||
|
elif [[ "$ARCH" == "mips64" ]]; then
|
||||||
|
REPO_DIR="linux/mips64"
|
||||||
|
elif [[ "$ARCH" == "mips64le" ]]; then
|
||||||
|
REPO_DIR="linux/mips64le"
|
||||||
|
elif [[ "$ARCH" == "ppc64le" ]]; then
|
||||||
|
REPO_DIR="linux/ppc64le"
|
||||||
|
elif [[ "$ARCH" == "s390x" ]]; then
|
||||||
|
REPO_DIR="linux/s390x"
|
||||||
|
else
|
||||||
|
REPO_DIR="linux/386"
|
||||||
|
fi
|
||||||
|
elif [[ "$OS" == "windows" ]]; then
|
||||||
|
if [[ "$ARCH" == "x86_64" ]]; then
|
||||||
|
REPO_DIR="windows/amd64"
|
||||||
|
else
|
||||||
|
REPO_DIR="windows/386"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo -e "${RED_PREFIX}Unsupported OS: $OS${COLOR_SUFFIX}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Determine if all scripts were successfully built
|
||||||
|
BUILD_SUCCESS=true
|
||||||
|
FAILED_SCRIPTS=()
|
||||||
|
|
||||||
|
for binary in $(find _output/bin/platforms/$REPO_DIR -type f); do
|
||||||
|
if [[ ! -x $binary ]]; then
|
||||||
|
FAILED_SCRIPTS+=("$binary")
|
||||||
|
BUILD_SUCCESS=false
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
echo -e ${YELLOW_PREFIX}"all services build success"${COLOR_SUFFIX}
|
|
||||||
|
echo -e " \n"
|
||||||
|
|
||||||
|
echo -e "${BOLD_PREFIX}=====================> Build Results <=====================${COLOR_SUFFIX}"
|
||||||
|
|
||||||
|
echo -e " \n"
|
||||||
|
|
||||||
|
if [[ "$BUILD_SUCCESS" == true ]]; then
|
||||||
|
echo -e "${GREEN_PREFIX}All binaries built successfully.${COLOR_SUFFIX}"
|
||||||
|
else
|
||||||
|
echo -e "${RED_PREFIX}Some binary builds failed. Please check the following binary files:${COLOR_SUFFIX}"
|
||||||
|
for script in "${FAILED_SCRIPTS[@]}"; do
|
||||||
|
echo -e "${RED_PREFIX}$script${COLOR_SUFFIX}"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e " \n"
|
||||||
|
|
||||||
|
echo -e "${BOLD_PREFIX}============================================================${COLOR_SUFFIX}"
|
||||||
|
|
||||||
|
echo -e " \n"
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
source ./style_info.cfg
|
source ./style_info.cfg
|
||||||
source ./path_info.cfg
|
source ./path_info.cfg
|
||||||
source ./function.sh
|
source ./function.sh
|
||||||
|
|
||||||
service_port_name=(
|
service_port_name=(
|
||||||
openImWsPort
|
openImWsPort
|
||||||
openImApiPort
|
openImApiPort
|
||||||
|
@ -18,8 +18,6 @@ source ./style_info.cfg
|
|||||||
source ./path_info.cfg
|
source ./path_info.cfg
|
||||||
source ./function.sh
|
source ./function.sh
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
list1=$(cat $config_path | grep openImPushPort | awk -F '[:]' '{print $NF}')
|
list1=$(cat $config_path | grep openImPushPort | awk -F '[:]' '{print $NF}')
|
||||||
list2=$(cat $config_path | grep pushPrometheusPort | awk -F '[:]' '{print $NF}')
|
list2=$(cat $config_path | grep pushPrometheusPort | awk -F '[:]' '{print $NF}')
|
||||||
list_to_string $list1
|
list_to_string $list1
|
||||||
|
@ -1,60 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
# Copyright © 2023 OpenIM. All rights reserved.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
|
|
||||||
#Include shell font styles and some basic information
|
|
||||||
source ./style_info.cfg
|
|
||||||
source ./path_info.cfg
|
|
||||||
source ./function.sh
|
|
||||||
ulimit -n 200000
|
|
||||||
|
|
||||||
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 $list3
|
|
||||||
sdkws_ports=($ports_array)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#Check if the service exists
|
|
||||||
#If it is exists,kill this process
|
|
||||||
check=$(ps aux | grep -w ./${sdk_server_name} | grep -v grep | wc -l)
|
|
||||||
if [ $check -ge 1 ]; then
|
|
||||||
oldPid=$(ps aux | grep -w ./${sdk_server_name} | grep -v grep | awk '{print $2}')
|
|
||||||
kill -9 ${oldPid}
|
|
||||||
fi
|
|
||||||
#Waiting port recycling
|
|
||||||
sleep 1
|
|
||||||
cd ${sdk_server_binary_root}
|
|
||||||
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
|
|
||||||
check=$(ps aux | grep -w ./${sdk_server_name} | grep -v grep | wc -l)
|
|
||||||
allPorts=""
|
|
||||||
if [ $check -ge 1 ]; then
|
|
||||||
allNewPid=$(ps aux | grep -w ./${sdk_server_name} | grep -v grep | awk '{print $2}')
|
|
||||||
for i in $allNewPid; do
|
|
||||||
ports=$(netstat -netulp | grep -w ${i} | awk '{print $4}' | awk -F '[:]' '{print $NF}')
|
|
||||||
allPorts=${allPorts}"$ports "
|
|
||||||
done
|
|
||||||
echo -e ${SKY_BLUE_PREFIX}"SERVICE START SUCCESS "${COLOR_SUFFIX}
|
|
||||||
echo -e ${SKY_BLUE_PREFIX}"SERVICE_NAME: "${COLOR_SUFFIX}${YELLOW_PREFIX}${sdk_server_name}${COLOR_SUFFIX}
|
|
||||||
echo -e ${SKY_BLUE_PREFIX}"PID: "${COLOR_SUFFIX}${YELLOW_PREFIX}${allNewPid}${COLOR_SUFFIX}
|
|
||||||
echo -e ${SKY_BLUE_PREFIX}"LISTENING_PORT: "${COLOR_SUFFIX}${YELLOW_PREFIX}${allPorts}${COLOR_SUFFIX}
|
|
||||||
else
|
|
||||||
echo -e ${YELLOW_PREFIX}${sdk_server_name}${COLOR_SUFFIX}${RED_PREFIX}"SERVICE START ERROR PLEASE CHECK openIM.log"${COLOR_SUFFIX}
|
|
||||||
fi
|
|
@ -16,30 +16,56 @@
|
|||||||
#FIXME This script is the startup script for multiple servers.
|
#FIXME This script is the startup script for multiple servers.
|
||||||
#FIXME The full names of the shell scripts that need to be started are placed in the `need_to_start_server_shell` array.
|
#FIXME The full names of the shell scripts that need to be started are placed in the `need_to_start_server_shell` array.
|
||||||
|
|
||||||
#FIXME Put the shell script names here
|
#Include shell font styles and some basic information
|
||||||
|
source ./style_info.cfg
|
||||||
|
source ./path_info.cfg
|
||||||
|
|
||||||
|
# Print title
|
||||||
|
echo -e "${BOLD_PREFIX}${BLUE_PREFIX}OpenIM Server Start${COLOR_SUFFIX}"
|
||||||
|
|
||||||
|
# Get current time
|
||||||
|
time=$(date +"%Y-%m-%d %H:%M:%S")
|
||||||
|
|
||||||
|
# Print section separator
|
||||||
|
echo -e "${PURPLE_PREFIX}==========================================================${COLOR_SUFFIX}"
|
||||||
|
|
||||||
|
# Print server start time
|
||||||
|
echo -e "${BOLD_PREFIX}${CYAN_PREFIX}Server Start Time: ${time}${COLOR_SUFFIX}"
|
||||||
|
|
||||||
|
# Print section separator
|
||||||
|
echo -e "${PURPLE_PREFIX}==========================================================${COLOR_SUFFIX}"
|
||||||
|
|
||||||
|
# FIXME Put the shell script names here
|
||||||
need_to_start_server_shell=(
|
need_to_start_server_shell=(
|
||||||
start_rpc_service.sh
|
start_rpc_service.sh
|
||||||
push_start.sh
|
push_start.sh
|
||||||
msg_transfer_start.sh
|
msg_transfer_start.sh
|
||||||
# sdk_svr_start.sh
|
|
||||||
msg_gateway_start.sh
|
msg_gateway_start.sh
|
||||||
start_cron.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 &
|
|
||||||
|
|
||||||
|
# Loop through the script names and execute them
|
||||||
for i in ${need_to_start_server_shell[*]}; do
|
for i in ${need_to_start_server_shell[*]}; do
|
||||||
chmod +x $i
|
chmod +x $i
|
||||||
echo "=====================exec ${i}======================" >> ../logs/openIM.log
|
|
||||||
|
echo -e ""
|
||||||
|
# Print script execution message
|
||||||
|
echo -e "=========> ${YELLOW_PREFIX}Executing ${i}...${COLOR_SUFFIX}"
|
||||||
|
echo -e ""
|
||||||
|
|
||||||
./$i
|
./$i
|
||||||
|
|
||||||
|
# Check if the script executed successfully
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
|
# Print error message and exit
|
||||||
|
echo "${BOLD_PREFIX}${RED_PREFIX}Error executing ${i}. Exiting...${COLOR_SUFFIX}"
|
||||||
exit -1
|
exit -1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Print section separator
|
||||||
|
echo "${PURPLE_PREFIX}==========================================================${COLOR_SUFFIX}"
|
||||||
|
|
||||||
|
# Print completion message
|
||||||
|
echo "${GREEN_PREFIX}${BOLD_PREFIX}OpenIM Server has been started successfully!${COLOR_SUFFIX}"
|
@ -1,9 +1,44 @@
|
|||||||
#Shell font formatting information
|
COLOR_SUFFIX="\033[0m" # End all colors and special effects
|
||||||
COLOR_SUFFIX="\033[0m"
|
|
||||||
BLACK_PREFIX="\033[30m"
|
BLACK_PREFIX="\033[30m" # Black prefix
|
||||||
RED_PREFIX="\033[31m"
|
RED_PREFIX="\033[31m" # Red prefix
|
||||||
GREEN_PREFIX="\033[32m"
|
GREEN_PREFIX="\033[32m" # Green prefix
|
||||||
YELLOW_PREFIX="\033[33m"
|
YELLOW_PREFIX="\033[33m" # Yellow prefix
|
||||||
BLUE_PREFIX="\033[34m"
|
BLUE_PREFIX="\033[34m" # Blue prefix
|
||||||
PURPLE_PREFIX="\033[35m"
|
PURPLE_PREFIX="\033[35m" # Purple prefix
|
||||||
SKY_BLUE_PREFIX="\033[36m"
|
SKY_BLUE_PREFIX="\033[36m" # Sky blue prefix
|
||||||
|
WHITE_PREFIX="\033[37m" # White prefix
|
||||||
|
BOLD_PREFIX="\033[1m" # Bold prefix
|
||||||
|
UNDERLINE_PREFIX="\033[4m" # Underline prefix
|
||||||
|
ITALIC_PREFIX="\033[3m" # Italic prefix
|
||||||
|
|
||||||
|
BACKGROUND_BLACK="\033[40m" # Black background
|
||||||
|
BACKGROUND_RED="\033[41m" # Red background
|
||||||
|
BACKGROUND_GREEN="\033[42m" # Green background
|
||||||
|
BACKGROUND_YELLOW="\033[43m" # Yellow background
|
||||||
|
BACKGROUND_BLUE="\033[44m" # Blue background
|
||||||
|
BACKGROUND_PURPLE="\033[45m" # Purple background
|
||||||
|
BACKGROUND_SKY_BLUE="\033[46m" # Sky blue background
|
||||||
|
BACKGROUND_WHITE="\033[47m" # White background
|
||||||
|
|
||||||
|
BLINK="\033[5m" # Blinking effect
|
||||||
|
INVERT="\033[7m" # Invert color
|
||||||
|
HIDE="\033[8m" # Hide text
|
||||||
|
|
||||||
|
GRAY_PREFIX="\033[90m" # Gray prefix
|
||||||
|
LIGHT_RED_PREFIX="\033[91m" # Light red prefix
|
||||||
|
LIGHT_GREEN_PREFIX="\033[92m" # Light green prefix
|
||||||
|
LIGHT_YELLOW_PREFIX="\033[93m" # Light yellow prefix
|
||||||
|
LIGHT_BLUE_PREFIX="\033[94m" # Light blue prefix
|
||||||
|
LIGHT_PURPLE_PREFIX="\033[95m" # Light purple prefix
|
||||||
|
LIGHT_SKY_BLUE_PREFIX="\033[96m" # Light sky blue prefix
|
||||||
|
LIGHT_WHITE_PREFIX="\033[97m" # Light white prefix
|
||||||
|
|
||||||
|
BACKGROUND_GRAY="\033[100m" # Gray background
|
||||||
|
BACKGROUND_LIGHT_RED="\033[101m" # Light red background
|
||||||
|
BACKGROUND_LIGHT_GREEN="\033[102m" # Light green background
|
||||||
|
BACKGROUND_LIGHT_YELLOW="\033[103m" # Light yellow background
|
||||||
|
BACKGROUND_LIGHT_BLUE="\033[104m" # Light blue background
|
||||||
|
BACKGROUND_LIGHT_PURPLE="\033[105m" # Light purple background
|
||||||
|
BACKGROUND_LIGHT_SKY_BLUE="\033[106m" # Light sky blue background
|
||||||
|
BACKGROUND_LIGHT_WHITE="\033[107m" # Light white background
|
||||||
|
Loading…
x
Reference in New Issue
Block a user