# 1. First, set the variables in this column with more comments.
# 2. The second is to pass an environment variable via a flag such as --help.
# 3. The third way is to set the variable externally, or pass it in as an environment variable
# Default configuration for OpenIM Repo
# The OpenIM Repo settings can be customized according to your needs.
# OpenIM Repo owner, by default it's set to "OpenIMSDK". If you're using a different owner, replace accordingly.
OWNER="OpenIMSDK"
OWNER="OpenIMSDK"
# The repository name, by default it's "Open-IM-Server". If you're using a different repository, replace accordingly.
REPO="Open-IM-Server"
REPO="Open-IM-Server"
# Update your Go version here
# Version of Go you want to use, make sure it is compatible with your OpenIM-Server requirements.
# Default is 1.18, if you want to use a different version, replace accordingly.
GO_VERSION="1.18"
GO_VERSION="1.18"
# Default HTTP_PORT is 80. If you want to use a different port, uncomment and replace the value.
# HTTP_PORT=80
# HTTP_PORT=80
# CPU core number, concurrent execution
# CPU core number for concurrent execution. By default it's determined automatically.
# Uncomment the next line if you want to set it manually.
# CPU=$(grep -c ^processor /proc/cpuinfo)
# CPU=$(grep -c ^processor /proc/cpuinfo)
# default is latest tag: https://github.com/OpenIMSDK/Open-IM-Server/releases
# By default, the script uses the latest tag from OpenIM-Server releases.
# If you want to use a specific tag, uncomment and replace "v3.0.0" with the desired tag.
# LATEST_TAG=v3.0.0
# LATEST_TAG=v3.0.0
# default OpenIM install directory is /tmp
# Default OpenIM install directory is /tmp. If you want to use a different directory, uncomment and replace "/test".
# DOWNLOAD_OPENIM_DIR="/test"
# DOWNLOAD_OPENIM_DIR="/test"
# github proxy
# GitHub proxy settings. If you are using a proxy, uncomment and replace the empty field with your proxy URL.
# PROXY="https://ghproxy.com/"
PROXY=
PROXY=
# If you have a GitHub token, replace the empty field with your token.
GITHUB_TOKEN=
GITHUB_TOKEN=
USER=root #no need to modify
# Default user is "root". If you need to modify it, uncomment and replace accordingly.
PASSWORD=openIM123 #A combination of 8 or more numbers and letters, this password applies to redis, mysql, mongo, as well as accessSecret in config/config.yaml
# USER=root
ENDPOINT=http://127.0.0.1:10005 #minio's external service IP and port, or use the domain name storage.xx.xx, the app must be able to access this IP and port or domain,
API_URL=http://127.0.0.1:10002/object/ #the app must be able to access this IP and port or domain,
# Default password for redis, mysql, mongo, as well as accessSecret in config/config.yaml.
DATA_DIR=./ #designate large disk directory, default is current directory
# 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".
# PASSWORD=openIM123
# Default endpoint for minio's external service IP and port. If you want to use a different endpoint, uncomment and replace.
# ENDPOINT=http://127.0.0.1:10005
# Default API_URL, replace if necessary.
# API_URL=http://127.0.0.1:10002/object/
# Default data directory. If you want to specify a different directory, uncomment and replace "./".
# DATA_DIR=./
############### OpenIM Functions ###############
############### OpenIM Functions ###############
# Install horizon of the script
# Install horizon of the script
@ -210,6 +236,7 @@ function download_source_code() {
tar -xzvf "${DOWNLOAD_OPENIM_DIR}/${MODIFIED_TAG}.tar.gz" -C "$DOWNLOAD_OPENIM_DIR"
tar -xzvf "${DOWNLOAD_OPENIM_DIR}/${MODIFIED_TAG}.tar.gz" -C "$DOWNLOAD_OPENIM_DIR"
success "Source code downloaded and extracted to $REPO-$MODIFIED_TAG"
success "Source code downloaded and extracted to $REPO-$MODIFIED_TAG"
}
}
@ -217,9 +244,40 @@ function download_source_code() {
function set_openim_env(){
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."
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
# Set default values for user input
user="root"
# If the USER environment variable is not set, it defaults to 'root'
password="openIM123"
if[ -z "$USER"];then
endpoint="http://"
USER="root"
debug "USER is not set. Defaulting to 'root'."
fi
# If the PASSWORD environment variable is not set, it defaults to 'openIM123'
# This password applies to redis, mysql, mongo, as well as accessSecret in config/config.yaml
if[ -z "$PASSWORD"];then
PASSWORD="openIM123"
debug "PASSWORD is not set. Defaulting to 'openIM123'."
fi
# If the ENDPOINT environment variable is not set, it defaults to 'http://127.0.0.1:10005'
# This is minio's external service IP and port, or it could be a domain like storage.xx.xx
# The app must be able to access this IP and port or domain
if[ -z "$ENDPOINT"];then
ENDPOINT="http://127.0.0.1:10005"
debug "ENDPOINT is not set. Defaulting to 'http://127.0.0.1:10005'."
fi
# If the API_URL environment variable is not set, it defaults to 'http://127.0.0.1:10002/object/'
# The app must be able to access this IP and port or domain
if[ -z "$API_URL"];then
API_URL="http://127.0.0.1:10002/object/"
debug "API_URL is not set. Defaulting to 'http://127.0.0.1:10002/object/'."
fi
# If the DATA_DIR environment variable is not set, it defaults to the current directory './'
# This can be set to a directory with large disk space