mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-04-28 06:19:20 +08:00
Enhancements to Script Variables and Logic in OpenIM, Including dig Detection and Mongo Startup Checks (#1696)
* update openim and optimize openim docs and dig check Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * update openim and optimize openim docs and dig check Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * update openim and optimize openim docs and dig check Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * update openim environment and status Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * update openim environment and status Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * update openim environment and status Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * update openim environment and status Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * update openim environment and status Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * update openim environment and status Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * update openim environment and status Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * update openim environment and status Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * update openim environment and status Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * update openim environment and status Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * fix openim config mongo passwd env Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * update openim environment and status Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * update openim environment and status Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * update openim environment and status Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * update openim environment and status Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * update openim environment and status Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * update openim environment and status Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * update openim environment and status Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * update openim environment and status Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * feat: add openim mongo logic Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * feat: add openim mongo logic Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * feat: add openim mongo logic Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * feat: add openim mongo logic Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * feat: sava openim cicd Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * feat: add openim mongo logic Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * feat: add openim mongo logic Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * feat: add openim mongo logic Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * feat: add openim mongo logic Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * feat: add openim mongo logic Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * feat: add openim mongo logic Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * feat: add openim mongo logic Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * feat: add openim mongo logic Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * feat: add openim mongo logic Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * feat: add openim mongo logic Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * feat: add openim mongo logic Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> --------- Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com>
This commit is contained in:
+2
-10
@@ -29,16 +29,8 @@ if [ $# -ne 2 ];then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
openim::util::require-dig
|
||||
result=$?
|
||||
if [ $result -ne 0 ]; then
|
||||
openim::log::info "Please install 'dig' to use this feature."
|
||||
openim::log::info "Installation instructions:"
|
||||
openim::log::info " For Ubuntu/Debian: sudo apt-get install dnsutils"
|
||||
openim::log::info " For CentOS/RedHat: sudo yum install bind-utils"
|
||||
openim::log::info " For macOS: 'dig' should be preinstalled. If missing, try: brew install bind"
|
||||
openim::log::info " For Windows: Install BIND9 tools from https://www.isc.org/download/"
|
||||
openim::log::error_exit "Error: 'dig' command is required but not installed."
|
||||
if [ -z "${OPENIM_IP}" ]; then
|
||||
openim::util::require-dig
|
||||
fi
|
||||
|
||||
source "${env_file}"
|
||||
|
||||
@@ -1,4 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright © 2024 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 Docker Deployment Script
|
||||
#
|
||||
|
||||
@@ -171,13 +171,13 @@ 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" "root" # MongoDB的管理员身份用户名
|
||||
def "MONGO_USERNAME" "root" # MongoDB的管理员身份用户名
|
||||
# MongoDB的管理员身份密码
|
||||
readonly MONGO_PASSWORD=${MONGO_PASSWORD:-"${PASSWORD}"}
|
||||
# Mongo OpenIM 身份用户名
|
||||
def "MONGO_OPENIM_USERNAME" "openIM"
|
||||
# Mongo OpenIM 身份密码
|
||||
readonly MONGO_OPENIM_PASSWORD=${MONGO_OPENIM_PASSWORD:-'openIM123456'}
|
||||
readonly MONGO_OPENIM_PASSWORD=${MONGO_OPENIM_PASSWORD:-"${PASSWORD}"}
|
||||
|
||||
def "MONGO_MAX_POOL_SIZE" "100" # 最大连接池大小
|
||||
|
||||
|
||||
+7
-2
@@ -1146,8 +1146,13 @@ function openim::util::require-jq {
|
||||
# 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
|
||||
openim::log::error "dig command not found."
|
||||
return 1
|
||||
openim::log::error "Please install 'dig' to use this feature."
|
||||
openim::log::error "Installation instructions:"
|
||||
openim::log::error " For Ubuntu/Debian: sudo apt-get install dnsutils"
|
||||
openim::log::error " For CentOS/RedHat: sudo yum install bind-utils"
|
||||
openim::log::error " For macOS: 'dig' should be preinstalled. If missing, try: brew install bind"
|
||||
openim::log::error " For Windows: Install BIND9 tools from https://www.isc.org/download/"
|
||||
openim::log::error_exit "dig command not found."
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ FIND := find . ! -path './utils/*' ! -path './vendor/*' ! -path './third_party/*
|
||||
XARGS := xargs -r --no-run-if-empty
|
||||
|
||||
# Linux command settings-CODE DIRS Copyright
|
||||
CODE_DIRS := $(ROOT_DIR)/pkg $(ROOT_DIR)/cmd $(ROOT_DIR)/config $(ROOT_DIR)/.docker-compose_cfg $(ROOT_DIR)/internal $(ROOT_DIR)/scripts $(ROOT_DIR)/test $(ROOT_DIR)/.github $(ROOT_DIR)/build $(ROOT_DIR)/tools $(ROOT_DIR)/deployments
|
||||
CODE_DIRS := $(ROOT_DIR)/pkg $(ROOT_DIR)/cmd $(ROOT_DIR)/config $(ROOT_DIR)/internal $(ROOT_DIR)/scripts $(ROOT_DIR)/test $(ROOT_DIR)/.github $(ROOT_DIR)/build $(ROOT_DIR)/tools $(ROOT_DIR)/deployments
|
||||
FINDS := find $(CODE_DIRS)
|
||||
|
||||
# Makefile settings: Select different behaviors by determining whether V option is set
|
||||
|
||||
@@ -18,7 +18,6 @@ mongosh <<EOF
|
||||
use admin
|
||||
db.auth('$MONGO_INITDB_ROOT_USERNAME', '$MONGO_INITDB_ROOT_PASSWORD')
|
||||
|
||||
|
||||
db = db.getSiblingDB('$MONGO_INITDB_DATABASE')
|
||||
db.createUser({
|
||||
user: "$MONGO_OPENIM_USERNAME",
|
||||
@@ -29,4 +28,3 @@ db.createUser({
|
||||
]
|
||||
});
|
||||
EOF
|
||||
|
||||
|
||||
Reference in New Issue
Block a user