mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-12-03 19:02:31 +08:00
feat: add openim openim compatibility
Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com>
This commit is contained in:
parent
72e7fe931b
commit
76b970138c
@ -20,7 +20,6 @@ CHANGELOG/
|
||||
|
||||
# Ignore deployment-related files
|
||||
docker-compose.yaml
|
||||
deployments/
|
||||
|
||||
# Ignore assets
|
||||
assets/
|
||||
|
||||
@ -17,8 +17,8 @@
|
||||
# ======================================
|
||||
|
||||
# The user for authentication or system operations.
|
||||
# Default: USER=root
|
||||
USER=${USER}
|
||||
# Default: OPENIM_USER=root
|
||||
USER=${OPENIM_USER}
|
||||
|
||||
# Password associated with the specified user for authentication.
|
||||
# Default: PASSWORD=openIM123
|
||||
@ -58,58 +58,20 @@ DOCKER_BRIDGE_GATEWAY=${DOCKER_BRIDGE_GATEWAY}
|
||||
# Address or hostname for the MySQL network.
|
||||
# Default: MYSQL_NETWORK_ADDRESS=172.28.0.2
|
||||
MYSQL_NETWORK_ADDRESS=${MYSQL_NETWORK_ADDRESS}
|
||||
|
||||
# Address or hostname for the MongoDB network.
|
||||
# Default: MONGO_NETWORK_ADDRESS=172.28.0.3
|
||||
MONGO_NETWORK_ADDRESS=${MONGO_NETWORK_ADDRESS}
|
||||
|
||||
# Address or hostname for the Redis network.
|
||||
# Default: REDIS_NETWORK_ADDRESS=172.28.0.4
|
||||
REDIS_NETWORK_ADDRESS=${REDIS_NETWORK_ADDRESS}
|
||||
|
||||
# Address or hostname for the Kafka network.
|
||||
# Default: KAFKA_NETWORK_ADDRESS=172.28.0.5
|
||||
KAFKA_NETWORK_ADDRESS=${KAFKA_NETWORK_ADDRESS}
|
||||
|
||||
# Address or hostname for the ZooKeeper network.
|
||||
# Default: ZOOKEEPER_NETWORK_ADDRESS=172.28.0.6
|
||||
ZOOKEEPER_NETWORK_ADDRESS=${ZOOKEEPER_NETWORK_ADDRESS}
|
||||
|
||||
# Address or hostname for the MinIO network.
|
||||
# Default: MINIO_NETWORK_ADDRESS=172.28.0.7
|
||||
MINIO_NETWORK_ADDRESS=${MINIO_NETWORK_ADDRESS}
|
||||
|
||||
# Address or hostname for the OpenIM web network.
|
||||
# Default: OPENIM_WEB_NETWORK_ADDRESS=172.28.0.8
|
||||
OPENIM_WEB_NETWORK_ADDRESS=${OPENIM_WEB_NETWORK_ADDRESS}
|
||||
|
||||
# Address or hostname for the OpenIM server network.
|
||||
# Default: OPENIM_SERVER_NETWORK_ADDRESS=172.28.0.9
|
||||
OPENIM_SERVER_NETWORK_ADDRESS=${OPENIM_SERVER_NETWORK_ADDRESS}
|
||||
|
||||
# Address or hostname for the OpenIM chat network.
|
||||
# Default: OPENIM_CHAT_NETWORK_ADDRESS=172.28.0.10
|
||||
OPENIM_CHAT_NETWORK_ADDRESS=${OPENIM_CHAT_NETWORK_ADDRESS}
|
||||
|
||||
# Address or hostname for the Prometheus network.
|
||||
# Default: PROMETHEUS_NETWORK_ADDRESS=172.28.0.11
|
||||
PROMETHEUS_NETWORK_ADDRESS=${PROMETHEUS_NETWORK_ADDRESS}
|
||||
|
||||
# Address or hostname for the Grafana network.
|
||||
# Default: GRAFANA_NETWORK_ADDRESS=172.28.0.12
|
||||
GRAFANA_NETWORK_ADDRESS=${GRAFANA_NETWORK_ADDRESS}
|
||||
|
||||
# Address or hostname for the node_exporter network.
|
||||
# Default: NODE_EXPORTER_NETWORK_ADDRESS=172.28.0.13
|
||||
NODE_EXPORTER_NETWORK_ADDRESS=${NODE_EXPORTER_NETWORK_ADDRESS}
|
||||
|
||||
# Address or hostname for the OpenIM admin network.
|
||||
# Default: OPENIM_ADMIN_NETWORK_ADDRESS=172.28.0.14
|
||||
OPENIM_ADMIN_FRONT_NETWORK_ADDRESS=${OPENIM_ADMIN_FRONT_NETWORK_ADDRESS}
|
||||
|
||||
# Address or hostname for the alertmanager network.
|
||||
# Default: ALERT_MANAGER_NETWORK_ADDRESS=172.28.0.15
|
||||
ALERT_MANAGER_NETWORK_ADDRESS=${ALERT_MANAGER_NETWORK_ADDRESS}
|
||||
|
||||
# ===============================================
|
||||
# = Component Extension Configuration =
|
||||
# ===============================================
|
||||
|
||||
14
install.sh
14
install.sh
@ -63,7 +63,7 @@ PROXY=
|
||||
GITHUB_TOKEN=
|
||||
|
||||
# Default user is "root". If you need to modify it, uncomment and replace accordingly.
|
||||
# USER=root
|
||||
# OPENIM_USER=root
|
||||
|
||||
# Default password for redis, mysql, mongo, as well as accessSecret in config/config.yaml.
|
||||
# Remember, it should be a combination of 8 or more numbers and letters. If you want to set a different password, uncomment and replace "openIM123".
|
||||
@ -244,10 +244,10 @@ function download_source_code() {
|
||||
function set_openim_env() {
|
||||
warn "This command can only be executed once. It will modify the component passwords in docker-compose based on the PASSWORD variable in .env, and modify the component passwords in config/config.yaml. If the password in .env changes, you need to first execute docker-compose down; rm components -rf and then execute this command."
|
||||
# Set default values for user input
|
||||
# If the USER environment variable is not set, it defaults to 'root'
|
||||
if [ -z "$USER" ]; then
|
||||
USER="root"
|
||||
debug "USER is not set. Defaulting to 'root'."
|
||||
# If the OPENIM_USER environment variable is not set, it defaults to 'root'
|
||||
if [ -z "$OPENIM_USER" ]; then
|
||||
OPENIM_USER="root"
|
||||
debug "OPENIM_USER is not set. Defaulting to 'root'."
|
||||
fi
|
||||
|
||||
# If the PASSWORD environment variable is not set, it defaults to 'openIM123'
|
||||
@ -321,7 +321,7 @@ function cmd_help() {
|
||||
|
||||
function parseinput() {
|
||||
# set default values
|
||||
# USER=root
|
||||
# OPENIM_USER=root
|
||||
# PASSWORD=openIM123
|
||||
# ENDPOINT=http://127.0.0.1:10005
|
||||
# API=http://127.0.0.1:10002/object/
|
||||
@ -347,7 +347,7 @@ function parseinput() {
|
||||
;;
|
||||
-u|--user)
|
||||
shift
|
||||
USER=$1
|
||||
OPENIM_USER=$1
|
||||
;;
|
||||
-p|--password)
|
||||
shift
|
||||
|
||||
@ -110,7 +110,7 @@ install_docker_compose() {
|
||||
read NEW_USER
|
||||
is_empty $NEW_USER
|
||||
if [ $? -eq 0 ]; then
|
||||
USER=$NEW_USER
|
||||
OPENIM_USER=$NEW_USER
|
||||
fi
|
||||
|
||||
echo "Please input the password, default is openIM123, press enter to use default"
|
||||
@ -131,12 +131,12 @@ install_docker_compose() {
|
||||
fi
|
||||
set -e
|
||||
export MINIO_ENDPOINT
|
||||
export USER
|
||||
export OPENIM_USER
|
||||
export PASSWORD
|
||||
export DATA_DIR
|
||||
|
||||
cat <<EOF > .env
|
||||
USER=${USER}
|
||||
OPENIM_USER=${OPENIM_USER}
|
||||
PASSWORD=${PASSWORD}
|
||||
MINIO_ENDPOINT=${MINIO_ENDPOINT}
|
||||
DATA_DIR=${DATA_DIR}
|
||||
|
||||
@ -1,70 +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.
|
||||
|
||||
#Include shell font styles and some basic information
|
||||
SCRIPTS_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
OPENIM_ROOT=$(dirname "${SCRIPTS_ROOT}")/..
|
||||
|
||||
#Include shell font styles and some basic information
|
||||
source $SCRIPTS_ROOT/lib/init.sh
|
||||
source $SCRIPTS_ROOT/path_info.sh
|
||||
|
||||
cd $SCRIPTS_ROOT
|
||||
|
||||
source $OPENIM_ROOT/.env
|
||||
|
||||
# Check if PASSWORD only contains letters and numbers
|
||||
if [[ "$PASSWORD" =~ ^[a-zA-Z0-9]+$ ]]
|
||||
then
|
||||
echo "PASSWORD is valid."
|
||||
else
|
||||
echo "ERR: PASSWORD should only contain letters and numbers. " $PASSWORD
|
||||
exit
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo -e "===> ${PURPLE_PREFIX} you user is:$USER ${COLOR_SUFFIX}"
|
||||
echo -e "===> ${PURPLE_PREFIX} you password is:$PASSWORD ${COLOR_SUFFIX}"
|
||||
echo -e "===> ${PURPLE_PREFIX} you minio endpoint is:$MINIO_ENDPOINT ${COLOR_SUFFIX}"
|
||||
echo -e "===> ${PURPLE_PREFIX} you api url is:$API_URL ${COLOR_SUFFIX}"
|
||||
echo ""
|
||||
|
||||
# Specify the config file
|
||||
config_file="${OPENIM_ROOT}"/config/config.yaml
|
||||
|
||||
# Load variables from .env file
|
||||
source "${OPENIM_ROOT}"/.env
|
||||
|
||||
# Replace the password and username field for mysql
|
||||
sed -i "/mysql:/,/database:/ s/password:.*/password: $PASSWORD/" $config_file
|
||||
sed -i "/mysql:/,/database:/ s/username:.*/username: $USER/" $config_file
|
||||
|
||||
# Replace the password and username field for mongo
|
||||
sed -i "/mongo:/,/maxPoolSize:/ s/password:.*/password: $PASSWORD/" $config_file
|
||||
sed -i "/mongo:/,/maxPoolSize:/ s/username:.*/username: $USER/" $config_file
|
||||
|
||||
# Replace the password field for redis
|
||||
sed -i '/redis:/,/password:/s/password: .*/password: '${PASSWORD}'/' $config_file
|
||||
|
||||
# Replace accessKeyID and secretAccessKey for minio
|
||||
sed -i "/minio:/,/isDistributedMod:/ s/accessKeyID:.*/accessKeyID: $USER/" $config_file
|
||||
sed -i "/minio:/,/isDistributedMod:/ s/secretAccessKey:.*/secretAccessKey: $PASSWORD/" $config_file
|
||||
sed -i '/minio:/,/endpoint:/s|endpoint: .*|endpoint: '${MINIO_ENDPOINT}'|' $config_file
|
||||
sed -i '/object:/,/apiURL:/s|apiURL: .*|apiURL: '${API_URL}'|' $config_file
|
||||
|
||||
|
||||
# Replace secret for token
|
||||
sed -i "s/secret: .*/secret: $PASSWORD/" $config_file
|
||||
Loading…
x
Reference in New Issue
Block a user