mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-04-28 14:29:19 +08:00
☀️ feat: Enhancing OpenIM with Integrated E2E Testing and CI/CD Enhancements (#1359)
* cicd: robot automated Change * feat: add api test Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * feat: add api test make file Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * feat: add openim e2e test Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * feat: add openim e2e test Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * fix: Fixed some unused scripts and some names Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * docs: optimize openim docs Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * feat: add prom address Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * feat: add openim info test * feat: add openim images config path Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * fix: fix tim file rename * fix: fix tim file rename * fix: fix tim file rename * fix: fix tim file rename * fix: add openim test e2e * feat: add openim test .keep Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * feat: add openim test .keep Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * feat: openim test Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * feat: openim test Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * feat: openim test Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> --------- Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> Co-authored-by: cubxxw <cubxxw@users.noreply.github.com>
This commit is contained in:
+3
-3
@@ -51,7 +51,7 @@ scripts/
|
||||
├── golangci.yml # Configuration for GolangCI linting.
|
||||
├── init-config.sh # Initialize configurations.
|
||||
├── init-env.sh # Initialize the environment.
|
||||
├── init_pwd.sh # Initialize or set password.
|
||||
├── init-pwd.sh # Initialize or set password.
|
||||
├── install # Installation scripts directory.
|
||||
│ ├── README.md # Installation documentation.
|
||||
│ ├── common.sh # Common utilities for installation.
|
||||
@@ -123,7 +123,7 @@ Each directory and script in the structure should be understood as a part of a l
|
||||
|
||||
**PATH:** `scripts/lib/logging.sh`
|
||||
|
||||
+ [log details](../docs/conversions/bash_log.md)
|
||||
+ [log details](../docs/contrib/bash-log.md)
|
||||
|
||||
## Supported platforms
|
||||
|
||||
@@ -154,7 +154,7 @@ $ make demo
|
||||
|
||||
More about `make` read:
|
||||
|
||||
+ [makefile](../docs/conversions/go_code.md)
|
||||
+ [makefile](../docs/contrib/go-code.md)
|
||||
|
||||
Instructions for producing the demo movie:
|
||||
|
||||
|
||||
@@ -1,84 +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.
|
||||
|
||||
#fixme This scripts is the total startup scripts
|
||||
#fixme The full name of the shell scripts that needs to be started is placed in the need_to_start_server_shell array
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
source "${OPENIM_ROOT}/scripts/lib/init.sh"
|
||||
|
||||
trap 'openim::util::onCtrlC' INT
|
||||
|
||||
need_to_start_server_shell=(
|
||||
"oepnim-api.sh"
|
||||
"openim-rpc.sh"
|
||||
"openim-msggateway.sh"
|
||||
"openim-push.sh"
|
||||
"openim-msgtransfer.sh"
|
||||
)
|
||||
|
||||
time=$(date +"%Y-%m-%d %H:%M:%S")
|
||||
|
||||
for _ in {1..3}; do
|
||||
echo "==========================================================" >> $OPENIM_ROOT/logs/openIM.log 2>&1
|
||||
done
|
||||
|
||||
echo "==========server start time:${time}===========" >> $OPENIM_ROOT/logs/openIM.log 2>&1
|
||||
|
||||
for _ in {1..3}; do
|
||||
echo "==========================================================" >> $OPENIM_ROOT/logs/openIM.log 2>&1
|
||||
done
|
||||
|
||||
build_pid_array=()
|
||||
idx=0
|
||||
for i in ${need_to_start_server_shell[*]}; do
|
||||
chmod +x $i
|
||||
./$i &
|
||||
build_pid=$!
|
||||
echo "build_pid " $build_pid
|
||||
build_pid_array[idx]=$build_pid
|
||||
let idx=idx+1
|
||||
done
|
||||
|
||||
echo "wait all start finish....."
|
||||
|
||||
exit 0
|
||||
|
||||
success_num=0
|
||||
for ((i = 0; i < ${#need_to_start_server_shell[*]}; i++)); do
|
||||
echo "wait pid: " ${build_pid_array[i]} ${need_to_start_server_shell[$i]}
|
||||
wait ${build_pid_array[i]}
|
||||
stat=$?
|
||||
echo ${build_pid_array[i]} " " $stat
|
||||
if [ $stat == 0 ]
|
||||
then
|
||||
# echo -e "${GREEN_PREFIX}${need_to_start_server_shell[$i]} successfully be built ${COLOR_SUFFIX}\n"
|
||||
let success_num=$success_num+1
|
||||
|
||||
else
|
||||
#echo -e "${RED_PREFIX}${need_to_start_server_shell[$i]} build failed ${COLOR_SUFFIX}\n"
|
||||
exit -1
|
||||
fi
|
||||
done
|
||||
|
||||
echo "success_num" $success_num "service num:" ${#need_to_start_server_shell[*]}
|
||||
if [ $success_num == ${#need_to_start_server_shell[*]} ]
|
||||
then
|
||||
echo -e ${BACKGROUND_GREEN}"all services build success"${COLOR_SUFFIX}
|
||||
fi
|
||||
@@ -1,13 +0,0 @@
|
||||
@echo off
|
||||
set output_dir=%~dp0..\_output\bin\platforms\windows
|
||||
|
||||
set "rpc_apps=auth conversation friend group msg third user"
|
||||
set "other_apps=api push msgtransfer msggateway"
|
||||
|
||||
for %%a in (%rpc_apps%) do (
|
||||
go build -o %output_dir%\%%a.exe ../cmd/openim-rpc/openim-rpc-%%a/main.go
|
||||
)
|
||||
|
||||
for %%a in (%other_apps%) do (
|
||||
go build -o %output_dir%\%%a.exe ../cmd/openim-%%a/main.go
|
||||
)
|
||||
@@ -14,7 +14,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
# Usage Instructions: https://github.com/openimsdk/open-im-server/tree/main/docs/contrib/git_cherry-pick.md
|
||||
# Usage Instructions: https://github.com/openimsdk/open-im-server/tree/main/docs/contrib/gitcherry-pick.md
|
||||
|
||||
# Checkout a PR from GitHub. (Yes, this is sitting in a Git tree. How
|
||||
# meta.) Assumes you care about pulls from remote "upstream" and
|
||||
@@ -68,7 +68,7 @@ if [[ "$#" -lt 2 ]]; then
|
||||
echo " Set UPSTREAM_REMOTE (default: upstream) and FORK_REMOTE (default: origin)"
|
||||
echo " to override the default remote names to what you have locally."
|
||||
echo
|
||||
echo " For merge process info, see https://github.com/openimsdk/open-im-server/tree/main/docs/contrib/git_cherry-pick.md"
|
||||
echo " For merge process info, see https://github.com/openimsdk/open-im-server/tree/main/docs/contrib/gitcherry-pick.md"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
@@ -145,7 +145,7 @@ Cherry pick of ${PULLSUBJ} on ${rel}.
|
||||
|
||||
${numandtitle}
|
||||
|
||||
For details on the cherry pick process, see the [cherry pick requests](https://github.com/openimsdk/open-im-server/tree/main/docs/contrib/git_cherry-pick.md) page.
|
||||
For details on the cherry pick process, see the [cherry pick requests](https://github.com/openimsdk/open-im-server/tree/main/docs/contrib/gitcherry-pick.md) page.
|
||||
|
||||
\`\`\`release-note
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
# 本脚本功能:根据 scripts/environment.sh 配置,生成 OPENIM 组件 YAML 配置文件。
|
||||
# 示例:./scripts/genconfig.sh scripts/install/environment.sh scripts/template/config.yaml
|
||||
# Read: https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/init_config.md
|
||||
# Read: https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/init-config.md
|
||||
|
||||
env_file="$1"
|
||||
template_file="$2"
|
||||
@@ -29,6 +29,9 @@ if [ $# -ne 2 ];then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if the required commands exist
|
||||
openim::util::require-dig
|
||||
|
||||
source "${env_file}"
|
||||
|
||||
declare -A envs
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
# This script automatically initializes the various configuration files
|
||||
# Read: https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/init_config.md
|
||||
# Read: https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/init-config.md
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
|
||||
@@ -43,10 +43,10 @@ docker run -d \
|
||||
-v "./scripts/mongo-init.sh:/docker-entrypoint-initdb.d/mongo-init.sh:ro" \
|
||||
-e TZ=Asia/Shanghai \
|
||||
-e wiredTigerCacheSizeGB=1 \
|
||||
-e MONGO_INITDB_ROOT_USERNAME=${USER} \
|
||||
-e MONGO_INITDB_ROOT_USERNAME=${OPENIM_USER} \
|
||||
-e MONGO_INITDB_ROOT_PASSWORD=${PASSWORD} \
|
||||
-e MONGO_INITDB_DATABASE=openIM \
|
||||
-e MONGO_USERNAME=${USER} \
|
||||
-e MONGO_USERNAME=${OPENIM_USER} \
|
||||
-e MONGO_PASSWORD=${PASSWORD} \
|
||||
--restart always \
|
||||
mongo:6.0.2 --wiredTigerCacheSizeGB 1 --auth
|
||||
@@ -94,7 +94,7 @@ docker run -d \
|
||||
-p 9090:9090 \
|
||||
-v "/mnt/data:/data" \
|
||||
-v "/mnt/config:/root/.minio" \
|
||||
-e MINIO_ROOT_USER=${USER} \
|
||||
-e MINIO_ROOT_USER=${OPENIM_USER} \
|
||||
-e MINIO_ROOT_PASSWORD=${PASSWORD} \
|
||||
--restart always \
|
||||
minio/minio server /data --console-address ':9090'
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
# This is a file that initializes variables for the automation script that initializes the config file
|
||||
# You need to supplement the script according to the specification.
|
||||
# Read: https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/init_config.md
|
||||
# Read: https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/init-config.md
|
||||
# 格式化 bash 注释:https://tool.lu/shell/
|
||||
# 配置中心文档:https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/environment.md
|
||||
|
||||
@@ -46,7 +46,7 @@ function def() {
|
||||
def "DATA_DIR" "${OPENIM_ROOT}"
|
||||
|
||||
# 设置统一的用户名,方便记忆
|
||||
def "USER" "root"
|
||||
def "OPENIM_USER" "root"
|
||||
|
||||
# 设置统一的密码,方便记忆
|
||||
readonly PASSWORD=${PASSWORD:-'openIM123'}
|
||||
@@ -166,7 +166,7 @@ def "ZOOKEEPER_PASSWORD" "" # Zookeeper的密码
|
||||
###################### MySQL 配置信息 ######################
|
||||
def "MYSQL_PORT" "13306" # MySQL的端口
|
||||
def "MYSQL_ADDRESS" "${DOCKER_BRIDGE_GATEWAY}" # MySQL的地址
|
||||
def "MYSQL_USERNAME" "${USER}" # MySQL的用户名
|
||||
def "MYSQL_USERNAME" "${OPENIM_USER}" # MySQL的用户名
|
||||
# MySQL的密码
|
||||
readonly MYSQL_PASSWORD=${MYSQL_PASSWORD:-"${PASSWORD}"}
|
||||
def "MYSQL_DATABASE" "${DATABASE_NAME}" # MySQL的数据库名
|
||||
@@ -181,7 +181,7 @@ def "MONGO_URI" # MongoDB的URI
|
||||
def "MONGO_PORT" "37017" # MongoDB的端口
|
||||
def "MONGO_ADDRESS" "${DOCKER_BRIDGE_GATEWAY}" # MongoDB的地址
|
||||
def "MONGO_DATABASE" "${DATABASE_NAME}" # MongoDB的数据库名
|
||||
def "MONGO_USERNAME" "${USER}" # MongoDB的用户名
|
||||
def "MONGO_USERNAME" "${OPENIM_USER}" # MongoDB的用户名
|
||||
# MongoDB的密码
|
||||
readonly MONGO_PASSWORD=${MONGO_PASSWORD:-"${PASSWORD}"}
|
||||
def "MONGO_MAX_POOL_SIZE" "100" # 最大连接池大小
|
||||
@@ -198,7 +198,7 @@ def "MINIO_PORT" "10005" # MinIO的端口
|
||||
# MinIO的端点URL
|
||||
def MINIO_ADDRESS "${DOCKER_BRIDGE_GATEWAY}"
|
||||
readonly MINIO_ENDPOINT=${MINIO_ENDPOINT:-"http://${MINIO_ADDRESS}:${MINIO_PORT}"}
|
||||
def "MINIO_ACCESS_KEY" "${USER}" # MinIO的访问密钥ID
|
||||
def "MINIO_ACCESS_KEY" "${OPENIM_USER}" # MinIO的访问密钥ID
|
||||
readonly MINIO_SECRET_KEY=${MINIO_SECRET_KEY:-"${PASSWORD}"}
|
||||
def "MINIO_SESSION_TOKEN" # MinIO的会话令牌
|
||||
readonly MINIO_SIGN_ENDPOINT=${MINIO_SIGN_ENDPOINT:-"http://${OPENIM_IP}:${MINIO_PORT}"} # signEndpoint为minio公网地址
|
||||
|
||||
@@ -71,8 +71,7 @@ function openim::install::show_help() {
|
||||
echo " $0 --install Same as above."
|
||||
}
|
||||
|
||||
function openim::install::install_openim()
|
||||
{
|
||||
function openim::install::install_openim() {
|
||||
openim::common::sudo "mkdir -p ${OPENIM_DATA_DIR} ${OPENIM_INSTALL_DIR} ${OPENIM_CONFIG_DIR} ${OPENIM_LOG_DIR}"
|
||||
openim::log::info "check openim dependency"
|
||||
openim::common::sudo "cp -r ${OPENIM_ROOT}/config/* ${OPENIM_CONFIG_DIR}/"
|
||||
@@ -96,8 +95,7 @@ function openim::install::install_openim()
|
||||
openim::log::success "openim install success"
|
||||
}
|
||||
|
||||
function openim::uninstall::uninstall_openim()
|
||||
{
|
||||
function openim::uninstall::uninstall_openim() {
|
||||
openim::log::info "uninstall openim"
|
||||
|
||||
${OPENIM_ROOT}/scripts/install/openim-msggateway.sh openim::msggateway::uninstall || return 1
|
||||
@@ -115,8 +113,7 @@ function openim::uninstall::uninstall_openim()
|
||||
openim::log::success "openim uninstall success"
|
||||
}
|
||||
|
||||
function openim::install::status()
|
||||
{
|
||||
function openim::install::status() {
|
||||
openim::log::info "check openim status"
|
||||
|
||||
${OPENIM_ROOT}/scripts/install/openim-msggateway.sh openim::msggateway::status || return 1
|
||||
|
||||
@@ -33,8 +33,7 @@ readonly OPENIM_API_SERVICE_TARGETS=(
|
||||
)
|
||||
readonly OPENIM_API_SERVICE_LISTARIES=("${OPENIM_API_SERVICE_TARGETS[@]##*/}")
|
||||
|
||||
function openim::api::start()
|
||||
{
|
||||
function openim::api::start() {
|
||||
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}"
|
||||
|
||||
@@ -43,8 +43,7 @@ OPENIM_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")"/../.. && pwd -P)
|
||||
|
||||
SERVER_NAME="openim-crontask"
|
||||
|
||||
function openim::crontask::start()
|
||||
{
|
||||
function openim::crontask::start() {
|
||||
openim::log::info "Start OpenIM Cron, binary root: ${SERVER_NAME}"
|
||||
openim::log::status "Start OpenIM Cron, path: ${OPENIM_CRONTASK_BINARY}"
|
||||
|
||||
@@ -66,8 +65,7 @@ EOF
|
||||
}
|
||||
|
||||
# install openim-crontask
|
||||
function openim::crontask::install()
|
||||
{
|
||||
function openim::crontask::install() {
|
||||
pushd "${OPENIM_ROOT}"
|
||||
|
||||
# 1. Build openim-crontask
|
||||
@@ -97,8 +95,7 @@ function openim::crontask::install()
|
||||
|
||||
|
||||
# Unload
|
||||
function openim::crontask::uninstall()
|
||||
{
|
||||
function openim::crontask::uninstall() {
|
||||
set +o errexit
|
||||
openim::common::sudo "systemctl stop ${SERVER_NAME}"
|
||||
openim::common::sudo "systemctl disable ${SERVER_NAME}"
|
||||
@@ -110,8 +107,7 @@ function openim::crontask::uninstall()
|
||||
}
|
||||
|
||||
# Status Check
|
||||
function openim::crontask::status()
|
||||
{
|
||||
function openim::crontask::status() {
|
||||
# Check the running status of the ${SERVER_NAME}. If active (running) is displayed, the ${SERVER_NAME} is started successfully.
|
||||
if systemctl is-active --quiet "${SERVER_NAME}"; then
|
||||
openim::log::info "${SERVER_NAME} is running successfully."
|
||||
|
||||
@@ -25,8 +25,7 @@ openim::util::set_max_fd 200000
|
||||
|
||||
SERVER_NAME="openim-msggateway"
|
||||
|
||||
function openim::msggateway::start()
|
||||
{
|
||||
function openim::msggateway::start() {
|
||||
openim::log::info "Start OpenIM Msggateway, binary root: ${SERVER_NAME}"
|
||||
openim::log::status "Start OpenIM Msggateway, path: ${OPENIM_MSGGATEWAY_BINARY}"
|
||||
|
||||
@@ -79,8 +78,7 @@ EOF
|
||||
}
|
||||
|
||||
# install openim-msggateway
|
||||
function openim::msggateway::install()
|
||||
{
|
||||
function openim::msggateway::install() {
|
||||
pushd "${OPENIM_ROOT}"
|
||||
|
||||
# 1. Build openim-msggateway
|
||||
@@ -109,8 +107,7 @@ function openim::msggateway::install()
|
||||
|
||||
|
||||
# Unload
|
||||
function openim::msggateway::uninstall()
|
||||
{
|
||||
function openim::msggateway::uninstall() {
|
||||
set +o errexit
|
||||
openim::common::sudo "systemctl stop ${SERVER_NAME}"
|
||||
openim::common::sudo "systemctl disable ${SERVER_NAME}"
|
||||
@@ -122,8 +119,7 @@ function openim::msggateway::uninstall()
|
||||
}
|
||||
|
||||
# Status Check
|
||||
function openim::msggateway::status()
|
||||
{
|
||||
function openim::msggateway::status() {
|
||||
# Check the running status of the ${SERVER_NAME}. If active (running) is displayed, the ${SERVER_NAME} is started successfully.
|
||||
systemctl status ${SERVER_NAME}|grep -q 'active' || {
|
||||
openim::log::error "${SERVER_NAME} failed to start, maybe not installed properly"
|
||||
|
||||
@@ -25,8 +25,7 @@ openim::util::set_max_fd 200000
|
||||
|
||||
SERVER_NAME="openim-msgtransfer"
|
||||
|
||||
function openim::msgtransfer::start()
|
||||
{
|
||||
function openim::msgtransfer::start() {
|
||||
openim::log::info "Start OpenIM Msggateway, binary root: ${SERVER_NAME}"
|
||||
openim::log::status "Start OpenIM Msggateway, path: ${OPENIM_MSGTRANSFER_BINARY}"
|
||||
|
||||
@@ -61,8 +60,7 @@ function openim::msgtransfer::start()
|
||||
openim::util::check_process_names "${OPENIM_OUTPUT_HOSTBIN}/${SERVER_NAME}"
|
||||
}
|
||||
|
||||
function openim::msgtransfer::check()
|
||||
{
|
||||
function openim::msgtransfer::check() {
|
||||
PIDS=$(pgrep -f "${OPENIM_OUTPUT_HOSTBIN}/openim-msgtransfer")
|
||||
|
||||
NUM_PROCESSES=$(echo "$PIDS" | wc -l)
|
||||
@@ -89,8 +87,7 @@ EOF
|
||||
}
|
||||
|
||||
# install openim-msgtransfer
|
||||
function openim::msgtransfer::install()
|
||||
{
|
||||
function openim::msgtransfer::install() {
|
||||
pushd "${OPENIM_ROOT}"
|
||||
|
||||
# 1. Build openim-msgtransfer
|
||||
@@ -122,8 +119,7 @@ function openim::msgtransfer::install()
|
||||
|
||||
|
||||
# Unload
|
||||
function openim::msgtransfer::uninstall()
|
||||
{
|
||||
function openim::msgtransfer::uninstall() {
|
||||
set +o errexit
|
||||
openim::common::sudo "systemctl stop ${SERVER_NAME}"
|
||||
openim::common::sudo "systemctl disable ${SERVER_NAME}"
|
||||
@@ -135,8 +131,7 @@ function openim::msgtransfer::uninstall()
|
||||
}
|
||||
|
||||
# Status Check
|
||||
function openim::msgtransfer::status()
|
||||
{
|
||||
function openim::msgtransfer::status() {
|
||||
# Check the running status of the ${SERVER_NAME}. If active (running) is displayed, the ${SERVER_NAME} is started successfully.
|
||||
if systemctl is-active --quiet "${SERVER_NAME}"; then
|
||||
openim::log::info "${SERVER_NAME} is running successfully."
|
||||
|
||||
@@ -49,8 +49,7 @@ OPENIM_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")"/../.. && pwd -P)
|
||||
|
||||
SERVER_NAME="openim-push"
|
||||
|
||||
function openim::push::start()
|
||||
{
|
||||
function openim::push::start() {
|
||||
openim::log::status "Start OpenIM Push, binary root: ${SERVER_NAME}"
|
||||
openim::log::info "Start OpenIM Push, path: ${OPENIM_PUSH_BINARY}"
|
||||
|
||||
@@ -88,8 +87,7 @@ EOF
|
||||
}
|
||||
|
||||
# install openim-push
|
||||
function openim::push::install()
|
||||
{
|
||||
function openim::push::install() {
|
||||
pushd "${OPENIM_ROOT}"
|
||||
|
||||
# 1. Build openim-push
|
||||
@@ -117,8 +115,7 @@ function openim::push::install()
|
||||
}
|
||||
|
||||
# Unload
|
||||
function openim::push::uninstall()
|
||||
{
|
||||
function openim::push::uninstall() {
|
||||
set +o errexit
|
||||
openim::common::sudo "systemctl stop ${SERVER_NAME}"
|
||||
openim::common::sudo "systemctl disable ${SERVER_NAME}"
|
||||
@@ -130,8 +127,7 @@ function openim::push::uninstall()
|
||||
}
|
||||
|
||||
# Status Check
|
||||
function openim::push::status()
|
||||
{
|
||||
function openim::push::status() {
|
||||
# Check the running status of the ${SERVER_NAME}. If active (running) is displayed, the ${SERVER_NAME} is started successfully.
|
||||
systemctl status ${SERVER_NAME}|grep -q 'active' || {
|
||||
openim::log::error "${SERVER_NAME} failed to start, maybe not installed properly"
|
||||
|
||||
@@ -173,8 +173,7 @@ function openim::rpc::info() {
|
||||
}
|
||||
|
||||
# install openim-rpc
|
||||
function openim::rpc::install()
|
||||
{
|
||||
function openim::rpc::install() {
|
||||
pushd "${OPENIM_ROOT}"
|
||||
|
||||
# 1. Build openim-rpc
|
||||
@@ -208,8 +207,7 @@ function openim::rpc::install()
|
||||
}
|
||||
|
||||
# Unload
|
||||
function openim::rpc::uninstall()
|
||||
{
|
||||
function openim::rpc::uninstall() {
|
||||
set +o errexit
|
||||
for service in "${OPENIM_RPC_SERVICE_LISTARIES[@]}"; do
|
||||
openim::common::sudo "systemctl stop ${service}"
|
||||
@@ -223,8 +221,7 @@ function openim::rpc::uninstall()
|
||||
}
|
||||
|
||||
# Status Check
|
||||
function openim::rpc::status()
|
||||
{
|
||||
function openim::rpc::status() {
|
||||
for service in "${OPENIM_RPC_SERVICE_LISTARIES[@]}"; do
|
||||
# Check the running status of the ${service}. If active (running) is displayed, the ${service} is started successfully.
|
||||
systemctl status ${service}|grep -q 'active' || {
|
||||
|
||||
+1204
-246
File diff suppressed because it is too large
Load Diff
@@ -1,66 +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.
|
||||
|
||||
|
||||
OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
source "${OPENIM_ROOT}/scripts/lib/init.sh"
|
||||
source "${OPENIM_ROOT}/scripts/install/environment.sh"
|
||||
|
||||
openim::util::onCtrlC
|
||||
|
||||
docker_compose_file_name="docker-compose.yaml"
|
||||
|
||||
# Load environment variables from .env file
|
||||
load_env() {
|
||||
source "${OPENIM_ROOT}"/.env
|
||||
}
|
||||
|
||||
# Replace local IP with public IP in .env
|
||||
replace_ip() {
|
||||
if [ "$API_URL" == "http://127.0.0.1:10002/object/" ]; then
|
||||
sed -i "s/127.0.0.1/${internet_ip}/" "${OPENIM_ROOT}"/.env
|
||||
fi
|
||||
|
||||
if [ "$MINIO_ENDPOINT" == "http://127.0.0.1:10005" ]; then
|
||||
sed -i "s/127.0.0.1/${internet_ip}/" "${OPENIM_ROOT}"/.env
|
||||
fi
|
||||
|
||||
openim::log::info "Your minio endpoint is ${MINIO_ENDPOINT}"
|
||||
}
|
||||
|
||||
# Execute necessary scripts
|
||||
execute_scripts() {
|
||||
chmod +x "${OPENIM_ROOT}"/scripts/*.sh
|
||||
openim::log::info "Executing init_pwd.sh"
|
||||
"${OPENIM_ROOT}"/scripts/init_pwd.sh
|
||||
|
||||
openim::log::info "Executing env_check.sh"
|
||||
"${OPENIM_ROOT}"/scripts/env_check.sh
|
||||
}
|
||||
|
||||
openim::util::check_docker_and_compose_versions
|
||||
|
||||
main() {
|
||||
load_env
|
||||
openim::util::get_server_ip
|
||||
replace_ip
|
||||
execute_scripts
|
||||
start_docker_compose
|
||||
openim::log::success "Script executed successfully"
|
||||
}
|
||||
|
||||
# Run the main function
|
||||
main
|
||||
@@ -70,8 +70,7 @@ ITALIC_PREFIX="\033[3m" # Italic prefix
|
||||
CYAN_PREFIX="\033[0;36m" # Cyan prefix
|
||||
|
||||
# Print colors you can use
|
||||
openim::color::print_color()
|
||||
{
|
||||
openim::color::print_color() {
|
||||
echo
|
||||
echo -e ${bmagenta}--back-color:${normal}
|
||||
echo "bblack; bgreen; bblue; bcyan; bred; byellow; bmagenta; bwhite"
|
||||
|
||||
@@ -200,8 +200,7 @@ openim::log::status() {
|
||||
done
|
||||
}
|
||||
|
||||
openim::log::success()
|
||||
{
|
||||
openim::log::success() {
|
||||
local V="${V:-0}"
|
||||
if [[ ${OPENIM_VERBOSE} < ${V} ]]; then
|
||||
return
|
||||
|
||||
@@ -1126,6 +1126,21 @@ function openim::util::require-jq {
|
||||
fi
|
||||
}
|
||||
|
||||
# openim::util::require-dig
|
||||
# Checks whether dig is installed and provides installation instructions if it is not.
|
||||
function openim::util::require-dig {
|
||||
if ! command -v dig &>/dev/null; then
|
||||
echo "dig command not found."
|
||||
echo "Please install 'dig' to use this feature."
|
||||
echo "Installation instructions:"
|
||||
echo " For Ubuntu/Debian: sudo apt-get install dnsutils"
|
||||
echo " For CentOS/RedHat: sudo yum install bind-utils"
|
||||
echo " For macOS: 'dig' should be preinstalled. If missing, try: brew install bind"
|
||||
echo " For Windows: Install BIND9 tools from https://www.isc.org/download/"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# outputs md5 hash of $1, works on macOS and Linux
|
||||
function openim::util::md5() {
|
||||
if which md5 >/dev/null 2>&1; then
|
||||
|
||||
@@ -193,6 +193,18 @@ go.lint: tools.verify.golangci-lint
|
||||
go.test:
|
||||
@$(GO) test ./...
|
||||
|
||||
## go.test.api: Run api test
|
||||
.PHONY: go.test.api
|
||||
go.test.api:
|
||||
@echo "===========> Run api test"
|
||||
@$(ROOT_DIR)/scripts/install/test.sh openim::test::test
|
||||
|
||||
## go.test.e2e: Run e2e test
|
||||
.PHONY: go.test.e2e
|
||||
go.test.e2e: tools.verify.ginkgo
|
||||
@echo "===========> Run e2e test"
|
||||
@$(TOOLS_DIR)/ginkgo -v $(ROOT_DIR)/test/e2e
|
||||
|
||||
## go.demo: Run demo
|
||||
.PHONY: go.demo
|
||||
go.demo:
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
DOCKER := docker
|
||||
|
||||
# read: https://github.com/openimsdk/open-im-server/blob/main/docs/conversions/images.md
|
||||
# read: https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/images.md
|
||||
REGISTRY_PREFIX ?= registry.cn-hangzhou.aliyuncs.com/openimsdk
|
||||
# REGISTRY_PREFIX ?= ghcr.io/openimsdk
|
||||
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
cd %~p0../_output/bin/platforms/windows
|
||||
start api.exe -p 10002
|
||||
start auth.exe -p 10060
|
||||
start conversation.exe -p 10080
|
||||
start friend.exe -p 10020
|
||||
start group.exe -p 10050
|
||||
start msg.exe -p 10030
|
||||
start msggateway.exe -p 10040 -w 10001
|
||||
start msgtransfer.exe
|
||||
start third.exe -p 10090
|
||||
start push.exe -p 10070
|
||||
start user.exe -p 10010
|
||||
@@ -6,9 +6,9 @@ Learn more about versions of OpenIM:
|
||||
|
||||
+ We release logs are recorded on [✨CHANGELOG](https://github.com/{{ .Env.USERNAME }}/{{ .ProjectName }}/blob/main/CHANGELOG/CHANGELOG.md)
|
||||
|
||||
+ For information on versions of OpenIM and how to maintain branches, read [📚this article](https://github.com/{{ .Env.USERNAME }}/{{ .ProjectName }}/blob/main/docs/conversions/version.md)
|
||||
+ For information on versions of OpenIM and how to maintain branches, read [📚this article](https://github.com/{{ .Env.USERNAME }}/{{ .ProjectName }}/blob/main/docs/contrib/version.md)
|
||||
|
||||
+ If you wish to use mirroring, read OpenIM's [🤲image management policy](https://github.com/{{ .Env.USERNAME }}/{{ .ProjectName }}/blob/main/docs/conversions/images.md)
|
||||
+ If you wish to use mirroring, read OpenIM's [🤲image management policy](https://github.com/{{ .Env.USERNAME }}/{{ .ProjectName }}/blob/main/docs/contrib/images.md)
|
||||
|
||||
**Want to be one of them 😘?**
|
||||
|
||||
|
||||
@@ -17,8 +17,7 @@ WAITFORIT_cmdname=${0##*/}
|
||||
|
||||
echoerr() { if [[ $WAITFORIT_QUIET -ne 1 ]]; then echo "$@" 1>&2; fi }
|
||||
|
||||
usage()
|
||||
{
|
||||
usage() {
|
||||
cat << USAGE >&2
|
||||
Usage:
|
||||
$WAITFORIT_cmdname host:port [-s] [-t timeout] [-- command args]
|
||||
@@ -34,8 +33,7 @@ USAGE
|
||||
exit 1
|
||||
}
|
||||
|
||||
wait_for()
|
||||
{
|
||||
wait_for() {
|
||||
if [[ $WAITFORIT_TIMEOUT -gt 0 ]]; then
|
||||
echoerr "$WAITFORIT_cmdname: waiting $WAITFORIT_TIMEOUT seconds for $WAITFORIT_HOST:$WAITFORIT_PORT"
|
||||
else
|
||||
@@ -61,8 +59,7 @@ wait_for()
|
||||
return $WAITFORIT_result
|
||||
}
|
||||
|
||||
wait_for_wrapper()
|
||||
{
|
||||
wait_for_wrapper() {
|
||||
# In order to support SIGINT during timeout: http://unix.stackexchange.com/a/57692
|
||||
if [[ $WAITFORIT_QUIET -eq 1 ]]; then
|
||||
timeout $WAITFORIT_BUSYTIMEFLAG $WAITFORIT_TIMEOUT $0 --quiet --child --host=$WAITFORIT_HOST --port=$WAITFORIT_PORT --timeout=$WAITFORIT_TIMEOUT &
|
||||
|
||||
Reference in New Issue
Block a user