mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-07 02:26:00 +08:00
feat: add api test
Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com>
This commit is contained in:
@@ -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'
|
||||
|
||||
@@ -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' || {
|
||||
|
||||
+1143
-232
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user