fix: scripts fix

Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
pull/926/head
Xinwei Xiong(cubxxw-openim) 2 years ago
parent bf67a56fe1
commit ef0ce13f95
No known key found for this signature in database
GPG Key ID: 1BAD6F395338EFDE

261
.env

@ -1,64 +1,265 @@
# The following is automatically generated
# Use `make init` OR `./scripts/init-config.sh`
#
# ================= Basic Configuration ===================
# Endpoint for the MinIO object storage service
MINIO_ENDPOINT=http://127.0.0.1:10005
# ======================================
# ========= Basic Configuration ========
# ======================================
# Base URL for the application programming interface (API)
API_URL=http://127.0.0.1:10002
# The user for authentication or system operations.
# Default: USER=root
USER=root
# Directory path for storing data files or related information
DATA_DIR=./
# Password associated with the specified user for authentication.
# Default: PASSWORD=openIM123
PASSWORD=openIM123
# Endpoint for the MinIO object storage service.
# Default: MINIO_ENDPOINT=http://172.28.0.1:10005
MINIO_ENDPOINT=http://172.28.0.1:10005
# Base URL for the application programming interface (API).
# Default: API_URL=http://172.28.0.1:10002
API_URL=http://14.153.6.114:10002
# Directory path for storing data files or related information.
# Default: DATA_DIR=./
DATA_DIR=/root/workspaces/openim/openim-docker/openim-server/main
# ======================================
# ========= Network Configuration ======
# ======================================
# Subnet for the Docker network.
# Default: DOCKER_BRIDGE_SUBNET=172.28.0.0/16
DOCKER_BRIDGE_SUBNET=172.28.0.0/16
# Gateway for the Docker network.
# Default: DOCKER_BRIDGE_GATEWAY=172.28.0.1
DOCKER_BRIDGE_GATEWAY=172.28.0.1
# Address or hostname for the MySQL network.
# Default: MYSQL_NETWORK_ADDRESS=172.28.0.2
MYSQL_NETWORK_ADDRESS=172.28.0.2
# Address or hostname for the MongoDB network.
# Default: MONGO_NETWORK_ADDRESS=172.28.0.3
MONGO_NETWORK_ADDRESS=172.28.0.3
# Address or hostname for the Redis network.
# Default: REDIS_NETWORK_ADDRESS=172.28.0.4
REDIS_NETWORK_ADDRESS=172.28.0.4
# Address or hostname for the Kafka network.
# Default: KAFKA_NETWORK_ADDRESS=172.28.0.5
KAFKA_NETWORK_ADDRESS=172.28.0.5
# Address or hostname for the ZooKeeper network.
# Default: ZOOKEEPER_NETWORK_ADDRESS=172.28.0.6
ZOOKEEPER_NETWORK_ADDRESS=172.28.0.6
# Address or hostname for the MinIO network.
# Default: MINIO_NETWORK_ADDRESS=172.28.0.7
MINIO_NETWORK_ADDRESS=172.28.0.7
# Address or hostname for the OpenIM web network.
# Default: OPENIM_WEB_NETWORK_ADDRESS=172.28.0.8
OPENIM_WEB_NETWORK_ADDRESS=172.28.0.8
# Address or hostname for the OpenIM server network.
# Default: OPENIM_SERVER_NETWORK_ADDRESS=172.28.0.9
OPENIM_SERVER_NETWORK_ADDRESS=172.28.0.9
# Address or hostname for the OpenIM chat network.
# Default: OPENIM_CHAT_NETWORK_ADDRESS=172.28.0.10
OPENIM_CHAT_NETWORK_ADDRESS=172.28.0.10
# Address or hostname for the Prometheus network.
# Default: PROMETHEUS_NETWORK_ADDRESS=172.28.0.11
PROMETHEUS_NETWORK_ADDRESS=172.28.0.11
# Address or hostname for the Grafana network.
# Default: GRAFANA_NETWORK_ADDRESS=172.28.0.12
GRAFANA_NETWORK_ADDRESS=172.28.0.12
# ===============================================
# = Component Extension Configuration =
# ===============================================
# ============ Component Extension Configuration ==========
# Address or hostname for the ZooKeeper service (often used in distributed systems for maintaining configuration information)
ZOOKEEPER_ADDRESS=127.0.0.1
# ----- ZooKeeper Configuration -----
# Address or hostname for the ZooKeeper service.
# Default: ZOOKEEPER_ADDRESS=172.28.0.1
ZOOKEEPER_ADDRESS=172.28.0.6
# Port for ZooKeeper service.
# Default: ZOOKEEPER_PORT=12181
ZOOKEEPER_PORT=12181
# ----- MySQL Configuration -----
# Port on which MySQL database service is running
# Address or hostname for the MySQL service.
# Default: MYSQL_ADDRESS=172.28.0.1
MYSQL_ADDRESS=172.28.0.2
# Port on which MySQL database service is running.
# Default: MYSQL_PORT=13306
MYSQL_PORT=13306
# Password to authenticate with the MySQL database service
# Password to authenticate with the MySQL database service.
# Default: MYSQL_PASSWORD=openIM123
MYSQL_PASSWORD=openIM123
# Port on which MongoDB service is running
# ----- MongoDB Configuration -----
# Address or hostname for the MongoDB service.
# Default: MONGO_ADDRESS=172.28.0.1
MONGO_ADDRESS=172.28.0.3
# Port on which MongoDB service is running.
# Default: MONGO_PORT=37017
MONGO_PORT=37017
# Username to authenticate with the MongoDB service
# Username to authenticate with the MongoDB service.
# Default: MONGO_USERNAME=root
MONGO_USERNAME=root
# Password to authenticate with the MongoDB service
# Password to authenticate with the MongoDB service.
# Default: MONGO_PASSWORD=openIM123
MONGO_PASSWORD=openIM123
# Name of the database in MongoDB to be used
# Name of the database in MongoDB to be used.
# Default: MONGO_DATABASE=openIM_v3
MONGO_DATABASE=openIM_v3
# Port on which Redis in-memory data structure store is running
# ----- Redis Configuration -----
# Address or hostname for the Redis service.
# Default: REDIS_ADDRESS=172.28.0.1
REDIS_ADDRESS=172.28.0.4
# Port on which Redis in-memory data structure store is running.
# Default: REDIS_PORT=16379
REDIS_PORT=16379
# Password to authenticate with the Redis service
# Password to authenticate with the Redis service.
# Default: REDIS_PASSWORD=openIM123
REDIS_PASSWORD=openIM123
# Port on which Kafka distributed streaming platform is running
KAFKA_PORT=9092
# ----- Kafka Configuration -----
# Address or hostname for the Kafka service.
# Default: KAFKA_ADDRESS=172.28.0.1
KAFKA_ADDRESS=172.28.0.5
# Address or hostname for the Kafka service
KAFKA_ADDR=127.0.0.1
# Port on which Kafka distributed streaming platform is running.
# Default: KAFKA_PORT=19092
KAFKA_PORT=19092
# Topic in Kafka for storing the latest messages in Redis
# Topic in Kafka for storing the latest messages in Redis.
# Default: KAFKA_LATESTMSG_REDIS_TOPIC=latestMsgToRedis
KAFKA_LATESTMSG_REDIS_TOPIC=latestMsgToRedis
# Topic in Kafka for pushing messages (e.g. notifications or updates)
# Topic in Kafka for pushing messages (e.g. notifications or updates).
# Default: KAFKA_MSG_PUSH_TOPIC=msgToPush
KAFKA_MSG_PUSH_TOPIC=msgToPush
# Topic in Kafka for storing offline messages in MongoDB
# Topic in Kafka for storing offline messages in MongoDB.
# Default: KAFKA_OFFLINEMSG_MONGO_TOPIC=offlineMsgToMongoMysql
KAFKA_OFFLINEMSG_MONGO_TOPIC=offlineMsgToMongoMysql
# Port on which MinIO object storage service is running
# ----- MinIO Configuration ----
# Address or hostname for the MinIO object storage service.
# Default: MINIO_ADDRESS=172.28.0.1
MINIO_ADDRESS=172.28.0.7
# Port on which MinIO object storage service is running.
# Default: MINIO_PORT=10005
MINIO_PORT=10005
# Access key to authenticate with the MinIO service
# Access key to authenticate with the MinIO service.
# Default: MINIO_ACCESS_KEY=root
MINIO_ACCESS_KEY=root
# Secret key corresponding to the access key for MinIO authentication
# Secret key corresponding to the access key for MinIO authentication.
# Default: MINIO_SECRET_KEY=openIM123
MINIO_SECRET_KEY=openIM123
# ----- Prometheus Configuration -----
# Address or hostname for the Prometheus service.
# Default: PROMETHEUS_ADDRESS=172.28.0.1
PROMETHEUS_ADDRESS=172.28.0.11
# Port on which Prometheus service is running.
# Default: PROMETHEUS_PORT=19090
PROMETHEUS_PORT=19090
# ----- Grafana Configuration -----
# Address or hostname for the Grafana service.
# Default: GRAFANA_ADDRESS=172.28.0.1
GRAFANA_ADDRESS=172.28.0.12
# Port on which Grafana service is running.
# Default: GRAFANA_PORT=3000
GRAFANA_PORT=3000
# ======================================
# ============ OpenIM Web ===============
# ======================================
# Path to the OpenIM web distribution.
# Default: OPENIM_WEB_DIST_PATH=/app/dist
OPENIM_WEB_DIST_PATH=/app/dist
# Port on which OpenIM web service is running.
# Default: OPENIM_WEB_PORT=11001
OPENIM_WEB_PORT=11001
# Address or hostname for the OpenIM web service.
# Default: OPENIM_WEB_ADDRESS=172.28.0.1
OPENIM_WEB_ADDRESS=172.28.0.8
# ======================================
# ========= OpenIM Server ==============
# ======================================
# Address or hostname for the OpenIM server.
# Default: OPENIM_SERVER_ADDRESS=172.28.0.1
OPENIM_SERVER_ADDRESS=172.28.0.9
# Port for the OpenIM WebSockets.
# Default: OPENIM_WS_PORT=10001
OPENIM_WS_PORT=10001
# Port for the OpenIM API.
# Default: API_OPENIM_PORT=10002
API_OPENIM_PORT=10002
# ======================================
# ========== OpenIM Chat ===============
# ======================================
# Branch name for OpenIM chat.
# Default: CHAT_BRANCH=main
CHAT_BRANCH=main
# Address or hostname for the OpenIM chat service.
# Default: OPENIM_CHAT_ADDRESS=172.28.0.1
OPENIM_CHAT_ADDRESS=172.28.0.10
# Port for the OpenIM chat API.
# Default: OPENIM_CHAT_API_PORT=10008
OPENIM_CHAT_API_PORT=10008
# Directory path for storing data files or related information for OpenIM chat.
# Default: OPENIM_CHAT_DATA_DIR=./openim-chat/main
OPENIM_CHAT_DATA_DIR=./openim-chat/main
# ======================================
# ========== OpenIM Admin ==============
# ======================================
# Branch name for OpenIM server.
# Default: SERVER_BRANCH=main
SERVER_BRANCH=main
# Port for the OpenIM admin API.
# Default: OPENIM_ADMIN_API_PORT=10009
OPENIM_ADMIN_API_PORT=10009

@ -128,9 +128,7 @@ $ make demo
```bash
# choose what you need, We take branch 3.2 as an example
$ BRANCH=release-v3.2
$ git clone -b $BRANCH https://github.com/OpenIMSDK/Open-IM-Server openim/openim-server && export openim_dir=$(pwd)/openim && cd ${openim_dir}/openim-server
git clone -b feat/test https://github.com/openim-sigs/openim-docker openim/openim-docker && export openim=$(pwd)/openim && cd $openim/openim-docker && ./scripts/init-config.sh && docker-compose up -d
```
> **Note**
@ -144,42 +142,36 @@ If you tried to get started quickly with `make demo`, then you know that our con
You can use `make init` to quickly initialize a configuration file
```bash
$ make init
$ git diff
```
Then feel free to modify your current config file, you can also modify `/scripts/install/environment.sh` document template, `make init` is essentially rendering `environment.sh` template, and then through the `make init` to automatically generate a new configuration.
If you only need to change the config file for a short time, or if you don't want to make any major changes in the future, you can modify the `.env file directly
Modify the automation script:
```bash
USER=root #no need to modify
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
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,
DATA_DIR=./ #designate large disk directory
cat scripts/install/environment.sh
```
**3. Deploy and start**
> **Note**
>
> You can deploy either directly with `make install` or with `docker compose up`, the logic is the same
1. Recommended using environment variables:
```bash
$ make install
# OR
$ docker-compose up
export PASSWORD="openIM123" # Set password
export USER="root" # Set username
# Choose chat version and server version https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/images.md, eg: main, release-v*.*
export CHAT_BRANCH="main"
export SERVER_BRANCH="main"
#... Other environment variables
# MONGO_USERNAME: This sets the MongoDB username
# MONGO_PASSWORD: Set the MongoDB password
# MONGO_DATABASE: Sets the MongoDB database name
# MINIO_ENDPOINT: set the MinIO service address
# API_URL: under network environment, set OpenIM Server API address
export API_URL="http://127.0.0.1:10002"
```
4. Check the service
Next, update the configuration using make init:
```bash
$ make check
$ make init
$ git diff
```
Looking at the command line at this point, there are two items in the output, checking for the start of the component port that OpenIM depends on, and the start of the OpenIM core component
</details>

@ -0,0 +1,111 @@
# Configuration for OpenIMServer
# -----------------------------------------------------------------
# TODO: This config file is the template file
# --| source: deployments/templates/chat.yaml
# --| env: scripts/install/environment
# --| target: config/config.yaml
# -----------------------------------------------------------------
###################### Zookeeper ######################
# Zookeeper configuration
# It's not recommended to modify the schema
zookeeper:
schema: ${ZOOKEEPER_SCHEMA}
zkAddr:
- ${ZOOKEEPER_ADDRESS}:${ZOOKEEPER_PORT}
username: ${ZOOKEEPER_USERNAME}
password: ${ZOOKEEPER_PASSWORD}
###################### Chat API ######################
chatApi:
openImChatApiPort: [ ${OPENIM_CHAT_API_PORT} ]
listenIP: ${CHAT_API_LISTEN_IP}
###################### Admin API ######################
adminApi:
openImAdminApiPort: [ ${OPENIM_ADMIN_API_PORT} ]
listenIP: ${ADMIN_API_LISTEN_IP}
###################### RPC ######################
rpc:
registerIP: #作为rpc启动时注册到zookeeper的IPapi/gateway能访问到此ip和对应的rpcPort中的端口
listenIP: #默认为0.0.0.0
rpcPort:
openImAdminPort: [ ${OPENIM_ADMIN_PORT} ]
openImChatPort: [ ${OPENIM_CHAT_PORT} ]
rpcRegisterName:
openImAdminName: ${OPENIM_ADMIN_NAME}
openImChatName: ${OPENIM_CHAT_NAME}
###################### MySQL ######################
mysql:
# address: [ 127.0.0.1:13306 ] #目前仅支持单机
# username: root #用户名
# password: openIM123 #密码
# database: openIM_v2 #不建议修改
# maxOpenConn: 1000 #最大连接数
# maxIdleConn: 100 #最大空闲连接数
# maxLifeTime: 60 #连接可以重复使用的最长时间(秒)
# logLevel: 4 #日志级别 1=slient 2=error 3=warn 4=info
# slowThreshold: 500 #慢语句阈值 (毫秒)
database: openim_enterprise
###################### Log ######################
log:
storageLocation: ../logs/ #存放目录
# rotationTime: 24 #日志旋转时间
# remainRotationCount: 2 #日志数量
# remainLogLevel: 6 #日志级别 6表示全都打印
# isStdout: false
# isJson: false
# withStack: false
###################### Secret & Token Policy ######################
# secret: openIM123
#tokenPolicy:
# expire: 86400
###################### Verify Code ######################
verifyCode:
validTime: 300 # 验证码有效时间
validCount: 5 # 验证码有效次数
uintTime: 86400 # 单位时间间隔
maxCount: 10 # 单位时间内最大获取次数
superCode: "666666" # 超级验证码(只有use为空时使用)
len: 6 # 验证码长度
use: "" # 使用的验证码服务(use: "ali")
ali:
endpoint: "dysmsapi.aliyuncs.com"
accessKeyId: ""
accessKeySecret: ""
signName: ""
verificationCodeTemplateCode: ""
###################### Proxy Header ######################
# 获取ip的header,没有配置直接获取远程地址
#proxyHeader: "X-Forwarded-For"
###################### Admin List ######################
adminList:
adminList:
- adminID: admin1
nickname: chat1
imAdmin: openIM123456
- adminID: admin2
nickname: chat2
imAdmin: openIM654321
- adminID: admin3
nickname: chat3
imAdmin: openIMAdmin
###################### OpenIM URL ######################
openIMUrl: ${OPENIM_SERVER_ADDRESS}:${API_OPENIM_PORT}
###################### Redis ######################
redis:
# address: [ 127.0.0.1:16379 ]
# username:
# password: openIM123

@ -1,98 +1,265 @@
# 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.
# ================= Basic Configuration ===================
USER=${USER} # User for authentication or system operations
PASSWORD=${PASSWORD} # Password associated with the specified user for authentication
MINIO_ENDPOINT=${MINIO_ENDPOINT} # Endpoint for the MinIO object storage service
API_URL=${API_URL} # Base URL for the application programming interface (API)
DATA_DIR=${DATA_DIR} # Directory path for storing data files or related information
# ================= Network Configuration =================
DOCKER_BRIDGE_SUBNET=${DOCKER_BRIDGE_SUBNET} # Subnet for the Docker network
DOCKER_BRIDGE_GATEWAY=${DOCKER_BRIDGE_GATEWAY} # Gateway for the Docker network
MYSQL_NETWORK_ADDRESS=${MYSQL_NETWORK_ADDRESS} # Address or hostname for the MySQL network
MONGO_NETWORK_ADDRESS=${MONGO_NETWORK_ADDRESS} # Address or hostname for the MongoDB network
REDIS_NETWORK_ADDRESS=${REDIS_NETWORK_ADDRESS} # Address or hostname for the Redis network
KAFKA_NETWORK_ADDRESS=${KAFKA_NETWORK_ADDRESS} # Address or hostname for the Kafka network
ZOOKEEPER_NETWORK_ADDRESS=${ZOOKEEPER_NETWORK_ADDRESS} # Address or hostname for the ZooKeeper network
MINIO_NETWORK_ADDRESS=${MINIO_NETWORK_ADDRESS} # Address or hostname for the MinIO network
OPENIM_WEB_NETWORK_ADDRESS=${OPENIM_WEB_NETWORK_ADDRESS} # Address or hostname for the OpenIM web network
OPENIM_SERVER_NETWORK_ADDRESS=${OPENIM_SERVER_NETWORK_ADDRESS} # Address or hostname for the OpenIM server network
OPENIM_CHAT_NETWORK_ADDRESS=${OPENIM_CHAT_NETWORK_ADDRESS} # Address or hostname for the OpenIM chat network
PROMETHEUS_NETWORK_ADDRESS=${PROMETHEUS_NETWORK_ADDRESS} # Address or hostname for the Prometheus network
GRAFANA_NETWORK_ADDRESS=${GRAFANA_NETWORK_ADDRESS} # Address or hostname for the Grafana network
# ======================================
# ========= Basic Configuration ========
# ======================================
# The user for authentication or system operations.
# Default: USER=root
USER=${USER}
# Password associated with the specified user for authentication.
# Default: PASSWORD=openIM123
PASSWORD=${PASSWORD}
# Endpoint for the MinIO object storage service.
# Default: MINIO_ENDPOINT=http://172.28.0.1:10005
MINIO_ENDPOINT=${MINIO_ENDPOINT}
# Base URL for the application programming interface (API).
# Default: API_URL=http://172.28.0.1:10002
API_URL=${API_URL}
# Directory path for storing data files or related information.
# Default: DATA_DIR=./
DATA_DIR=${DATA_DIR}
# ======================================
# ========= Network Configuration ======
# ======================================
# Subnet for the Docker network.
# Default: DOCKER_BRIDGE_SUBNET=172.28.0.0/16
DOCKER_BRIDGE_SUBNET=${DOCKER_BRIDGE_SUBNET}
# Gateway for the Docker network.
# Default: DOCKER_BRIDGE_GATEWAY=172.28.0.1
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}
# ===============================================
# = Component Extension Configuration =
# ===============================================
# ============ Component Extension Configuration ==========
# ----- ZooKeeper Configuration -----
ZOOKEEPER_ADDRESS=${ZOOKEEPER_ADDRESS} # Address or hostname for the ZooKeeper service
ZOOKEEPER_PORT=${ZOOKEEPER_PORT} # Port for ZooKeeper service
# Address or hostname for the ZooKeeper service.
# Default: ZOOKEEPER_ADDRESS=172.28.0.1
ZOOKEEPER_ADDRESS=${ZOOKEEPER_NETWORK_ADDRESS}
# Port for ZooKeeper service.
# Default: ZOOKEEPER_PORT=12181
ZOOKEEPER_PORT=${ZOOKEEPER_PORT}
# ----- MySQL Configuration -----
MYSQL_ADDRESS=${MYSQL_ADDRESS} # Address or hostname for the MySQL service
MYSQL_PORT=${MYSQL_PORT} # Port on which MySQL database service is running
MYSQL_PASSWORD=${MYSQL_PASSWORD} # Password to authenticate with the MySQL database service
# Address or hostname for the MySQL service.
# Default: MYSQL_ADDRESS=172.28.0.1
MYSQL_ADDRESS=${MYSQL_NETWORK_ADDRESS}
# Port on which MySQL database service is running.
# Default: MYSQL_PORT=13306
MYSQL_PORT=${MYSQL_PORT}
# Password to authenticate with the MySQL database service.
# Default: MYSQL_PASSWORD=openIM123
MYSQL_PASSWORD=${MYSQL_PASSWORD}
# ----- MongoDB Configuration -----
MONGO_ADDRESS=${MONGO_ADDRESS} # Address or hostname for the MongoDB service
MONGO_PORT=${MONGO_PORT} # Port on which MongoDB service is running
MONGO_USERNAME=${MONGO_USERNAME} # Username to authenticate with the MongoDB service
MONGO_PASSWORD=${MONGO_PASSWORD} # Password to authenticate with the MongoDB service
MONGO_DATABASE=${MONGO_DATABASE} # Name of the database in MongoDB to be used
# Address or hostname for the MongoDB service.
# Default: MONGO_ADDRESS=172.28.0.1
MONGO_ADDRESS=${MONGO_NETWORK_ADDRESS}
# Port on which MongoDB service is running.
# Default: MONGO_PORT=37017
MONGO_PORT=${MONGO_PORT}
# Username to authenticate with the MongoDB service.
# Default: MONGO_USERNAME=root
MONGO_USERNAME=${MONGO_USERNAME}
# Password to authenticate with the MongoDB service.
# Default: MONGO_PASSWORD=openIM123
MONGO_PASSWORD=${MONGO_PASSWORD}
# Name of the database in MongoDB to be used.
# Default: MONGO_DATABASE=openIM_v3
MONGO_DATABASE=${MONGO_DATABASE}
# ----- Redis Configuration -----
REDIS_ADDRESS=${REDIS_ADDRESS} # Address or hostname for the Redis service
REDIS_PORT=${REDIS_PORT} # Port on which Redis in-memory data structure store is running
REDIS_PASSWORD=${REDIS_PASSWORD} # Password to authenticate with the Redis service
# Address or hostname for the Redis service.
# Default: REDIS_ADDRESS=172.28.0.1
REDIS_ADDRESS=${REDIS_NETWORK_ADDRESS}
# Port on which Redis in-memory data structure store is running.
# Default: REDIS_PORT=16379
REDIS_PORT=${REDIS_PORT}
# Password to authenticate with the Redis service.
# Default: REDIS_PASSWORD=openIM123
REDIS_PASSWORD=${REDIS_PASSWORD}
# ----- Kafka Configuration -----
KAFKA_ADDRESS=${KAFKA_ADDRESS} # Address or hostname for the Kafka service
KAFKA_PORT=${KAFKA_PORT} # Port on which Kafka distributed streaming platform is running
KAFKA_LATESTMSG_REDIS_TOPIC=${KAFKA_LATESTMSG_REDIS_TOPIC} # Topic in Kafka for storing the latest messages in Redis
KAFKA_MSG_PUSH_TOPIC=${KAFKA_MSG_PUSH_TOPIC} # Topic in Kafka for pushing messages (e.g. notifications or updates)
KAFKA_OFFLINEMSG_MONGO_TOPIC=${KAFKA_OFFLINEMSG_MONGO_TOPIC} # Topic in Kafka for storing offline messages in MongoDB
# ----- MinIO Configuration -----
MINIO_ADDRESS=${MINIO_ADDRESS} # Address or hostname for the MinIO object storage service
MINIO_PORT=${MINIO_PORT} # Port on which MinIO object storage service is running
MINIO_ACCESS_KEY=${MINIO_ACCESS_KEY} # Access key to authenticate with the MinIO service
MINIO_SECRET_KEY=${MINIO_SECRET_KEY} # Secret key corresponding to the access key for MinIO authentication
# Address or hostname for the Kafka service.
# Default: KAFKA_ADDRESS=172.28.0.1
KAFKA_ADDRESS=${KAFKA_NETWORK_ADDRESS}
# Port on which Kafka distributed streaming platform is running.
# Default: KAFKA_PORT=19092
KAFKA_PORT=${KAFKA_PORT}
# Topic in Kafka for storing the latest messages in Redis.
# Default: KAFKA_LATESTMSG_REDIS_TOPIC=latestMsgToRedis
KAFKA_LATESTMSG_REDIS_TOPIC=${KAFKA_LATESTMSG_REDIS_TOPIC}
# Topic in Kafka for pushing messages (e.g. notifications or updates).
# Default: KAFKA_MSG_PUSH_TOPIC=msgToPush
KAFKA_MSG_PUSH_TOPIC=${KAFKA_MSG_PUSH_TOPIC}
# Topic in Kafka for storing offline messages in MongoDB.
# Default: KAFKA_OFFLINEMSG_MONGO_TOPIC=offlineMsgToMongoMysql
KAFKA_OFFLINEMSG_MONGO_TOPIC=${KAFKA_OFFLINEMSG_MONGO_TOPIC}
# ----- MinIO Configuration ----
# Address or hostname for the MinIO object storage service.
# Default: MINIO_ADDRESS=172.28.0.1
MINIO_ADDRESS=${MINIO_NETWORK_ADDRESS}
# Port on which MinIO object storage service is running.
# Default: MINIO_PORT=10005
MINIO_PORT=${MINIO_PORT}
# Access key to authenticate with the MinIO service.
# Default: MINIO_ACCESS_KEY=root
MINIO_ACCESS_KEY=${MINIO_ACCESS_KEY}
# Secret key corresponding to the access key for MinIO authentication.
# Default: MINIO_SECRET_KEY=openIM123
MINIO_SECRET_KEY=${MINIO_SECRET_KEY}
# ----- Prometheus Configuration -----
PROMETHEUS_ADDRESS=${PROMETHEUS_ADDRESS} # Address or hostname for the Prometheus service
PROMETHEUS_PORT=${PROMETHEUS_PORT} # Port on which Prometheus service is running
# Address or hostname for the Prometheus service.
# Default: PROMETHEUS_ADDRESS=172.28.0.1
PROMETHEUS_ADDRESS=${PROMETHEUS_NETWORK_ADDRESS}
# Port on which Prometheus service is running.
# Default: PROMETHEUS_PORT=19090
PROMETHEUS_PORT=${PROMETHEUS_PORT}
# ----- Grafana Configuration -----
GRAFANA_ADDRESS=${GRAFANA_ADDRESS} # Address or hostname for the Grafana service
GRAFANA_PORT=${GRAFANA_PORT} # Port on which Grafana service is running
# ================== OpenIM Web ===========================
OPENIM_WEB_DIST_PATH=${OPENIM_WEB_DIST_PATH} # Path to the OpenIM web distribution
OPENIM_WEB_PORT=${OPENIM_WEB_PORT} # Port on which OpenIM web service is running
OPENIM_WEB_ADDRESS=${OPENIM_WEB_ADDRESS} # Address or hostname for the OpenIM web service
# =================== OpenIM Server =========================
OPENIM_SERVER_ADDRESS=${OPENIM_SERVER_ADDRESS} # Address or hostname for the OpenIM server
OPENIM_WS_PORT=${OPENIM_WS_PORT} # Port for the OpenIM WebSockets
API_OPENIM_PORT=${API_OPENIM_PORT} # Port for the OpenIM API
# =================== OpenIM Chat ===========================
CHAT_BRANCH=${CHAT_BRANCH} # Branch name for OpenIM chat
OPENIM_CHAT_ADDRESS=${OPENIM_CHAT_ADDRESS} # Address or hostname for the OpenIM chat service
OPENIM_CHAT_API_PORT=${OPENIM_CHAT_API_PORT} # Port for the OpenIM chat API
OPENIM_CHAT_DATA_DIR=${OPENIM_CHAT_DATA_DIR} # Directory path for storing data files or related information
# =================== OpenIM Admin ==========================
SERVER_BRANCH=${SERVER_BRANCH} # Branch name for OpenIM server
OPENIM_ADMIN_API_PORT=${OPENIM_ADMIN_API_PORT} # Port for the OpenIM admin API
# Address or hostname for the Grafana service.
# Default: GRAFANA_ADDRESS=172.28.0.1
GRAFANA_ADDRESS=${GRAFANA_NETWORK_ADDRESS}
# Port on which Grafana service is running.
# Default: GRAFANA_PORT=3000
GRAFANA_PORT=${GRAFANA_PORT}
# ======================================
# ============ OpenIM Web ===============
# ======================================
# Path to the OpenIM web distribution.
# Default: OPENIM_WEB_DIST_PATH=/app/dist
OPENIM_WEB_DIST_PATH=${OPENIM_WEB_DIST_PATH}
# Port on which OpenIM web service is running.
# Default: OPENIM_WEB_PORT=11001
OPENIM_WEB_PORT=${OPENIM_WEB_PORT}
# Address or hostname for the OpenIM web service.
# Default: OPENIM_WEB_ADDRESS=172.28.0.1
OPENIM_WEB_ADDRESS=${OPENIM_WEB_NETWORK_ADDRESS}
# ======================================
# ========= OpenIM Server ==============
# ======================================
# Address or hostname for the OpenIM server.
# Default: OPENIM_SERVER_ADDRESS=172.28.0.1
OPENIM_SERVER_ADDRESS=${OPENIM_SERVER_NETWORK_ADDRESS}
# Port for the OpenIM WebSockets.
# Default: OPENIM_WS_PORT=10001
OPENIM_WS_PORT=${OPENIM_WS_PORT}
# Port for the OpenIM API.
# Default: API_OPENIM_PORT=10002
API_OPENIM_PORT=${API_OPENIM_PORT}
# ======================================
# ========== OpenIM Chat ===============
# ======================================
# Branch name for OpenIM chat.
# Default: CHAT_BRANCH=main
CHAT_BRANCH=${CHAT_BRANCH}
# Address or hostname for the OpenIM chat service.
# Default: OPENIM_CHAT_ADDRESS=172.28.0.1
OPENIM_CHAT_ADDRESS=${OPENIM_CHAT_NETWORK_ADDRESS}
# Port for the OpenIM chat API.
# Default: OPENIM_CHAT_API_PORT=10008
OPENIM_CHAT_API_PORT=${OPENIM_CHAT_API_PORT}
# Directory path for storing data files or related information for OpenIM chat.
# Default: OPENIM_CHAT_DATA_DIR=./openim-chat/main
OPENIM_CHAT_DATA_DIR=${OPENIM_CHAT_DATA_DIR}
# ======================================
# ========== OpenIM Admin ==============
# ======================================
# Branch name for OpenIM server.
# Default: SERVER_BRANCH=main
SERVER_BRANCH=${SERVER_BRANCH}
# Port for the OpenIM admin API.
# Default: OPENIM_ADMIN_API_PORT=10009
OPENIM_ADMIN_API_PORT=${OPENIM_ADMIN_API_PORT}

@ -61,7 +61,13 @@ openim::log::info "\n## Check all dependent service ports"
echo "+++ The port being checked: ${OPENIM_DEPENDENCY_PORT_LISTARIES[@]}"
set +e
openim::util::check_ports ${OPENIM_DEPENDENCY_PORT_LISTARIES[@]}
if grep -qE 'docker|kubepods' /proc/1/cgroup || [ -f /.dockerenv ]; then
openim::color::echo ${COLOR_BLUE} "Environment in the interior of the container"
else
openim::color::echo ${COLOR_BLUE} "The environment is outside the container"
openim::util::check_ports ${OPENIM_DEPENDENCY_PORT_LISTARIES[@]} || return 0
fi
if [[ $? -ne 0 ]]; then
openim::log::error_exit "The service does not start properly, please check the port, query variable definition!"
@ -69,7 +75,6 @@ if [[ $? -ne 0 ]]; then
else
echo "++++ Check all dependent service ports successfully !"
fi
set -e
openim::log::info "\n## Check OpenIM service name"
. $(dirname ${BASH_SOURCE})/install/openim-msgtransfer.sh openim::msgtransfer::check
@ -83,3 +88,5 @@ if [[ $? -ne 0 ]]; then
else
echo "++++ Check all openim service ports successfully !"
fi
set -e

@ -42,7 +42,7 @@ function def() {
}
# app要能访问到此ip和端口或域名
def "API_URL" "http://${IP}:10002"
readonly API_URL=${API_URL:-"http://${IP}:10002"}
# OpenIM Docker Compose 数据存储的默认路径
def "DATA_DIR" "${OPENIM_ROOT}"
@ -74,7 +74,6 @@ def "SERVER_BRANCH" "main"
###################### OpenIM Docker Network ######################
# 设置 Docker 网络的网段
readonly DOCKER_BRIDGE_SUBNET=${DOCKER_BRIDGE_SUBNET:-'172.28.0.0/16'}
IP_PREFIX=$(echo $DOCKER_BRIDGE_SUBNET | cut -d '/' -f 1)
SUBNET=$(echo $DOCKER_BRIDGE_SUBNET | cut -d '/' -f 2)
LAST_OCTET=$(echo $IP_PREFIX | cut -d '.' -f 4)
@ -128,48 +127,57 @@ def "API_LISTEN_IP" "0.0.0.0" # API的监听IP
###################### openim-chat 配置信息 ######################
def "OPENIM_CHAT_DATA_DIR" "./openim-chat/${CHAT_BRANCH}"
def "OPENIM_CHAT_ADDRESS" "${DOCKER_BRIDGE_GATEWAY}" # OpenIM服务地址
def "OPENIM_CHAT_API_PORT" "10008" # OpenIM API端口
def "OPENIM_ADMIN_API_PORT" "10009" # OpenIM Admin API端口
def "OPENIM_CHAT_ADDRESS" "${DOCKER_BRIDGE_GATEWAY}" # OpenIM服务地址
def "OPENIM_CHAT_API_PORT" "10008" # OpenIM API端口
def "CHAT_API_LISTEN_IP" "" # OpenIM API的监听IP
def "OPENIM_ADMIN_API_PORT" "10009" # OpenIM Admin API端口
def "ADMIN_API_LISTEN_IP" "" # OpenIM Admin API的监听IP
def "OPENIM_ADMIN_PORT" "30200" # OpenIM chat Admin端口
def "OPENIM_CHAT_PORT" "30300" # OpenIM chat Admin的监听IP
def "OPENIM_ADMIN_NAME" "admin" # openim-chat Admin用户名
def "OPENIM_CHAT_NAME" "chat" # openim-chat chat用户名
# TODO 注意: 一般的配置都可以使用 def 函数来定义,如果是包含特殊字符,比如说:
# TODO readonly MSG_DESTRUCT_TIME=${MSG_DESTRUCT_TIME:-'0 2 * * *'}
# TODO 使用 readonly 来定义合适,负责无法正常解析, 并且 yaml 模板需要加 "" 来包裹
###################### Zookeeper 配置信息 ######################
def "ZOOKEEPER_SCHEMA" "openim" # Zookeeper的模式
def "ZOOKEEPER_PORT" "12181" # Zookeeper的端口
def "ZOOKEEPER_ADDRESS" "${DOCKER_BRIDGE_GATEWAY}" # Zookeeper的地址
def "ZOOKEEPER_USERNAME" "" # Zookeeper的用户名
def "ZOOKEEPER_PASSWORD" "" # Zookeeper的密码
def "ZOOKEEPER_SCHEMA" "openim" # Zookeeper的模式
def "ZOOKEEPER_PORT" "12181" # Zookeeper的端口
def "ZOOKEEPER_ADDRESS" "${DOCKER_BRIDGE_GATEWAY}" # Zookeeper的地址
def "ZOOKEEPER_USERNAME" "" # Zookeeper的用户名
def "ZOOKEEPER_PASSWORD" "" # Zookeeper的密码
###################### MySQL 配置信息 ######################
def "MYSQL_PORT" "13306" # MySQL的端口
def "MYSQL_ADDRESS" "${DOCKER_BRIDGE_GATEWAY}" # MySQL的地址
def "MYSQL_USERNAME" "${USER}" # MySQL的用户名
def "MYSQL_PASSWORD" "${PASSWORD}" # MySQL的密码
def "MYSQL_DATABASE" "${DATABASE_NAME}" # MySQL的数据库名
def "MYSQL_MAX_OPEN_CONN" "1000" # 最大打开的连接数
def "MYSQL_MAX_IDLE_CONN" "100" # 最大空闲连接数
def "MYSQL_MAX_LIFETIME" "60" # 连接可以重用的最大生命周期(秒)
def "MYSQL_LOG_LEVEL" "4" # 日志级别
def "MYSQL_SLOW_THRESHOLD" "500" # 慢查询阈值(毫秒)
def "MYSQL_PORT" "13306" # MySQL的端口
def "MYSQL_ADDRESS" "${DOCKER_BRIDGE_GATEWAY}" # MySQL的地址
def "MYSQL_USERNAME" "${USER}" # MySQL的用户名
def "MYSQL_PASSWORD" "${PASSWORD}" # MySQL的密码
def "MYSQL_DATABASE" "${DATABASE_NAME}" # MySQL的数据库名
def "MYSQL_MAX_OPEN_CONN" "1000" # 最大打开的连接数
def "MYSQL_MAX_IDLE_CONN" "100" # 最大空闲连接数
def "MYSQL_MAX_LIFETIME" "60" # 连接可以重用的最大生命周期(秒)
def "MYSQL_LOG_LEVEL" "4" # 日志级别
def "MYSQL_SLOW_THRESHOLD" "500" # 慢查询阈值(毫秒)
###################### MongoDB 配置信息 ######################
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_PASSWORD" "${PASSWORD}" # MongoDB的密码
def "MONGO_MAX_POOL_SIZE" "100" # 最大连接池大小
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_PASSWORD" "${PASSWORD}" # MongoDB的密码
def "MONGO_MAX_POOL_SIZE" "100" # 最大连接池大小
###################### Object 配置信息 ######################
def "OBJECT_ENABLE" "minio" # 对象是否启用
def "OBJECT_ENABLE" "minio" # 对象是否启用
# 对象的API地址
readonly OBJECT_APIURL=${OBJECT_APIURL:-"http://${IP}:10002"}
def "MINIO_BUCKET" "openim" # MinIO的存储桶名称
def "MINIO_PORT" "10005" # MinIO的端口
def "MINIO_BUCKET" "openim" # MinIO的存储桶名称
def "MINIO_PORT" "10005" # MinIO的端口
# MinIO的端点URL
def MINIO_ADDRESS "${DOCKER_BRIDGE_GATEWAY}"
readonly MINIO_ENDPOINT=${MINIO_ENDPOINT:-"http://${MINIO_ADDRESS}:${MINIO_PORT}"}
@ -179,15 +187,15 @@ def "MINIO_SESSION_TOKEN"
readonly MINIO_SIGN_ENDPOINT=${MINIO_SIGN_ENDPOINT:-"http://${IP}:${MINIO_PORT}"} # signEndpoint为minio公网地址 # MinIO的会话令牌
# 腾讯云COS的存储桶URL
def "COS_BUCKET_URL" "https://temp-1252357374.cos.ap-chengdu.myqcloud.com"
def "COS_SECRET_ID" # 腾讯云COS的密钥ID
def "COS_SECRET_KEY" # 腾讯云COS的密钥
def "COS_SESSION_TOKEN" # 腾讯云COS的会话令牌
def "OSS_ENDPOINT" "https://oss-cn-chengdu.aliyuncs.com" # 阿里云OSS的端点URL
def "OSS_BUCKET" "demo-9999999" # 阿里云OSS的存储桶名称
def "OSS_BUCKET_URL" "https://demo-9999999.oss-cn-chengdu.aliyuncs.com" # 阿里云OSS的存储桶URL
def "OSS_ACCESS_KEY_ID" # 阿里云OSS的访问密钥ID
def "OSS_ACCESS_KEY_SECRET" # 阿里云OSS的密钥
def "OSS_SESSION_TOKEN" # 阿里云OSS的会话令牌
def "COS_SECRET_ID" # 腾讯云COS的密钥ID
def "COS_SECRET_KEY" # 腾讯云COS的密钥
def "COS_SESSION_TOKEN" # 腾讯云COS的会话令牌
def "OSS_ENDPOINT" "https://oss-cn-chengdu.aliyuncs.com" # 阿里云OSS的端点URL
def "OSS_BUCKET" "demo-9999999" # 阿里云OSS的存储桶名称
def "OSS_BUCKET_URL" "https://demo-9999999.oss-cn-chengdu.aliyuncs.com" # 阿里云OSS的存储桶URL
def "OSS_ACCESS_KEY_ID" # 阿里云OSS的访问密钥ID
def "OSS_ACCESS_KEY_SECRET" # 阿里云OSS的密钥
def "OSS_SESSION_TOKEN" # 阿里云OSS的会话令牌
###################### Redis 配置信息 ######################
def "REDIS_PORT" "16379" # Redis的端口
@ -209,20 +217,20 @@ def "KAFKA_CONSUMERGROUPID_MYSQL" "mysql" # `Kafka` 的消费
def "KAFKA_CONSUMERGROUPID_PUSH" "push" # `Kafka` 的消费组ID到推送
###################### openim-web 配置信息 ######################
def "OPENIM_WEB_PORT" "11001" # openim-web的端口
def "OPENIM_WEB_ADDRESS" "${DOCKER_BRIDGE_GATEWAY}" # openim-web的地址
def "OPENIM_WEB_DIST_PATH" "/app/dist" # openim-web的dist路径
def "OPENIM_WEB_PORT" "11001" # openim-web的端口
def "OPENIM_WEB_ADDRESS" "${DOCKER_BRIDGE_GATEWAY}" # openim-web的地址
def "OPENIM_WEB_DIST_PATH" "/app/dist" # openim-web的dist路径
###################### RPC 配置信息 ######################
def "RPC_REGISTER_IP" # RPC的注册IP
def "RPC_LISTEN_IP" "0.0.0.0" # RPC的监听IP
def "RPC_REGISTER_IP" # RPC的注册IP
def "RPC_LISTEN_IP" "0.0.0.0" # RPC的监听IP
###################### prometheus 配置 ######################
def "PROMETHEUS_PORT" "19090" # Prometheus的端口
def "PROMETHEUS_PORT" "19090" # Prometheus的端口
def "PROMETHEUS_ADDRESS" "${DOCKER_BRIDGE_GATEWAY}" # Prometheus的地址
###################### Grafana 配置信息 ######################
def "GRAFANA_PORT" "3000" # Grafana的端口
def "GRAFANA_PORT" "3000" # Grafana的端口
def "GRAFANA_ADDRESS" "${DOCKER_BRIDGE_GATEWAY}" # Grafana的地址
###################### RPC Port Configuration Variables ######################

Loading…
Cancel
Save