feat: add more module explain

Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
pull/825/head
Xinwei Xiong(cubxxw-openim) 2 years ago
parent 5424129163
commit ca543df323
No known key found for this signature in database
GPG Key ID: 1BAD6F395338EFDE

@ -76,7 +76,7 @@ scripts/
├── msg_gateway_start.sh # Script to start message gateway service
├── msg_transfer_start.sh # Script to start message transfer service
├── path_info.sh # Script containing path information
├── push_start.sh # Script to start push service
├── openim-push.sh # Script to start push service
├── release.sh # Script to perform release process
├── start_all.sh # Script to start all services
├── openim-crontask.sh # Script to start cron jobs
@ -264,6 +264,10 @@ openim::util::stop_services_with_name nginx apache
## examples
Scripts to perform various build, install, analysis, etc operations.
The script directory design of OpenIM and the writing of scripts and tools refer to many excellent open source projects, such as helm, iam, kubernetes, docker, etc.
Maybe they'll give you inspiration for later maintenance...
These scripts keep the root level Makefile small and simple.
Examples:

@ -28,7 +28,7 @@ trap 'openim::util::onCtrlC' INT
need_to_start_server_shell=(
"start_rpc_service.sh"
"msg_gateway_start.sh"
"push_start.sh"
"openim-push.sh"
"msg_transfer_start.sh"
)

@ -27,7 +27,7 @@ trap 'openim::util::onCtrlC' INT
need_to_start_server_shell=(
${SCRIPTS_ROOT}/start_rpc_service.sh
${SCRIPTS_ROOT}/msg_gateway_start.sh
${SCRIPTS_ROOT}/push_start.sh
${SCRIPTS_ROOT}/openim-push.sh
${SCRIPTS_ROOT}/msg_transfer_start.sh
${SCRIPTS_ROOT}/openim-crontask.sh
)

@ -17,5 +17,5 @@
OPENIM_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")"/../.. && pwd -P)
[[ -z ${COMMON_SOURCED} ]] && source ${OPENIM_ROOT}/scripts/install/common.sh
# common.sh environment.sh mariadb_for_ubuntu.sh msg_transfer_start.sh push_start.sh start_rpc_service.sh vimrc
# dependency.sh install.sh msg_gateway_start.sh openim-crontask.sh redis_for_ubuntu.sh test.sh
# common.sh environment.sh mariadb_for_ubuntu.sh msg_transfer_start.sh openim-push.sh start_rpc_service.sh
# dependency.sh install.sh msg_gateway_start.sh openim-crontask.sh redis_for_ubuntu.sh test.sh man.sh

@ -29,11 +29,11 @@
# Usage:
# 1. Direct Script Execution:
# This will start the OpenIM CronTask directly through a background process.
# Example: ./[script-name].sh
# Example: ./openim-crontask.sh
#
# 2. Controlling through Functions for systemctl operations:
# Specific operations like installation, uninstallation, and status check can be executed by passing the respective function name as an argument to the script.
# Example: ./[script-name].sh openim::crontask::install
# Example: ./openim-crontask.sh openim::crontask::install
#
# Note: Ensure that the appropriate permissions and environmental variables are set prior to script execution.
#

@ -12,7 +12,30 @@
# 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.
#
# OpenIM Push Control Script
#
# Description:
# This script provides a control interface for the OpenIM Push service within a Linux environment. It supports two installation methods: installation via function calls to systemctl, and direct installation through background processes.
#
# Features:
# 1. Robust error handling leveraging Bash built-ins such as 'errexit', 'nounset', and 'pipefail'.
# 2. Capability to source common utility functions and configurations, ensuring environmental consistency.
# 3. Comprehensive logging tools, offering clear operational insights.
# 4. Support for creating, managing, and interacting with Linux systemd services.
# 5. Mechanisms to verify the successful running of the service.
#
# Usage:
# 1. Direct Script Execution:
# This will start the OpenIM push directly through a background process.
# Example: ./openim-push.sh
#
# 2. Controlling through Functions for systemctl operations:
# Specific operations like installation, uninstallation, and status check can be executed by passing the respective function name as an argument to the script.
# Example: ./openim-push.sh openim::push::install
#
# Note: Ensure that the appropriate permissions and environmental variables are set prior to script execution.
#
set -o errexit
set +o nounset
set -o pipefail
@ -22,14 +45,14 @@ OPENIM_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")"/../.. && pwd -P)
SERVER_NAME="openim-push"
# openim::log::status "Start OpenIM Push, binary root: ${SERVER_NAME}"
# openim::log::info "Start OpenIM Push, path: ${OPENIM_PUSH_BINARY}"
openim::log::status "Start OpenIM Push, binary root: ${SERVER_NAME}"
openim::log::info "Start OpenIM Push, path: ${OPENIM_PUSH_BINARY}"
# openim::util::stop_services_with_name ${SERVER_NAME}
openim::util::stop_services_with_name ${SERVER_NAME}
# openim::log::status "start push process, path: ${OPENIM_PUSH_BINARY}"
# nohup ${OPENIM_PUSH_BINARY} >>${LOG_FILE} 2>&1 &
# openim::util::check_process_names ${SERVER_NAME}
openim::log::status "start push process, path: ${OPENIM_PUSH_BINARY}"
nohup ${OPENIM_PUSH_BINARY} >>${LOG_FILE} 2>&1 &
openim::util::check_process_names ${SERVER_NAME}
###################################### Linux Systemd ######################################
SYSTEM_FILE_PATH="/etc/systemd/system/${SERVER_NAME}.service"
@ -109,13 +132,6 @@ fi
cd $SCRIPTS_ROOT
bin_dir="$BIN_DIR"
logs_dir="$OPENIM_ROOT/logs"
cd "$OPENIM_ROOT/scripts/"
list1=$(cat $config_path | grep openImPushPort | awk -F '[:]' '{print $NF}')
list2=$(cat $config_path | grep pushPrometheusPort | awk -F '[:]' '{print $NF}')
openim::util::list-to-string $list1

@ -1,3 +1,5 @@
#!/usr/bin/env bash
# Copyright © 2023 OpenIM. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");

@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# The golang package that we are building.
OPENIM_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd -P)"
readonly KUBE_GO_PACKAGE=github.com/openimsdk/open-im-server
@ -95,7 +96,7 @@ START_SCRIPTS_PATH="${OPENIM_ROOT}/scripts/install/"
openim::golang::start_script_list() {
local targets=(
start-rpc_service.sh
push_start.sh
openim-push.sh
msg_transfer_start.sh
msg_gateway_start.sh
openim-crontask.sh

Loading…
Cancel
Save