mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-10-27 14:02:15 +08:00
feat: add rpc build and start
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
This commit is contained in:
parent
405776d321
commit
fd894c3d83
@ -21,15 +21,11 @@ set -o pipefail
|
|||||||
|
|
||||||
# Sourced flag
|
# Sourced flag
|
||||||
COMMON_SOURCED=true
|
COMMON_SOURCED=true
|
||||||
|
|
||||||
# The root of the build/dist directory
|
# The root of the build/dist directory
|
||||||
OPENIM_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")"/../.. && pwd -P)
|
OPENIM_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")"/../.. && pwd -P)
|
||||||
|
|
||||||
source "${OPENIM_ROOT}/scripts/lib/init.sh"
|
source "${OPENIM_ROOT}/scripts/lib/init.sh"
|
||||||
|
|
||||||
# Make sure the environment is only called via common to avoid too much nesting
|
# Make sure the environment is only called via common to avoid too much nesting
|
||||||
source "${OPENIM_ROOT}/scripts/install/environment.sh"
|
source "${OPENIM_ROOT}/scripts/install/environment.sh"
|
||||||
|
|
||||||
# This function returns a list of Prometheus ports for various services
|
# This function returns a list of Prometheus ports for various services
|
||||||
# based on the provided configuration. Each service has its own dedicated
|
# based on the provided configuration. Each service has its own dedicated
|
||||||
# port for monitoring purposes.
|
# port for monitoring purposes.
|
||||||
@ -79,7 +75,6 @@ IFS=" " read -ra OPENIM_SERVER_PORT_TARGETS <<< "$(openim::common::service_port)
|
|||||||
readonly OPENIM_SERVER_PORT_TARGETS
|
readonly OPENIM_SERVER_PORT_TARGETS
|
||||||
readonly OPENIM_SERVER_PORT_LISTARIES=("${OPENIM_SERVER_PORT_TARGETS[@]##*/}")
|
readonly OPENIM_SERVER_PORT_LISTARIES=("${OPENIM_SERVER_PORT_TARGETS[@]##*/}")
|
||||||
|
|
||||||
|
|
||||||
# Execute commands that require root permission without entering a password
|
# Execute commands that require root permission without entering a password
|
||||||
function openim::common::sudo {
|
function openim::common::sudo {
|
||||||
echo ${LINUX_PASSWORD} | sudo -S $1
|
echo ${LINUX_PASSWORD} | sudo -S $1
|
||||||
|
|||||||
@ -22,7 +22,7 @@ OPENIM_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd -P)"
|
|||||||
|
|
||||||
# 生成文件存放目录
|
# 生成文件存放目录
|
||||||
LOCAL_OUTPUT_ROOT="${OPENIM_ROOT}/${OUT_DIR:-_output}"
|
LOCAL_OUTPUT_ROOT="${OPENIM_ROOT}/${OUT_DIR:-_output}"
|
||||||
source "${OPENIM_ROOT}/scripts/lib/init.sh"
|
source "${OPENIM_ROOT}/scripts/lib/util.sh"
|
||||||
|
|
||||||
IP=$(openim::util::get_server_ip)
|
IP=$(openim::util::get_server_ip)
|
||||||
|
|
||||||
@ -134,8 +134,8 @@ def "RPC_REGISTER_IP" # RPC的注册IP
|
|||||||
def "RPC_LISTEN_IP" "0.0.0.0" # RPC的监听IP
|
def "RPC_LISTEN_IP" "0.0.0.0" # RPC的监听IP
|
||||||
|
|
||||||
###################### API 配置信息 ######################
|
###################### API 配置信息 ######################
|
||||||
# API的开放端口
|
# API的开放端口, 只能设置一个端口
|
||||||
readonly API_OPENIM_PORT=${API_OPENIM_PORT:-'10002'}
|
def "API_OPENIM_PORT" "10002"
|
||||||
def "API_LISTEN_IP" "0.0.0.0" # API的监听IP
|
def "API_LISTEN_IP" "0.0.0.0" # API的监听IP
|
||||||
|
|
||||||
###################### RPC Port Configuration Variables ######################
|
###################### RPC Port Configuration Variables ######################
|
||||||
|
|||||||
88
scripts/install/openim-api.sh
Normal file → Executable file
88
scripts/install/openim-api.sh
Normal file → Executable file
@ -0,0 +1,88 @@
|
|||||||
|
#!/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.
|
||||||
|
|
||||||
|
set -o errexit
|
||||||
|
set +o nounset
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
OPENIM_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")"/../.. && pwd -P)
|
||||||
|
[[ -z ${COMMON_SOURCED} ]] && source ${OPENIM_ROOT}/scripts/install/common.sh
|
||||||
|
|
||||||
|
SERVER_NAME="openim-api"
|
||||||
|
|
||||||
|
readonly OPENIM_API_PORT_TARGETS=(
|
||||||
|
${API_OPENIM_PORT}
|
||||||
|
)
|
||||||
|
readonly OPENIM_API_PORT_LISTARIES=("${OPENIM_API_PORT_TARGETS[@]##*/}")
|
||||||
|
|
||||||
|
readonly OPENIM_API_SERVICE_TARGETS=(
|
||||||
|
openim-api
|
||||||
|
)
|
||||||
|
readonly OPENIM_API_SERVICE_LISTARIES=("${OPENIM_API_SERVICE_TARGETS[@]##*/}")
|
||||||
|
|
||||||
|
echo "++ OPENIM_API_SERVICE_LISTARIES: ${OPENIM_API_SERVICE_LISTARIES[@]}"
|
||||||
|
echo "++ OPENIM_API_PORT_LISTARIES: ${OPENIM_API_PORT_LISTARIES[@]}"
|
||||||
|
echo "++ OpenIM API config path: ${OPENIM_API_CONFIG}"
|
||||||
|
|
||||||
|
openim::log::info "Starting ${SERVER_NAME} ..."
|
||||||
|
|
||||||
|
printf "+------------------------+--------------+\n"
|
||||||
|
printf "| Service Name | Port |\n"
|
||||||
|
printf "+------------------------+--------------+\n"
|
||||||
|
|
||||||
|
length=${#OPENIM_API_SERVICE_LISTARIES[@]}
|
||||||
|
|
||||||
|
for ((i=0; i<$length; i++)); do
|
||||||
|
printf "| %-22s | %6s |\n" "${OPENIM_API_SERVICE_LISTARIES[$i]}" "${OPENIM_API_PORT_LISTARIES[$i]}"
|
||||||
|
printf "+------------------------+--------------+\n"
|
||||||
|
done
|
||||||
|
|
||||||
|
function openim::api::start_service() {
|
||||||
|
local binary_name="$1"
|
||||||
|
local service_port="$2"
|
||||||
|
local prometheus_port="$3"
|
||||||
|
|
||||||
|
local cmd="${OPENIM_OUTPUT_HOSTBIN}/${binary_name} --port ${service_port} -c ${OPENIM_API_CONFIG}"
|
||||||
|
|
||||||
|
nohup ${cmd} >> "${LOG_FILE}" 2>&1 &
|
||||||
|
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
openim::log::error_exit "Failed to start ${binary_name} on port ${service_port}."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# start all api services
|
||||||
|
for ((i = 0; i < ${#OPENIM_API_SERVICE_LISTARIES[*]}; i++)); do
|
||||||
|
openim::util::stop_services_with_name ${OPENIM_API_SERVICE_LISTARIES[$i]}
|
||||||
|
openim::log::info "OpenIM ${OPENIM_API_SERVICE_LISTARIES[$i]} config path: ${OPENIM_API_CONFIG}"
|
||||||
|
|
||||||
|
# Get the service and Prometheus ports.
|
||||||
|
OPENIM_API_SERVICE_PORTS=( $(openim::util::list-to-string ${OPENIM_API_PORT_LISTARIES[$i]}) )
|
||||||
|
|
||||||
|
# TODO Only one port is supported. An error occurs on multiple ports
|
||||||
|
if [ ${#OPENIM_API_SERVICE_PORTS[@]} -ne 1 ]; then
|
||||||
|
openim::log::error_exit "Set only one port for ${OPENIM_API_SERVICE_LISTARIES[$i]} service."
|
||||||
|
fi
|
||||||
|
|
||||||
|
for ((j = 0; j < ${#OPENIM_API_SERVICE_PORTS[@]}; j++)); do
|
||||||
|
openim::log::info "Starting ${OPENIM_API_SERVICE_LISTARIES[$i]} service, port: ${OPENIM_API_SERVICE_PORTS[j]}, binary root: ${OPENIM_OUTPUT_HOSTBIN}/${OPENIM_API_SERVICE_LISTARIES[$i]}"
|
||||||
|
openim::api::start_service "${OPENIM_API_SERVICE_LISTARIES[$i]}" "${OPENIM_API_PORT_LISTARIES[j]}"
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
OPENIM_API_PORT_STRINGARIES=( $(openim::util::list-to-string ${OPENIM_API_PORT_LISTARIES[@]}) )
|
||||||
|
openim::util::check_ports ${OPENIM_API_PORT_STRINGARIES[@]}
|
||||||
@ -40,22 +40,6 @@ IFS=" " read -ra OPENIM_RPC_SERVICE_TARGETS <<< "$(openim::rpc::service_name)"
|
|||||||
readonly OPENIM_RPC_SERVICE_TARGETS
|
readonly OPENIM_RPC_SERVICE_TARGETS
|
||||||
readonly OPENIM_RPC_SERVICE_LISTARIES=("${OPENIM_RPC_SERVICE_TARGETS[@]##*/}")
|
readonly OPENIM_RPC_SERVICE_LISTARIES=("${OPENIM_RPC_SERVICE_TARGETS[@]##*/}")
|
||||||
|
|
||||||
readonly OPENIM_API_SERVICE_TARGETS=(
|
|
||||||
openim-api
|
|
||||||
)
|
|
||||||
readonly OPENIM_API_SERVICE_LISTARIES=("${OPENIM_API_SERVICE_TARGETS[@]##*/}")
|
|
||||||
|
|
||||||
readonly OPENIM_API_PORT_TARGETS=(
|
|
||||||
${API_OPENIM_PORT}
|
|
||||||
)
|
|
||||||
readonly OPENIM_API_PORT_LISTARIES=("${OPENIM_API_PORT_TARGETS[@]##*/}")
|
|
||||||
|
|
||||||
readonly OPENIM_RPC_ALL_NAME_TARGETS=(
|
|
||||||
"${OPENIM_API_SERVICE_TARGETS[@]}"
|
|
||||||
"${OPENIM_RPC_SERVICE_TARGETS[@]}"
|
|
||||||
)
|
|
||||||
readonly OPENIM_RPC_ALL_NAME_LISTARIES=("${OPENIM_RPC_ALL_NAME_TARGETS[@]##*/}")
|
|
||||||
|
|
||||||
# Make sure the environment is only called via common to avoid too much nesting
|
# Make sure the environment is only called via common to avoid too much nesting
|
||||||
openim::rpc::service_port() {
|
openim::rpc::service_port() {
|
||||||
local targets=(
|
local targets=(
|
||||||
@ -75,12 +59,6 @@ IFS=" " read -ra OPENIM_RPC_PORT_TARGETS <<< "$(openim::rpc::service_port)"
|
|||||||
readonly OPENIM_RPC_PORT_TARGETS
|
readonly OPENIM_RPC_PORT_TARGETS
|
||||||
readonly OPENIM_RPC_PORT_LISTARIES=("${OPENIM_RPC_PORT_TARGETS[@]##*/}")
|
readonly OPENIM_RPC_PORT_LISTARIES=("${OPENIM_RPC_PORT_TARGETS[@]##*/}")
|
||||||
|
|
||||||
readonly OPENIM_RPC_ALL_PORT_TARGETS=(
|
|
||||||
"${OPENIM_API_PORT_TARGETS[@]}"
|
|
||||||
"${OPENIM_RPC_PORT_TARGETS[@]}"
|
|
||||||
)
|
|
||||||
readonly OPENIM_RPC_ALL_PORT_LISTARIES=("${OPENIM_RPC_ALL_PORT_TARGETS[@]##*/}")
|
|
||||||
|
|
||||||
openim::rpc::prometheus_port() {
|
openim::rpc::prometheus_port() {
|
||||||
# Declare an array to hold all the Prometheus ports for different services
|
# Declare an array to hold all the Prometheus ports for different services
|
||||||
local targets=(
|
local targets=(
|
||||||
@ -99,15 +77,9 @@ IFS=" " read -ra OPENIM_RPC_PROM_PORT_TARGETS <<< "$(openim::rpc::prometheus_por
|
|||||||
readonly OPENIM_RPC_PROM_PORT_TARGETS
|
readonly OPENIM_RPC_PROM_PORT_TARGETS
|
||||||
readonly OPENIM_RPC_PROM_PORT_LISTARIES=("${OPENIM_RPC_PROM_PORT_TARGETS[@]##*/}")
|
readonly OPENIM_RPC_PROM_PORT_LISTARIES=("${OPENIM_RPC_PROM_PORT_TARGETS[@]##*/}")
|
||||||
|
|
||||||
readonly OPENIM_RPC_ALL_PROM_PORT_TARGETS=(
|
echo "OPENIM_RPC_SERVICE_LISTARIES: ${OPENIM_RPC_SERVICE_LISTARIES[@]}"
|
||||||
"${OPENIM_API_PORT_TARGETS[@]}"
|
echo "OPENIM_RPC_PROM_PORT_LISTARIES: ${OPENIM_RPC_PROM_PORT_LISTARIES[@]}"
|
||||||
"${OPENIM_RPC_PROM_PORT_TARGETS[@]}"
|
echo "OPENIM_RPC_PORT_LISTARIES: ${OPENIM_RPC_PORT_LISTARIES[@]}"
|
||||||
)
|
|
||||||
readonly OPENIM_RPC_ALL_PROM_PORT_LISTARIES=("${OPENIM_RPC_ALL_PROM_PORT_TARGETS[@]##*/}")
|
|
||||||
|
|
||||||
echo "OPENIM_RPC_ALL_NAME_TARGETS: ${OPENIM_RPC_ALL_NAME_TARGETS[@]}"
|
|
||||||
echo "OPENIM_RPC_ALL_PROM_PORT_TARGETS: ${OPENIM_RPC_ALL_PROM_PORT_TARGETS[@]}"
|
|
||||||
echo "OPENIM_RPC_ALL_PORT_TARGETS: ${OPENIM_RPC_ALL_PORT_TARGETS[@]}"
|
|
||||||
|
|
||||||
openim::log::info "Starting ${SERVER_NAME} ..."
|
openim::log::info "Starting ${SERVER_NAME} ..."
|
||||||
|
|
||||||
@ -115,10 +87,10 @@ printf "+------------------------+-------+-----------------+\n"
|
|||||||
printf "| Service Name | Port | Prometheus Port |\n"
|
printf "| Service Name | Port | Prometheus Port |\n"
|
||||||
printf "+------------------------+-------+-----------------+\n"
|
printf "+------------------------+-------+-----------------+\n"
|
||||||
|
|
||||||
length=${#OPENIM_RPC_ALL_NAME_LISTARIES[@]}
|
length=${#OPENIM_RPC_SERVICE_LISTARIES[@]}
|
||||||
|
|
||||||
for ((i=0; i<$length; i++)); do
|
for ((i=0; i<$length; i++)); do
|
||||||
printf "| %-22s | %-5s | %-15s |\n" "${OPENIM_RPC_ALL_NAME_LISTARIES[$i]}" "${OPENIM_RPC_ALL_PORT_LISTARIES[$i]}" "${OPENIM_RPC_ALL_PROM_PORT_LISTARIES[$i]}"
|
printf "| %-22s | %-5s | %-15s |\n" "${OPENIM_RPC_SERVICE_LISTARIES[$i]}" "${OPENIM_RPC_PORT_LISTARIES[$i]}" "${OPENIM_RPC_PROM_PORT_LISTARIES[$i]}"
|
||||||
printf "+------------------------+-------+-----------------+\n"
|
printf "+------------------------+-------+-----------------+\n"
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -137,63 +109,20 @@ function openim::rpc::start_service() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# start all rpc services
|
# start all rpc services
|
||||||
for ((i = 0; i < ${#OPENIM_RPC_ALL_NAME_TARGETS[*]}; i++)); do
|
for ((i = 0; i < ${#OPENIM_RPC_SERVICE_LISTARIES[*]}; i++)); do
|
||||||
openim::util::stop_services_with_name ${OPENIM_RPC_ALL_NAME_TARGETS[$i]}
|
openim::util::stop_services_with_name ${OPENIM_RPC_SERVICE_LISTARIES[$i]}
|
||||||
openim::log::info "OpenIM ${OPENIM_RPC_ALL_NAME_TARGETS[$i]} config path: ${OPENIM_RPC_CONFIG}"
|
openim::log::info "OpenIM ${OPENIM_RPC_SERVICE_LISTARIES[$i]} config path: ${OPENIM_RPC_CONFIG}"
|
||||||
|
|
||||||
# Get the service and Prometheus ports.
|
# Get the service and Prometheus ports.
|
||||||
OPENIM_RPC_SERVICE_PORTS=( $(openim::util::list-to-string ${OPENIM_RPC_ALL_PORT_LISTARIES[$i]}) )
|
OPENIM_RPC_SERVICE_PORTS=( $(openim::util::list-to-string ${OPENIM_RPC_PORT_LISTARIES[$i]}) )
|
||||||
OPENIM_RPC_PROM_PORTS=( $(openim::util::list-to-string ${OPENIM_RPC_ALL_PROM_PORT_LISTARIES[$i]}) )
|
OPENIM_RPC_PROM_PORTS=( $(openim::util::list-to-string ${OPENIM_RPC_PROM_PORT_LISTARIES[$i]}) )
|
||||||
|
|
||||||
for ((j = 0; j < ${#OPENIM_RPC_SERVICE_PORTS[@]}; j++)); do
|
for ((j = 0; j < ${#OPENIM_RPC_SERVICE_PORTS[@]}; j++)); do
|
||||||
openim::log::info "Starting ${OPENIM_RPC_ALL_NAME_TARGETS[$i]} service, port: ${OPENIM_RPC_SERVICE_PORTS[j]}, prometheus port: ${OPENIM_RPC_PROM_PORTS[j]}, binary root: ${OPENIM_OUTPUT_HOSTBIN}/${OPENIM_RPC_ALL_NAME_TARGETS[$i]}"
|
openim::log::info "Starting ${OPENIM_RPC_SERVICE_LISTARIES[$i]} service, port: ${OPENIM_RPC_SERVICE_PORTS[j]}, prometheus port: ${OPENIM_RPC_PROM_PORTS[j]}, binary root: ${OPENIM_OUTPUT_HOSTBIN}/${OPENIM_RPC_SERVICE_LISTARIES[$i]}"
|
||||||
openim::rpc::start_service "${OPENIM_RPC_ALL_NAME_TARGETS[$i]}" "${OPENIM_RPC_SERVICE_PORTS[j]}" "${OPENIM_RPC_PROM_PORTS[j]}"
|
openim::rpc::start_service "${OPENIM_RPC_SERVICE_LISTARIES[$i]}" "${OPENIM_RPC_SERVICE_PORTS[j]}" "${OPENIM_RPC_PROM_PORTS[j]}"
|
||||||
|
sleep 1
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
|
openim::util::check_ports ${OPENIM_RPC_PORT_TARGETS[@]}
|
||||||
openim::util::check_ports ${OPENIM_RPC_ALL_PORT_TARGETS[@]}
|
# openim::util::check_ports ${OPENIM_RPC_PROM_PORT_TARGETS[@]}
|
||||||
openim::util::check_ports ${OPENIM_RPC_ALL_PROM_PORT_TARGETS[@]}
|
|
||||||
|
|
||||||
# ---
|
|
||||||
# for ((i = 0; i < ${#service_filename[*]}; i++)); do
|
|
||||||
# #Check whether the service exists
|
|
||||||
# service_name="ps |grep -w ${service_filename[$i]} |grep -v grep"
|
|
||||||
# count="${service_name}| wc -l"
|
|
||||||
|
|
||||||
# if [ $(eval ${count}) -gt 0 ]; then
|
|
||||||
# pid="${service_name}| awk '{print \$2}'"
|
|
||||||
# echo "${service_filename[$i]} service has been started,pid:$(eval $pid)"
|
|
||||||
# echo "killing the service ${service_filename[$i]} pid:$(eval $pid)"
|
|
||||||
# #kill the service that existed
|
|
||||||
# kill -9 $(eval $pid)
|
|
||||||
# sleep 0.5
|
|
||||||
# fi
|
|
||||||
# cd $OPENIM_ROOT
|
|
||||||
# cd $BIN_DIR
|
|
||||||
# # Get the rpc port in the configuration file
|
|
||||||
# portList=$(cat $config_path | grep ${service_port_name[$i]} | awk -F '[:]' '{print $NF}')
|
|
||||||
# openim::util::list-to-string ${portList}
|
|
||||||
# service_ports=($ports_array)
|
|
||||||
|
|
||||||
# portList2=$(cat $config_path | grep ${service_prometheus_port_name[$i]} | awk -F '[:]' '{print $NF}')
|
|
||||||
# openim::util::list-to-string $portList2
|
|
||||||
# prome_ports=($ports_array)
|
|
||||||
# #Start related rpc services based on the number of ports
|
|
||||||
# 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]} -c ${configfile_path} "
|
|
||||||
# else
|
|
||||||
# cmd="./${service_filename[$i]} --port ${service_ports[$j]} --prometheus_port ${prome_ports[$j]} -c ${configfile_path} "
|
|
||||||
# fi
|
|
||||||
# if [ $i -eq 0 -o $i -eq 1 ]; then
|
|
||||||
# cmd="./${service_filename[$i]} --port ${service_ports[$j]}"
|
|
||||||
# fi
|
|
||||||
# echo "=====================start ${service_filename[$i]}======================">>$OPENIM_ROOT/logs/openIM.log
|
|
||||||
# nohup $cmd >>$OPENIM_ROOT/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"
|
|
||||||
# done
|
|
||||||
# done
|
|
||||||
|
|||||||
@ -13,12 +13,9 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
|
||||||
# The golang package that we are building.
|
# The golang package that we are building.
|
||||||
OPENIM_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd -P)"
|
OPENIM_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd -P)"
|
||||||
readonly KUBE_GO_PACKAGE=github.com/openimsdk/open-im-server
|
readonly OPENIM_GO_PACKAGE=github.com/openimsdk/open-im-server
|
||||||
readonly KUBE_GOPATH="${KUBE_GOPATH:-"${KUBE_OUTPUT}/go"}"
|
|
||||||
export KUBE_GOPATH
|
|
||||||
|
|
||||||
# The server platform we are building on.
|
# The server platform we are building on.
|
||||||
readonly OPENIM_SUPPORTED_SERVER_PLATFORMS=(
|
readonly OPENIM_SUPPORTED_SERVER_PLATFORMS=(
|
||||||
@ -95,6 +92,7 @@ readonly OPENIM_SERVER_BINARIES=("${OPENIM_SERVER_TARGETS[@]##*/}")
|
|||||||
START_SCRIPTS_PATH="${OPENIM_ROOT}/scripts/install/"
|
START_SCRIPTS_PATH="${OPENIM_ROOT}/scripts/install/"
|
||||||
openim::golang::start_script_list() {
|
openim::golang::start_script_list() {
|
||||||
local targets=(
|
local targets=(
|
||||||
|
openim-api.sh
|
||||||
openim-rpc.sh
|
openim-rpc.sh
|
||||||
openim-push.sh
|
openim-push.sh
|
||||||
openim-msgtransfer.sh
|
openim-msgtransfer.sh
|
||||||
|
|||||||
@ -308,7 +308,7 @@ openim::util::check_ports() {
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
# openim::util::check_ports 9090 9092
|
# openim::util::check_ports 10002 1004
|
||||||
|
|
||||||
# The `openim::util::check_process_names` function analyzes the state of processes based on given names.
|
# The `openim::util::check_process_names` function analyzes the state of processes based on given names.
|
||||||
# It accepts multiple process names as arguments and prints:
|
# It accepts multiple process names as arguments and prints:
|
||||||
@ -1191,11 +1191,12 @@ function openim::util::run::relative() {
|
|||||||
# It primarily uses the `curl` command to fetch the public IP address from ifconfig.me.
|
# It primarily uses the `curl` command to fetch the public IP address from ifconfig.me.
|
||||||
# If curl or the service is not available, it falls back
|
# If curl or the service is not available, it falls back
|
||||||
# to the internal IP address provided by the hostname command.
|
# to the internal IP address provided by the hostname command.
|
||||||
|
# TODO: If a delay is found, the delay needs to be addressed
|
||||||
function openim::util::get_server_ip() {
|
function openim::util::get_server_ip() {
|
||||||
# Check if the 'curl' command is available
|
# Check if the 'curl' command is available
|
||||||
if command -v curl &> /dev/null; then
|
if command -v curl &> /dev/null; then
|
||||||
# Try to retrieve the public IP address using curl and ifconfig.me
|
# Try to retrieve the public IP address using curl and ifconfig.me
|
||||||
IP=$(curl -s ifconfig.me)
|
IP=$(dig TXT +short o-o.myaddr.l.google.com @ns1.google.com)
|
||||||
|
|
||||||
# Check if IP retrieval was successful
|
# Check if IP retrieval was successful
|
||||||
if [[ -z "$IP" ]]; then
|
if [[ -z "$IP" ]]; then
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user