mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-10-26 21:22:16 +08:00
feat: sava images file
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
This commit is contained in:
parent
1d6d163da0
commit
e66e490ae6
@ -103,6 +103,9 @@ services:
|
|||||||
# image: registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-server:main
|
# image: registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-server:main
|
||||||
# image: openim/openim-server:main
|
# image: openim/openim-server:main
|
||||||
container_name: openim-server
|
container_name: openim-server
|
||||||
|
ports:
|
||||||
|
- 10001:10001
|
||||||
|
- 10002:10002
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "./scripts/check-all.sh"]
|
test: ["CMD-SHELL", "./scripts/check-all.sh"]
|
||||||
interval: 30s
|
interval: 30s
|
||||||
|
|||||||
@ -27,6 +27,9 @@ source "${OPENIM_ROOT}/scripts/install/common.sh"
|
|||||||
trap 'openim::util::onCtrlC' INT
|
trap 'openim::util::onCtrlC' INT
|
||||||
|
|
||||||
"${OPENIM_ROOT}"/scripts/start-all.sh
|
"${OPENIM_ROOT}"/scripts/start-all.sh
|
||||||
|
|
||||||
|
sleep 5
|
||||||
|
|
||||||
"${OPENIM_ROOT}"/scripts/check-all.sh
|
"${OPENIM_ROOT}"/scripts/check-all.sh
|
||||||
|
|
||||||
tail -f ${LOG_FILE}
|
tail -f ${LOG_FILE}
|
||||||
@ -135,10 +135,11 @@ function openim::rpc::start() {
|
|||||||
for ((j = 0; j < ${#OPENIM_RPC_SERVICE_PORTS_ARRAY[@]}; j++)); do
|
for ((j = 0; j < ${#OPENIM_RPC_SERVICE_PORTS_ARRAY[@]}; j++)); do
|
||||||
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::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_SERVICE_LISTARIES[$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 0.5
|
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
|
sleep 0.5
|
||||||
|
|
||||||
openim::util::check_ports ${OPENIM_RPC_PORT_TARGETS[@]}
|
openim::util::check_ports ${OPENIM_RPC_PORT_TARGETS[@]}
|
||||||
# openim::util::check_ports ${OPENIM_RPC_PROM_PORT_TARGETS[@]}
|
# openim::util::check_ports ${OPENIM_RPC_PROM_PORT_TARGETS[@]}
|
||||||
|
|
||||||
|
|||||||
@ -267,22 +267,26 @@ openim::util::check_ports() {
|
|||||||
openim::log::info "Checking ports: $*"
|
openim::log::info "Checking ports: $*"
|
||||||
# Iterate over each given port.
|
# Iterate over each given port.
|
||||||
for port in "$@"; do
|
for port in "$@"; do
|
||||||
# Use the `lsof` command to find process information related to the given port.
|
# Use the `ss` command to find process information related to the given port.
|
||||||
local info=$(lsof -i :$port -n -P | grep LISTEN || true)
|
local info=$(ss -ltnp | grep -w ":$port" || true)
|
||||||
|
|
||||||
# If there's no process information, it means the process associated with the port is not running.
|
# If there's no process information, it means the process associated with the port is not running.
|
||||||
if [[ -z $info ]]; then
|
if [[ -z $info ]]; then
|
||||||
not_started+=($port)
|
not_started+=($port)
|
||||||
else
|
else
|
||||||
# If there's process information, extract relevant details:
|
# Extract relevant details: Process Name, PID, and FD.
|
||||||
# Process ID, Command Name, and Start Time.
|
local details=$(echo $info | sed -n 's/.*users:(("\([^"]*\)",pid=\([^,]*\),fd=\([^)]*\))).*/\1 \2 \3/p')
|
||||||
local pid=$(echo $info | awk '{print $2}')
|
local command=$(echo $details | awk '{print $1}')
|
||||||
local command=$(echo $info | awk '{print $1}')
|
local pid=$(echo $details | awk '{print $2}')
|
||||||
local start_time=$(ps -o lstart= -p $pid)
|
local fd=$(echo $details | awk '{print $3}')
|
||||||
started+=("Port $port - Command: $command, PID: $pid, Start time: $start_time")
|
|
||||||
|
# Get the start time of the process using the PID
|
||||||
|
local start_time=$(ps -p $pid -o lstart=)
|
||||||
|
|
||||||
|
started+=("Port $port - Command: $command, PID: $pid, FD: $fd, Started: $start_time")
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
echo
|
|
||||||
# Print information about ports whose processes are not running.
|
# Print information about ports whose processes are not running.
|
||||||
if [[ ${#not_started[@]} -ne 0 ]]; then
|
if [[ ${#not_started[@]} -ne 0 ]]; then
|
||||||
openim::log::info "### Not started ports:"
|
openim::log::info "### Not started ports:"
|
||||||
@ -293,7 +297,6 @@ openim::util::check_ports() {
|
|||||||
|
|
||||||
# Print information about ports whose processes are running.
|
# Print information about ports whose processes are running.
|
||||||
if [[ ${#started[@]} -ne 0 ]]; then
|
if [[ ${#started[@]} -ne 0 ]]; then
|
||||||
echo
|
|
||||||
openim::log::info "### Started ports:"
|
openim::log::info "### Started ports:"
|
||||||
for info in "${started[@]}"; do
|
for info in "${started[@]}"; do
|
||||||
openim::log::info "$info"
|
openim::log::info "$info"
|
||||||
@ -305,11 +308,14 @@ openim::util::check_ports() {
|
|||||||
echo "++++ OpenIM Log >> cat ${LOG_FILE}"
|
echo "++++ OpenIM Log >> cat ${LOG_FILE}"
|
||||||
return 1
|
return 1
|
||||||
else
|
else
|
||||||
openim::log::success "started[@] processes are running."
|
openim::log::success "All specified processes are running."
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
# openim::util::check_ports 10002 1004
|
# set +o errexit
|
||||||
|
# Sample call for testing:
|
||||||
|
# openim::util::check_ports 10002 1004 12345 13306
|
||||||
|
# set -o errexit
|
||||||
|
|
||||||
# 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:
|
||||||
|
|||||||
@ -62,9 +62,9 @@ function execute_scripts() {
|
|||||||
openim::log::errexit "Script ${script_path##*/} is missing or not executable."
|
openim::log::errexit "Script ${script_path##*/} is missing or not executable."
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
sleep 0.5
|
||||||
}
|
}
|
||||||
|
|
||||||
sleep 0.5
|
|
||||||
|
|
||||||
# TODO Prelaunch tools, simple for now, can abstract functions later
|
# TODO Prelaunch tools, simple for now, can abstract functions later
|
||||||
TOOLS_START_SCRIPTS_PATH=${START_SCRIPTS_PATH}/openim-tools.sh
|
TOOLS_START_SCRIPTS_PATH=${START_SCRIPTS_PATH}/openim-tools.sh
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user