Compare commits

..

11 Commits

Author SHA1 Message Date
Xinwei Xiong(cubxxw-openim) d187f53c79 fix: kafka environment port
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-09-03 11:02:26 +08:00
Xinwei Xiong(cubxxw-openim) 5134fdf7e7 fix: kafka environment port
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-09-03 11:02:01 +08:00
Xinwei Xiong(cubxxw-openim) 347f6f3382 fix: kafka environment port
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-09-03 10:52:55 +08:00
Xinwei Xiong(cubxxw-openim) 103aa98e95 fix: kafka environment port
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-09-03 10:52:17 +08:00
Xinwei Xiong(cubxxw-openim) 77733fdb2b feat: docker compose
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-09-03 09:36:32 +08:00
Xinwei Xiong(cubxxw-openim) 3c796b7405 feat: set config file path
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-09-02 21:08:38 +08:00
Xinwei Xiong(cubxxw-openim) fa263b9a87 feat: set config file path
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-09-02 20:40:11 +08:00
Xinwei Xiong(cubxxw-openim) 108c4b1a50 feat: set config file path
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-09-02 19:55:01 +08:00
Xinwei Xiong(cubxxw-openim) e4eb8ffd6e fix: scripts fix
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-09-02 17:27:18 +08:00
Xinwei Xiong(cubxxw-openim) ca72ce2d6f fix: scripts fix
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-09-01 17:41:46 +08:00
Xinwei Xiong(cubxxw-openim) 475ad26abd fix: scripts fix
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-09-01 11:24:37 +08:00
17 changed files with 942 additions and 271 deletions
+231 -30
View File
@@ -1,64 +1,265 @@
# The following is automatically generated # ======================================
# Use `make init` OR `./scripts/init-config.sh` # ========= Basic Configuration ========
# # ======================================
# ================= Basic Configuration ===================
# Endpoint for the MinIO object storage service
MINIO_ENDPOINT=http://127.0.0.1:10005
# Base URL for the application programming interface (API) # The user for authentication or system operations.
API_URL=http://127.0.0.1:10002 # Default: USER=root
USER=root
# Directory path for storing data files or related information # 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://172.28.0.1:10002
# Directory path for storing data files or related information.
# Default: DATA_DIR=./
DATA_DIR=./ DATA_DIR=./
# ============ Component Extension Configuration ========== # ======================================
# Address or hostname for the ZooKeeper service (often used in distributed systems for maintaining configuration information) # ========= Network Configuration ======
ZOOKEEPER_ADDRESS=127.0.0.1 # ======================================
# Port on which MySQL database service is running # 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 ==========
# ----- 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 -----
# 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 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 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 MONGO_PORT=37017
# Username to authenticate with the MongoDB service # Username to authenticate with the MongoDB service.
# Default: MONGO_USERNAME=root
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 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 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 REDIS_PORT=16379
# Password to authenticate with the Redis service # Password to authenticate with the Redis service.
# Default: REDIS_PASSWORD=openIM123
REDIS_PASSWORD=openIM123 REDIS_PASSWORD=openIM123
# Port on which Kafka distributed streaming platform is running # ----- Kafka Configuration -----
KAFKA_PORT=9092 # 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 # Port on which Kafka distributed streaming platform is running.
KAFKA_ADDR=127.0.0.1 # Default: KAFKA_PORT=19092
KAFKA_PORT=19094
# 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 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 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 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 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 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 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
+26 -34
View File
@@ -128,9 +128,7 @@ $ make demo
```bash ```bash
# choose what you need, We take branch 3.2 as an example 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
$ 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
``` ```
> **Note** > **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 You can use `make init` to quickly initialize a configuration file
Modify the automation script:
```bash
cat scripts/install/environment.sh
```
1. Recommended using environment variables:
```bash
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"
```
Next, update the configuration using make init:
```bash ```bash
$ make init $ make init
$ git diff $ 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
```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
```
**3. Deploy and start**
> **Note**
>
> You can deploy either directly with `make install` or with `docker compose up`, the logic is the same
```bash
$ make install
# OR
$ docker-compose up
```
4. Check the service
```bash
$ make check
```
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> </details>
@@ -50,7 +50,7 @@ COPY --from=builder /openim/openim-server/dist /openim/openim-server/dist
ENV PORT 11001 ENV PORT 11001
ENV DISTPATH /openim/openim-server/dist ENV DISTPATH /openim/openim-server/dist
EXPOSE $PORT EXPOSE 11001
RUN mv ${OPENIM_SERVER_BINDIR}/tools/$(get_os)/$(get_arch)/openim-web /usr/bin/openim-web RUN mv ${OPENIM_SERVER_BINDIR}/tools/$(get_os)/$(get_arch)/openim-web /usr/bin/openim-web
+25 -24
View File
@@ -28,9 +28,9 @@
# Zookeeper password # Zookeeper password
zookeeper: zookeeper:
schema: openim schema: openim
address: [ 127.0.0.1:2181 ] address: [ 172.28.0.1:12181 ]
username: username: ''
password: password: ''
###################### Mysql ###################### ###################### Mysql ######################
# MySQL configuration # MySQL configuration
@@ -42,7 +42,7 @@ zookeeper:
# Log level: 1=slient, 2=error, 3=warn, 4=info # Log level: 1=slient, 2=error, 3=warn, 4=info
# Slow query threshold in milliseconds # Slow query threshold in milliseconds
mysql: mysql:
address: [ 127.0.0.1:13306 ] address: [ 172.28.0.1:13306 ]
username: root username: root
password: openIM123 password: openIM123
database: openIM_v3 database: openIM_v3
@@ -60,8 +60,8 @@ mysql:
# Default MongoDB database name # Default MongoDB database name
# Maximum connection pool size # Maximum connection pool size
mongo: mongo:
uri: uri: ''
address: [ 127.0.0.1:37017 ] address: [ 172.28.0.1:37017 ]
database: openIM_v3 database: openIM_v3
username: root username: root
password: openIM123 password: openIM123
@@ -72,8 +72,8 @@ mongo:
# #
# Username is required only for Redis version 6.0+ # Username is required only for Redis version 6.0+
redis: redis:
address: [ 127.0.0.1:16379 ] address: [ 172.28.0.1:16379 ]
username: username: ''
password: openIM123 password: openIM123
###################### Kafka configuration information ###################### ###################### Kafka configuration information ######################
@@ -84,9 +84,9 @@ redis:
# It's not recommended to modify this topic name # It's not recommended to modify this topic name
# Consumer group ID, it's not recommended to modify # Consumer group ID, it's not recommended to modify
kafka: kafka:
username: username: ''
password: password: ''
addr: [ 127.0.0.1:9092 ] addr: [ 172.28.0.1:19094 ]
latestMsgToRedis: latestMsgToRedis:
topic: "latestMsgToRedis" topic: "latestMsgToRedis"
offlineMsgToMongo: offlineMsgToMongo:
@@ -105,7 +105,7 @@ kafka:
# IP address to register with zookeeper when starting RPC, the IP and corresponding rpcPort should be accessible by api/gateway # IP address to register with zookeeper when starting RPC, the IP and corresponding rpcPort should be accessible by api/gateway
# Default listen IP is 0.0.0.0 # Default listen IP is 0.0.0.0
rpc: rpc:
registerIP: registerIP: ''
listenIP: 0.0.0.0 listenIP: 0.0.0.0
###################### API configuration information ###################### ###################### API configuration information ######################
@@ -132,26 +132,27 @@ api:
# minio.signEndpoint is minio public network address # minio.signEndpoint is minio public network address
object: object:
enable: "minio" enable: "minio"
apiURL: "http://127.0.0.1:10002" apiURL: "http://14.153.6.114:10002"
minio: minio:
bucket: "openim" bucket: "openim"
endpoint: "http://127.0.0.1:10005" endpoint: "http://172.28.0.1:10005"
accessKeyID: "root" accessKeyID: "root"
secretAccessKey: "openIM123" secretAccessKey: "openIM123"
sessionToken: "" sessionToken: ''
signEndpoint: "http://127.0.0.1:10005" signEndpoint: "http://14.153.6.114:10005"
cos: cos:
bucketURL: "https://temp-1252357374.cos.ap-chengdu.myqcloud.com" bucketURL: https://temp-1252357374.cos.ap-chengdu.myqcloud.com
secretID: "" secretID: ''
secretKey: "" secretKey: ''
sessionToken: "" sessionToken: ''
oss: oss:
endpoint: "https://oss-cn-chengdu.aliyuncs.com" endpoint: "https://oss-cn-chengdu.aliyuncs.com"
bucket: "demo-9999999" bucket: "demo-9999999"
bucketURL: "https://demo-9999999.oss-cn-chengdu.aliyuncs.com" bucketURL: "https://demo-9999999.oss-cn-chengdu.aliyuncs.com"
accessKeyID: "" accessKeyID: ''
accessKeySecret: "" accessKeySecret: ''
sessionToken: "" sessionToken: ''
###################### RPC Port Configuration ###################### ###################### RPC Port Configuration ######################
# RPC service ports # RPC service ports
@@ -193,7 +194,7 @@ rpcRegisterName:
# Whether to output in json format # Whether to output in json format
# Whether to include stack trace in logs # Whether to include stack trace in logs
log: log:
storageLocation: ../../../../../logs/ storageLocation: ../logs
rotationTime: 24 rotationTime: 24
remainRotationCount: 2 remainRotationCount: 2
remainLogLevel: 6 remainLogLevel: 6
+110
View File
@@ -0,0 +1,110 @@
# 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:
- 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
+215 -42
View File
@@ -1,92 +1,265 @@
# Copyright © 2023 OpenIM. All rights reserved. # ======================================
# # ========= Basic Configuration ========
# 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 =================== # The user for authentication or system operations.
# User for authentication or system operations # Default: USER=root
USER=${USER} USER=${USER}
# Password associated with the specified user for authentication # Password associated with the specified user for authentication.
# Default: PASSWORD=openIM123
PASSWORD=${PASSWORD} PASSWORD=${PASSWORD}
# Endpoint for the MinIO object storage service # Endpoint for the MinIO object storage service.
# Default: MINIO_ENDPOINT=http://172.28.0.1:10005
MINIO_ENDPOINT=${MINIO_ENDPOINT} MINIO_ENDPOINT=${MINIO_ENDPOINT}
# Base URL for the application programming interface (API) # Base URL for the application programming interface (API).
# Default: API_URL=http://172.28.0.1:10002
API_URL=${API_URL} API_URL=${API_URL}
# Directory path for storing data files or related information # Directory path for storing data files or related information.
# Default: DATA_DIR=./
DATA_DIR=${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 ========== # ============ Component Extension Configuration ==========
# Address or hostname for the ZooKeeper service (often used in distributed systems for maintaining configuration information) # ----- ZooKeeper Configuration -----
ZOOKEEPER_ADDRESS=${ZOOKEEPER_ADDRESS} # 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} ZOOKEEPER_PORT=${ZOOKEEPER_PORT}
# Port on which MySQL database service is running # ----- MySQL Configuration -----
# 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} MYSQL_PORT=${MYSQL_PORT}
# Password to authenticate with the MySQL database service # Password to authenticate with the MySQL database service.
# Default: MYSQL_PASSWORD=openIM123
MYSQL_PASSWORD=${MYSQL_PASSWORD} MYSQL_PASSWORD=${MYSQL_PASSWORD}
# 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=${MONGO_NETWORK_ADDRESS}
# Port on which MongoDB service is running.
# Default: MONGO_PORT=37017
MONGO_PORT=${MONGO_PORT} MONGO_PORT=${MONGO_PORT}
# Username to authenticate with the MongoDB service # Username to authenticate with the MongoDB service.
# Default: MONGO_USERNAME=root
MONGO_USERNAME=${MONGO_USERNAME} MONGO_USERNAME=${MONGO_USERNAME}
# Password to authenticate with the MongoDB service # Password to authenticate with the MongoDB service.
# Default: MONGO_PASSWORD=openIM123
MONGO_PASSWORD=${MONGO_PASSWORD} MONGO_PASSWORD=${MONGO_PASSWORD}
# 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=${MONGO_DATABASE} MONGO_DATABASE=${MONGO_DATABASE}
# 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=${REDIS_NETWORK_ADDRESS}
# Port on which Redis in-memory data structure store is running.
# Default: REDIS_PORT=16379
REDIS_PORT=${REDIS_PORT} REDIS_PORT=${REDIS_PORT}
# Password to authenticate with the Redis service # Password to authenticate with the Redis service.
# Default: REDIS_PASSWORD=openIM123
REDIS_PASSWORD=${REDIS_PASSWORD} REDIS_PASSWORD=${REDIS_PASSWORD}
# Port on which Kafka distributed streaming platform is running # ----- Kafka Configuration -----
# 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} KAFKA_PORT=${KAFKA_PORT}
# Address or hostname for the Kafka service # Topic in Kafka for storing the latest messages in Redis.
KAFKA_ADDR=${KAFKA_ADDR} # Default: KAFKA_LATESTMSG_REDIS_TOPIC=latestMsgToRedis
# Topic in Kafka for storing the latest messages in Redis
KAFKA_LATESTMSG_REDIS_TOPIC=${KAFKA_LATESTMSG_REDIS_TOPIC} KAFKA_LATESTMSG_REDIS_TOPIC=${KAFKA_LATESTMSG_REDIS_TOPIC}
# 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=${KAFKA_MSG_PUSH_TOPIC} KAFKA_MSG_PUSH_TOPIC=${KAFKA_MSG_PUSH_TOPIC}
# 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=${KAFKA_OFFLINEMSG_MONGO_TOPIC} KAFKA_OFFLINEMSG_MONGO_TOPIC=${KAFKA_OFFLINEMSG_MONGO_TOPIC}
# 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=${MINIO_NETWORK_ADDRESS}
# Port on which MinIO object storage service is running.
# Default: MINIO_PORT=10005
MINIO_PORT=${MINIO_PORT} MINIO_PORT=${MINIO_PORT}
# Access key to authenticate with the MinIO service # Access key to authenticate with the MinIO service.
# Default: MINIO_ACCESS_KEY=root
MINIO_ACCESS_KEY=${MINIO_ACCESS_KEY} MINIO_ACCESS_KEY=${MINIO_ACCESS_KEY}
# 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=${MINIO_SECRET_KEY} MINIO_SECRET_KEY=${MINIO_SECRET_KEY}
# ================== OpenIM Web =========================== # ----- Prometheus Configuration -----
# 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 -----
# 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} OPENIM_WEB_DIST_PATH=${OPENIM_WEB_DIST_PATH}
OPENIM_WEB_PPRT=${OPENIM_WEB_PPRT}
# 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}
# =================== BRANCH NAME ========================= # ======================================
# ========= 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} 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} SERVER_BRANCH=${SERVER_BRANCH}
# Port for the OpenIM admin API.
# Default: OPENIM_ADMIN_API_PORT=10009
OPENIM_ADMIN_API_PORT=${OPENIM_ADMIN_API_PORT}
+2 -2
View File
@@ -144,7 +144,7 @@ source ./environment.sh
cat > openim-api.service.template <<EOF cat > openim-api.service.template <<EOF
[Unit] [Unit]
Description=OpenIM Server API Description=OpenIM Server API
Documentation=https://github.com/marmotedu/iam/blob/master/init/README.md Documentation=https://github.com/oepnimsdk/open-im-server/blob/master/init/README.md
[Service] [Service]
WorkingDirectory=${OPENIM_DATA_DIR}/openim-api WorkingDirectory=${OPENIM_DATA_DIR}/openim-api
@@ -179,7 +179,7 @@ do
cat > $service.service.template <<EOF cat > $service.service.template <<EOF
[Unit] [Unit]
Description=OpenIM Server - $service Description=OpenIM Server - $service
Documentation=https://github.com/marmotedu/iam/blob/master/init/README.md Documentation=https://github.com/oepnimsdk/open-im-server/blob/master/init/README.md
[Service] [Service]
WorkingDirectory=${OPENIM_DATA_DIR}/$service WorkingDirectory=${OPENIM_DATA_DIR}/$service
+1 -1
View File
@@ -86,7 +86,7 @@ redis:
kafka: kafka:
username: ${KAFKA_USERNAME} username: ${KAFKA_USERNAME}
password: ${KAFKA_PASSWORD} password: ${KAFKA_PASSWORD}
addr: [ ${KAFKA_ADDR}:${KAFKA_PORT} ] addr: [ ${KAFKA_ADDRESS}:${KAFKA_PORT} ]
latestMsgToRedis: latestMsgToRedis:
topic: "${KAFKA_LATESTMSG_REDIS_TOPIC}" topic: "${KAFKA_LATESTMSG_REDIS_TOPIC}"
offlineMsgToMongo: offlineMsgToMongo:
+170 -68
View File
@@ -1,6 +1,38 @@
#fixme Clone openIM Server project before using docker-compose,project addresshttps://github.com/OpenIMSDK/Open-IM-Server.git #fixme Clone openIM Server project before using docker-compose,project addresshttps://github.com/OpenIMSDK/Open-IM-Server.git
version: '3' version: '3'
networks:
server:
driver: bridge
ipam:
driver: default
config:
- subnet: '${DOCKER_BRIDGE_SUBNET}'
gateway: '${DOCKER_BRIDGE_GATEWAY}'
volumes:
mysql_data:
mongodb_data:
mongodb_logs:
mongodb_config:
redis_data:
redis_config:
kafka_data:
minio_data:
minio_config:
openim_server_logs:
openim_server_output:
openim_server_config:
openim_server_scripts:
openim_chat_logs:
openim_chat_output:
openim_chat_config:
openim_chat_scripts:
openim_server_prometheus_config:
openim_server_grafana_datasource:
openim_server_grafana_config:
openim_server_grafana_dashboard:
services: services:
mysql: mysql:
image: mysql:5.7 image: mysql:5.7
@@ -8,11 +40,14 @@ services:
- "${MYSQL_PORT}:3306" - "${MYSQL_PORT}:3306"
container_name: mysql container_name: mysql
volumes: volumes:
- "${DATA_DIR}/components/mysql/data:/var/lib/mysql" - mysql_data:/var/lib/mysql
- "/etc/localtime:/etc/localtime" - "/etc/localtime:/etc/localtime"
environment: environment:
MYSQL_ROOT_PASSWORD: "${MYSQL_PASSWORD}" MYSQL_ROOT_PASSWORD: "${MYSQL_PASSWORD}"
restart: always restart: always
networks:
server:
ipv4_address: ${MYSQL_NETWORK_ADDRESS}
mongodb: mongodb:
image: mongo:6.0.2 image: mongo:6.0.2
@@ -21,9 +56,9 @@ services:
container_name: mongo container_name: mongo
command: --wiredTigerCacheSizeGB 1 --auth command: --wiredTigerCacheSizeGB 1 --auth
volumes: volumes:
- "${DATA_DIR}/components/mongodb/data/db:/data/db" - mongodb_data:/data/db
- "${DATA_DIR}/components/mongodb/data/logs:/data/logs" - mongodb_logs:/data/logs
- "${DATA_DIR}/components/mongodb/data/conf:/etc/mongo" - mongodb_config:/etc/mongo
- "./scripts/mongo-init.sh:/docker-entrypoint-initdb.d/mongo-init.sh:ro" - "./scripts/mongo-init.sh:/docker-entrypoint-initdb.d/mongo-init.sh:ro"
environment: environment:
- TZ=Asia/Shanghai - TZ=Asia/Shanghai
@@ -32,52 +67,71 @@ services:
- MONGO_INITDB_ROOT_PASSWORD=${MONGO_PASSWORD} - MONGO_INITDB_ROOT_PASSWORD=${MONGO_PASSWORD}
- MONGO_INITDB_DATABASE=${MONGO_DATABASE} - MONGO_INITDB_DATABASE=${MONGO_DATABASE}
restart: always restart: always
networks:
server:
ipv4_address: ${MONGO_NETWORK_ADDRESS}
redis: redis:
image: redis:7.0.0 image: redis:7.0.0
container_name: redis
ports: ports:
- "${REDIS_PORT}:6379" - "${REDIS_PORT}:6379"
container_name: redis
volumes: volumes:
- "${DATA_DIR}/components/redis/data:/data" - redis_data:/data
- "${DATA_DIR}/components/redis/config/redis.conf:/usr/local/redis/config/redis.conf" - redis_config:/usr/local/redis/config/redis.conf
environment: environment:
TZ: Asia/Shanghai TZ: Asia/Shanghai
restart: always restart: always
sysctls: sysctls:
net.core.somaxconn: 1024 net.core.somaxconn: 1024
command: redis-server --requirepass ${REDIS_PASSWORD} --appendonly yes command: redis-server --requirepass ${REDIS_PASSWORD} --appendonly yes
networks:
server:
ipv4_address: ${REDIS_NETWORK_ADDRESS}
zookeeper: zookeeper:
image: wurstmeister/zookeeper image: bitnami/zookeeper:3.8
ports: container_name: zookeeper
- "${ZOOKEEPER_PORT}:2181" ports:
container_name: zookeeper - "${ZOOKEEPER_PORT}:2181"
volumes: volumes:
- "/etc/localtime:/etc/localtime" - "/etc/localtime:/etc/localtime"
environment: environment:
TZ: Asia/Shanghai - ALLOW_ANONYMOUS_LOGIN=yes
restart: always - TZ="Asia/Shanghai"
network_mode: "host" restart: always
networks:
server:
ipv4_address: ${ZOOKEEPER_NETWORK_ADDRESS}
kafka: kafka:
image: wurstmeister/kafka image: 'bitnami/kafka:3.5.1'
container_name: kafka container_name: kafka
user: root
restart: always restart: always
ports: ports:
- "${KAFKA_PORT}:9092" - "${KAFKA_PORT}:9094"
volumes:
- ./scripts/create_topic.sh:/opt/bitnami/kafka/create_topic.sh
- ${DATA_DIR}/components/kafka:/bitnami/kafka
command: >
bash -c "
/opt/bitnami/scripts/kafka/run.sh & sleep 5; /opt/bitnami/kafka/create_topic.sh; wait
"
extra_hosts:
- "host.docker.internal:host-gateway"
environment: environment:
TZ: Asia/Shanghai - TZ=Asia/Shanghai
KAFKA_BROKER_ID: 0 - KAFKA_CFG_NODE_ID=0
KAFKA_ZOOKEEPER_CONNECT: "${ZOOKEEPER_ADDRESS}:${ZOOKEEPER_PORT}" - KAFKA_CFG_PROCESS_ROLES=controller,broker
KAFKA_CREATE_TOPICS: "${KAFKA_LATESTMSG_REDIS_TOPIC}:8:1,${KAFKA_MSG_PUSH_TOPIC}:8:1,${KAFKA_OFFLINEMSG_MONGO_TOPIC}:8:1" - KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=0@<your_host>:9093
KAFKA_ADVERTISED_LISTENERS: INSIDE://${KAFKA_ADDR}:${KAFKA_PORT},OUTSIDE://CHANGE_TO_YOUR_EXTERNAL_IP:${KAFKA_PORT} - KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093,EXTERNAL://:9094
KAFKA_LISTENERS: INSIDE://:9092,OUTSIDE://:9093 - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://kafka:9092,EXTERNAL://${DOCKER_BRIDGE_GATEWAY}:${KAFKA_PORT}
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: "INSIDE:PLAINTEXT,OUTSIDE:PLAINTEXT" - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CONTROLLER:PLAINTEXT,EXTERNAL:PLAINTEXT,PLAINTEXT:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: INSIDE - KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER
depends_on: networks:
- zookeeper server:
network_mode: "host" ipv4_address: ${KAFKA_NETWORK_ADDRESS}
minio: minio:
image: minio/minio image: minio/minio
@@ -86,76 +140,124 @@ services:
- "9090:9090" - "9090:9090"
container_name: minio container_name: minio
volumes: volumes:
- "${DATA_DIR}/components/mnt/data:/data" - minio_data:/data
- "${DATA_DIR}/components/mnt/config:/root/.minio" - minio_config:/root/.minio
environment: environment:
MINIO_ROOT_USER: "${MINIO_ACCESS_KEY}" MINIO_ROOT_USER: "${MINIO_ACCESS_KEY}"
MINIO_ROOT_PASSWORD: "${MINIO_SECRET_KEY}" MINIO_ROOT_PASSWORD: "${MINIO_SECRET_KEY}"
restart: always restart: always
command: minio server /data --console-address ':9090' command: minio server /data --console-address ':9090'
networks:
server:
ipv4_address: ${MINIO_NETWORK_ADDRESS}
# openim-web: openim-web:
# image: ghcr.io/openimsdk/openim-web:main image: ghcr.io/openimsdk/openim-web:latest
# container_name: openim-web container_name: openim-web
# environment: environment:
# - OPENIM_WEB_DIST_PATH=${OPENIM_WEB_DIST_PATH} - OPENIM_WEB_DIST_PATH=${OPENIM_WEB_DIST_PATH}
# - OPENIM_WEB_PPRT=${OPENIM_WEB_PPRT} - OPENIM_WEB_PORT=${OPENIM_WEB_PORT}
# restart: always restart: always
# ports: ports:
# - "${OPENIM_WEB_PPRT}:11001" - "${OPENIM_WEB_PORT}:11001"
networks:
server:
ipv4_address: ${OPENIM_WEB_NETWORK_ADDRESS}
openim-server: openim-server:
image: ghcr.io/openimsdk/openim-server:main # image: ghcr.io/openimsdk/openim-server:main
# image: registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-server:main image: registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-server:main
# image: openim/openim-server:main # image: openim/openim-server:main
# build: .
container_name: openim-server container_name: openim-server
ports:
- ${OPENIM_WS_PORT}:10001
- ${API_OPENIM_PORT}:10002
healthcheck: healthcheck:
test: ["CMD", "./scripts/check-all.sh"] test: ["CMD", "/openim/openim-server/scripts/check-all.sh"]
interval: 30s interval: 300s
timeout: 10s timeout: 10s
retries: 5 retries: 5
volumes: volumes:
- ./logs:/openim/openim-server/logs - ./logs:/openim/openim-server/logs
- ./_output:/openim/openim-server/_output
- ./config:/openim/openim-server/config - ./config:/openim/openim-server/config
- ./scripts:/openim/openim-server/scripts - ./scripts:/openim/openim-server/scripts
restart: always restart: always
depends_on: depends_on:
- zookeeper
- kafka - kafka
- mysql - mysql
- mongodb - mongodb
- redis - redis
- minio - minio
network_mode: "host"
logging: logging:
driver: json-file driver: json-file
options: options:
max-size: "1g" max-size: "1g"
max-file: "2" max-file: "2"
networks:
server:
ipv4_address: ${OPENIM_SERVER_NETWORK_ADDRESS}
prometheus: # openim-chat:
image: prom/prometheus # # image: ghcr.io/openimsdk/openim-chat:main
volumes: # image: registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-chat:main
- ./.docker-compose_cfg/prometheus-compose.yml:/etc/prometheus/prometheus.yml # # image: ghcr.io/openimsdk/openim-chat:main
container_name: prometheus # container_name: openim-chat
# ports: # healthcheck:
# - 9091:9091 # test: ["CMD", "/openim/openim-chat/scripts/check_all.sh"]
depends_on: # interval: 300s
- openim-server # timeout: 10s
command: --web.listen-address=:9091 --config.file="/etc/prometheus/prometheus.yml" # retries: 5
network_mode: "host" # ports:
# - ${OPENIM_CHAT_API_PORT}:10008
# - ${OPENIM_ADMIN_API_PORT}:10009
# volumes:
# - openim_chat_logs:/openim/openim-chat/logs
# - openim_chat_output:/openim/openim-chat/_output
# - openim_chat_config:/openim/openim-chat/config
# - openim_chat_scripts:/openim/openim-chat/scripts
# restart: always
# user: root:root
# depends_on:
# - mysql
# - mongodb
# - redis
# - minio
# - server
# logging:
# driver: json-file
# options:
# max-size: "1g"
# max-file: "2"
# networks:
# server:
# ipv4_address: ${OPENIM_CHAT_NETWORK_ADDRESS}
grafana: # prometheus:
image: grafana/grafana # image: prom/prometheus
volumes: # volumes:
- ./.docker-compose_cfg/datasource-compose.yaml:/etc/grafana/provisioning/datasources/datasource.yaml # - openim_server_prometheus_config:/etc/prometheus
- ./.docker-compose_cfg/grafana.ini:/etc/grafana/grafana.ini # container_name: prometheus
- ./.docker-compose_cfg/node-exporter-full_rev1.json:/var/lib/grafana/dashboards/node-exporter-full_rev1.json # ports:
container_name: grafana # - ${PROMETHEUS_PORT}:9091
depends_on: # command: --web.listen-address=:9091 --config.file="/etc/prometheus"
- prometheus # networks:
network_mode: "host" # server:
# ipv4_address: ${PROMETHEUS_NETWORK_ADDRESS}
# grafana:
# image: grafana/grafana
# volumes:
# - openim_server_grafana_datasource:/etc/grafana/provisioning/datasources
# - openim_server_grafana_config:/etc/grafana
# - openim_server_grafana_dashboard:/var/lib/grafana/dashboards
# container_name: grafana
# ports:
# - ${GRAFANA_PORT}:3000
# networks:
# server:
# ipv4_address: ${GRAFANA_NETWORK_ADDRESS}
# node-exporter: # node-exporter:
# image: quay.io/prometheus/node-exporter # image: quay.io/prometheus/node-exporter
+9 -2
View File
@@ -61,7 +61,13 @@ openim::log::info "\n## Check all dependent service ports"
echo "+++ The port being checked: ${OPENIM_DEPENDENCY_PORT_LISTARIES[@]}" echo "+++ The port being checked: ${OPENIM_DEPENDENCY_PORT_LISTARIES[@]}"
set +e 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 if [[ $? -ne 0 ]]; then
openim::log::error_exit "The service does not start properly, please check the port, query variable definition!" 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 else
echo "++++ Check all dependent service ports successfully !" echo "++++ Check all dependent service ports successfully !"
fi fi
set -e
openim::log::info "\n## Check OpenIM service name" openim::log::info "\n## Check OpenIM service name"
. $(dirname ${BASH_SOURCE})/install/openim-msgtransfer.sh openim::msgtransfer::check . $(dirname ${BASH_SOURCE})/install/openim-msgtransfer.sh openim::msgtransfer::check
@@ -83,3 +88,5 @@ if [[ $? -ne 0 ]]; then
else else
echo "++++ Check all openim service ports successfully !" echo "++++ Check all openim service ports successfully !"
fi fi
set -e
+13
View File
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
# Wait for Kafka to be ready
until /opt/bitnami/kafka/bin/kafka-topics.sh --list --bootstrap-server localhost:9092; do
echo "Waiting for Kafka to be ready..."
sleep 2
done
# Create topics
/opt/bitnami/kafka/bin/kafka-topics.sh --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 8 --topic latestMsgToRedis
/opt/bitnami/kafka/bin/kafka-topics.sh --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 8 --topic msgToPush
/opt/bitnami/kafka/bin/kafka-topics.sh --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 8 --topic offlineMsgToMongoMysql
echo "Topics created."
+123 -54
View File
@@ -24,12 +24,17 @@ OPENIM_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd -P)"
LOCAL_OUTPUT_ROOT=""${OPENIM_ROOT}"/${OUT_DIR:-_output}" LOCAL_OUTPUT_ROOT=""${OPENIM_ROOT}"/${OUT_DIR:-_output}"
source "${OPENIM_ROOT}/scripts/lib/init.sh" source "${OPENIM_ROOT}/scripts/lib/init.sh"
#TODO #TODO: Access to the IP networks outside, or you want to use the IP network
# IP=http://127.0.0.1 # IP=http://127.0.0.1
if [ -z "${IP}" ]; then if [ -z "${IP}" ]; then
IP=$(openim::util::get_server_ip) IP=$(openim::util::get_server_ip)
fi fi
# config.gateway custom bridge modes
# if [ -z "{IP_GATEWAY}" ] then
# IP_GATEWAY=$(openim::util::get_local_ip)
# fi
function def() { function def() {
local var_name="$1" local var_name="$1"
local default_value="${2:-}" local default_value="${2:-}"
@@ -37,7 +42,7 @@ function def() {
} }
# app要能访问到此ip和端口或域名 # app要能访问到此ip和端口或域名
def "API_URL" "http://${IP}:10002" readonly API_URL=${API_URL:-"http://${IP}:10002"}
# OpenIM Docker Compose 数据存储的默认路径 # OpenIM Docker Compose 数据存储的默认路径
def "DATA_DIR" "${OPENIM_ROOT}" def "DATA_DIR" "${OPENIM_ROOT}"
@@ -66,6 +71,42 @@ def "ENV_FILE" ""${OPENIM_ROOT}"/scripts/install/environment.sh"
def "CHAT_BRANCH" "main" def "CHAT_BRANCH" "main"
def "SERVER_BRANCH" "main" 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)
generate_ip() {
local NEW_IP="$(echo $IP_PREFIX | cut -d '.' -f 1-3).$((LAST_OCTET++))"
echo $NEW_IP
}
LAST_OCTET=$((LAST_OCTET + 1))
DOCKER_BRIDGE_GATEWAY=$(generate_ip)
LAST_OCTET=$((LAST_OCTET + 1))
MYSQL_NETWORK_ADDRESS=$(generate_ip)
LAST_OCTET=$((LAST_OCTET + 1))
MONGO_NETWORK_ADDRESS=$(generate_ip)
LAST_OCTET=$((LAST_OCTET + 1))
REDIS_NETWORK_ADDRESS=$(generate_ip)
LAST_OCTET=$((LAST_OCTET + 1))
KAFKA_NETWORK_ADDRESS=$(generate_ip)
LAST_OCTET=$((LAST_OCTET + 1))
ZOOKEEPER_NETWORK_ADDRESS=$(generate_ip)
LAST_OCTET=$((LAST_OCTET + 1))
MINIO_NETWORK_ADDRESS=$(generate_ip)
LAST_OCTET=$((LAST_OCTET + 1))
OPENIM_WEB_NETWORK_ADDRESS=$(generate_ip)
LAST_OCTET=$((LAST_OCTET + 1))
OPENIM_SERVER_NETWORK_ADDRESS=$(generate_ip)
LAST_OCTET=$((LAST_OCTET + 1))
OPENIM_CHAT_NETWORK_ADDRESS=$(generate_ip)
LAST_OCTET=$((LAST_OCTET + 1))
PROMETHEUS_NETWORK_ADDRESS=$(generate_ip)
LAST_OCTET=$((LAST_OCTET + 1))
GRAFANA_NETWORK_ADDRESS=$(generate_ip)
###################### openim 配置 ###################### ###################### openim 配置 ######################
# read: https://github.com/OpenIMSDK/Open-IM-Server/blob/main/deployment/init/README.md # read: https://github.com/OpenIMSDK/Open-IM-Server/blob/main/deployment/init/README.md
def "OPENIM_DATA_DIR" "/data/openim" def "OPENIM_DATA_DIR" "/data/openim"
@@ -75,76 +116,98 @@ def "OPENIM_LOG_DIR" "/var/log/openim"
def "CA_FILE" "${OPENIM_CONFIG_DIR}/cert/ca.pem" def "CA_FILE" "${OPENIM_CONFIG_DIR}/cert/ca.pem"
def "OPNEIM_CONFIG" ""${OPENIM_ROOT}"/config" def "OPNEIM_CONFIG" ""${OPENIM_ROOT}"/config"
def "OPENIM_SERVER_ADDRESS" "${DOCKER_BRIDGE_GATEWAY}" # OpenIM服务地址
# OpenIM Web # OpenIM Websocket端口
def "OPENIM_WEB_DIST_PATH" "/app/dist" readonly OPENIM_WS_PORT=${OPENIM_WS_PORT:-'10001'}
def "OPENIM_WEB_PPRT" "11001"
# OpenIM API端口
readonly API_OPENIM_PORT=${API_OPENIM_PORT:-'10002'}
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 "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 注意: 一般的配置都可以使用 def 函数来定义,如果是包含特殊字符,比如说:
# TODO readonly MSG_DESTRUCT_TIME=${MSG_DESTRUCT_TIME:-'0 2 * * *'} # TODO readonly MSG_DESTRUCT_TIME=${MSG_DESTRUCT_TIME:-'0 2 * * *'}
# TODO 使用 readonly 来定义合适,负责无法正常解析, 并且 yaml 模板需要加 "" 来包裹 # TODO 使用 readonly 来定义合适,负责无法正常解析, 并且 yaml 模板需要加 "" 来包裹
###################### Zookeeper 配置信息 ###################### ###################### Zookeeper 配置信息 ######################
def "ZOOKEEPER_SCHEMA" "openim" # Zookeeper的模式 def "ZOOKEEPER_SCHEMA" "openim" # Zookeeper的模式
def "ZOOKEEPER_PORT" "2181" # Zookeeper的端口 def "ZOOKEEPER_PORT" "12181" # Zookeeper的端口
def "ZOOKEEPER_ADDRESS" "127.0.0.1" # Zookeeper的地址 def "ZOOKEEPER_ADDRESS" "${DOCKER_BRIDGE_GATEWAY}" # Zookeeper的地址
def "ZOOKEEPER_USERNAME" "" # Zookeeper的用户名 def "ZOOKEEPER_USERNAME" "" # Zookeeper的用户名
def "ZOOKEEPER_PASSWORD" "" # Zookeeper的密码 def "ZOOKEEPER_PASSWORD" "" # Zookeeper的密码
###################### MySQL 配置信息 ###################### ###################### MySQL 配置信息 ######################
def "MYSQL_PORT" "13306" # MySQL的端口 def "MYSQL_PORT" "13306" # MySQL的端口
def "MYSQL_ADDRESS" "127.0.0.1" # MySQL的地址 def "MYSQL_ADDRESS" "${DOCKER_BRIDGE_GATEWAY}" # MySQL的地址
def "MYSQL_USERNAME" "${USER}" # MySQL的用户名 def "MYSQL_USERNAME" "${USER}" # MySQL的用户名
def "MYSQL_PASSWORD" "${PASSWORD}" # MySQL的密码 def "MYSQL_PASSWORD" "${PASSWORD}" # MySQL的密码
def "MYSQL_DATABASE" "${DATABASE_NAME}" # MySQL的数据库名 def "MYSQL_DATABASE" "${DATABASE_NAME}" # MySQL的数据库名
def "MYSQL_MAX_OPEN_CONN" "1000" # 最大打开的连接数 def "MYSQL_MAX_OPEN_CONN" "1000" # 最大打开的连接数
def "MYSQL_MAX_IDLE_CONN" "100" # 最大空闲连接数 def "MYSQL_MAX_IDLE_CONN" "100" # 最大空闲连接数
def "MYSQL_MAX_LIFETIME" "60" # 连接可以重用的最大生命周期(秒) def "MYSQL_MAX_LIFETIME" "60" # 连接可以重用的最大生命周期(秒)
def "MYSQL_LOG_LEVEL" "4" # 日志级别 def "MYSQL_LOG_LEVEL" "4" # 日志级别
def "MYSQL_SLOW_THRESHOLD" "500" # 慢查询阈值(毫秒) def "MYSQL_SLOW_THRESHOLD" "500" # 慢查询阈值(毫秒)
###################### MongoDB 配置信息 ###################### ###################### MongoDB 配置信息 ######################
def "MONGO_URI" # MongoDB的URI def "MONGO_URI" # MongoDB的URI
def "MONGO_PORT" "37017" # MongoDB的端口 def "MONGO_PORT" "37017" # MongoDB的端口
def "MONGO_ADDRESS" "127.0.0.1" # MongoDB的地址 def "MONGO_ADDRESS" "${DOCKER_BRIDGE_GATEWAY}" # MongoDB的地址
def "MONGO_DATABASE" "${DATABASE_NAME}" # MongoDB的数据库名 def "MONGO_DATABASE" "${DATABASE_NAME}" # MongoDB的数据库名
def "MONGO_USERNAME" "${USER}" # MongoDB的用户名 def "MONGO_USERNAME" "${USER}" # MongoDB的用户名
def "MONGO_PASSWORD" "${PASSWORD}" # MongoDB的密码 def "MONGO_PASSWORD" "${PASSWORD}" # MongoDB的密码
def "MONGO_MAX_POOL_SIZE" "100" # 最大连接池大小 def "MONGO_MAX_POOL_SIZE" "100" # 最大连接池大小
###################### Object 配置信息 ###################### ###################### Object 配置信息 ######################
def "OBJECT_ENABLE" "minio" # 对象是否启用 def "OBJECT_ENABLE" "minio" # 对象是否启用
def "OBJECT_APIURL" "http://${IP}:10002" # 对象的API地址 # 对象的API地址
def "MINIO_BUCKET" "openim" # MinIO的存储桶名称 readonly OBJECT_APIURL=${OBJECT_APIURL:-"http://${IP}:10002"}
def "MINIO_PORT" "10005" # MinIO的端口 def "MINIO_BUCKET" "openim" # MinIO的存储桶名称
def "MINIO_PORT" "10005" # MinIO的端口
# MinIO的端点URL # MinIO的端点URL
readonly MINIO_ENDPOINT=${MINIO_ENDPOINT:-"http://127.0.0.1:${MINIO_PORT}"} 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" "${USER}" # MinIO的访问密钥ID
def "MINIO_SECRET_KEY" "${PASSWORD}" # MinIO的密钥 def "MINIO_SECRET_KEY" "${PASSWORD}" # MinIO的密钥
def "MINIO_SESSION_TOKEN" # MinIO的会话令牌 def "MINIO_SESSION_TOKEN" # MinIO的会话令牌
readonly MINIO_SIGN_ENDPOINT=${MINIO_SIGN_ENDPOINT:-"http://${IP}:${MINIO_PORT}"} # signEndpoint为minio公网地址 # MinIO的会话令牌 readonly MINIO_SIGN_ENDPOINT=${MINIO_SIGN_ENDPOINT:-"http://${IP}:${MINIO_PORT}"} # signEndpoint为minio公网地址 # MinIO的会话令牌
def "COS_BUCKET_URL" "https://temp-1252357374.cos.ap-chengdu.myqcloud.com" # 腾讯云COS的存储桶URL # 腾讯云COS的存储桶URL
def "COS_SECRET_ID" # 腾讯云COS的密钥ID def "COS_BUCKET_URL" "https://temp-1252357374.cos.ap-chengdu.myqcloud.com"
def "COS_SECRET_KEY" # 腾讯云COS的密钥 def "COS_SECRET_ID" # 腾讯云COS的密钥ID
def "COS_SESSION_TOKEN" # 腾讯云COS的会话令牌 def "COS_SECRET_KEY" # 腾讯云COS的密钥
def "OSS_ENDPOINT" "https://oss-cn-chengdu.aliyuncs.com" # 阿里云OSS的端点URL def "COS_SESSION_TOKEN" # 腾讯云COS的会话令牌
def "OSS_BUCKET" "demo-9999999" # 阿里云OSS的存储桶名称 def "OSS_ENDPOINT" "https://oss-cn-chengdu.aliyuncs.com" # 阿里云OSS的端点URL
def "OSS_BUCKET_URL" "https://demo-9999999.oss-cn-chengdu.aliyuncs.com" # 阿里云OSS的存储桶URL def "OSS_BUCKET" "demo-9999999" # 阿里云OSS的存储桶名称
def "OSS_ACCESS_KEY_ID" # 阿里云OSS的访问密钥ID def "OSS_BUCKET_URL" "https://demo-9999999.oss-cn-chengdu.aliyuncs.com" # 阿里云OSS的存储桶URL
def "OSS_ACCESS_KEY_SECRET" # 阿里云OSS的密钥 def "OSS_ACCESS_KEY_ID" # 阿里云OSS的访问密钥ID
def "OSS_SESSION_TOKEN" # 阿里云OSS的会话令牌 def "OSS_ACCESS_KEY_SECRET" # 阿里云OSS的密钥
def "OSS_SESSION_TOKEN" # 阿里云OSS的会话令牌
###################### Redis 配置信息 ###################### ###################### Redis 配置信息 ######################
def "REDIS_PORT" "16379" # Redis的端口 def "REDIS_PORT" "16379" # Redis的端口
def "REDIS_ADDRESS" "127.0.0.1" # Redis的地址 def "REDIS_ADDRESS" "${DOCKER_BRIDGE_GATEWAY}" # Redis的地址
def "REDIS_USERNAME" # Redis的用户名 def "REDIS_USERNAME" # Redis的用户名
def "REDIS_PASSWORD" "${PASSWORD}" # Redis的密码 def "REDIS_PASSWORD" "${PASSWORD}" # Redis的密码
###################### Kafka 配置信息 ###################### ###################### Kafka 配置信息 ######################
def "KAFKA_USERNAME" # `Kafka` 的用户名 def "KAFKA_USERNAME" # `Kafka` 的用户名
def "KAFKA_PASSWORD" # `Kafka` 的密码 def "KAFKA_PASSWORD" # `Kafka` 的密码
def "KAFKA_PORT" "9092" # `Kafka` 的端口 def "KAFKA_PORT" "19094" # `Kafka` 的端口
def "KAFKA_ADDR" "127.0.0.1" # `Kafka` 的地址 def "KAFKA_ADDRESS" "${DOCKER_BRIDGE_GATEWAY}" # `Kafka` 的地址
def "KAFKA_LATESTMSG_REDIS_TOPIC" "latestMsgToRedis" # `Kafka` 的最新消息到Redis的主题 def "KAFKA_LATESTMSG_REDIS_TOPIC" "latestMsgToRedis" # `Kafka` 的最新消息到Redis的主题
def "KAFKA_OFFLINEMSG_MONGO_TOPIC" "offlineMsgToMongoMysql" # `Kafka` 的离线消息到Mongo的主题 def "KAFKA_OFFLINEMSG_MONGO_TOPIC" "offlineMsgToMongoMysql" # `Kafka` 的离线消息到Mongo的主题
def "KAFKA_MSG_PUSH_TOPIC" "msgToPush" # `Kafka` 的消息到推送的主题 def "KAFKA_MSG_PUSH_TOPIC" "msgToPush" # `Kafka` 的消息到推送的主题
@@ -153,14 +216,22 @@ def "KAFKA_CONSUMERGROUPID_MONGO" "mongo" # `Kafka` 的消费
def "KAFKA_CONSUMERGROUPID_MYSQL" "mysql" # `Kafka` 的消费组ID到MySql def "KAFKA_CONSUMERGROUPID_MYSQL" "mysql" # `Kafka` 的消费组ID到MySql
def "KAFKA_CONSUMERGROUPID_PUSH" "push" # `Kafka` 的消费组ID到推送 def "KAFKA_CONSUMERGROUPID_PUSH" "push" # `Kafka` 的消费组ID到推送
###################### RPC 配置信息 ###################### ###################### openim-web 配置信息 ######################
def "RPC_REGISTER_IP" # RPC的注册IP def "OPENIM_WEB_PORT" "11001" # openim-web的端口
def "RPC_LISTEN_IP" "0.0.0.0" # RPC的监听IP def "OPENIM_WEB_ADDRESS" "${DOCKER_BRIDGE_GATEWAY}" # openim-web的地址
def "OPENIM_WEB_DIST_PATH" "/app/dist" # openim-web的dist路径
###################### API 配置信息 ###################### ###################### RPC 配置信息 ######################
# API的开放端口, 只能设置一个端口 def "RPC_REGISTER_IP" # RPC的注册IP
readonly API_OPENIM_PORT=${API_OPENIM_PORT:-'10002'} def "RPC_LISTEN_IP" "0.0.0.0" # RPC的监听IP
def "API_LISTEN_IP" "0.0.0.0" # API的监听IP
###################### prometheus 配置 ######################
def "PROMETHEUS_PORT" "19090" # Prometheus的端口
def "PROMETHEUS_ADDRESS" "${DOCKER_BRIDGE_GATEWAY}" # Prometheus的地址
###################### Grafana 配置信息 ######################
def "GRAFANA_PORT" "3000" # Grafana的端口
def "GRAFANA_ADDRESS" "${DOCKER_BRIDGE_GATEWAY}" # Grafana的地址
###################### RPC Port Configuration Variables ###################### ###################### RPC Port Configuration Variables ######################
# For launching multiple programs, just fill in multiple ports separated by commas # For launching multiple programs, just fill in multiple ports separated by commas
@@ -207,8 +278,6 @@ def "LOG_IS_JSON" "false" # 日志是否为JSON格式
def "LOG_WITH_STACK" "false" # 日志是否带有堆栈信息 def "LOG_WITH_STACK" "false" # 日志是否带有堆栈信息
###################### Variables definition ###################### ###################### Variables definition ######################
# OpenIM WS端口
readonly OPENIM_WS_PORT=${OPENIM_WS_PORT:-'10001'}
def "WEBSOCKET_MAX_CONN_NUM" "100000" # Websocket最大连接数 def "WEBSOCKET_MAX_CONN_NUM" "100000" # Websocket最大连接数
def "WEBSOCKET_MAX_MSG_LEN" "4096" # Websocket最大消息长度 def "WEBSOCKET_MAX_MSG_LEN" "4096" # Websocket最大消息长度
def "WEBSOCKET_TIMEOUT" "10" # Websocket超时 def "WEBSOCKET_TIMEOUT" "10" # Websocket超时
+1 -1
View File
@@ -53,7 +53,7 @@ function openim::api::start()
done done
# start all api services # start all api services
for ((i = 0; i < ${#OPENIM_API_SERVICE_LISTARIES[*]}; i++)); do for ((i = 0; i < ${#OPENIM_API_SERVICE_LISTARIES[*]}; i++)); do
openim::util::stop_services_with_name ${OPENIM_API_SERVICE_LISTARIES[$i]} openim::util::stop_services_on_ports ${OPENIM_API_PORT_LISTARIES[$i]}
openim::log::info "OpenIM ${OPENIM_API_SERVICE_LISTARIES[$i]} config path: ${OPENIM_API_CONFIG}" openim::log::info "OpenIM ${OPENIM_API_SERVICE_LISTARIES[$i]} config path: ${OPENIM_API_CONFIG}"
# Get the service and Prometheus ports. # Get the service and Prometheus ports.
+2 -2
View File
@@ -38,7 +38,6 @@
# Note: Before executing this script, ensure that the necessary permissions are granted and relevant environmental variables are set. # Note: Before executing this script, ensure that the necessary permissions are granted and relevant environmental variables are set.
# #
set -o errexit set -o errexit
set +o nounset set +o nounset
set -o pipefail set -o pipefail
@@ -122,7 +121,8 @@ function openim::rpc::start() {
# start all rpc services # start all rpc services
for ((i = 0; i < ${#OPENIM_RPC_SERVICE_LISTARIES[*]}; i++)); do for ((i = 0; i < ${#OPENIM_RPC_SERVICE_LISTARIES[*]}; i++)); do
openim::util::stop_services_with_name ${OPENIM_RPC_SERVICE_LISTARIES[$i]} # openim::util::stop_services_with_name ${OPENIM_RPC_SERVICE_LISTARIES
openim::util::stop_services_on_ports ${OPENIM_RPC_PORT_LISTARIES[$i]}
openim::log::info "OpenIM ${OPENIM_RPC_SERVICE_LISTARIES[$i]} config path: ${OPENIM_RPC_CONFIG}" openim::log::info "OpenIM ${OPENIM_RPC_SERVICE_LISTARIES[$i]} config path: ${OPENIM_RPC_CONFIG}"
# Get the service and Prometheus ports. # Get the service and Prometheus ports.
+7 -2
View File
@@ -268,7 +268,7 @@ openim::util::check_ports() {
# Iterate over each given port. # Iterate over each given port.
for port in "$@"; do for port in "$@"; do
# Use the `ss` command to find process information related to the given port. # Use the `ss` command to find process information related to the given port.
local info=$(ss -ltnp | grep -w ":$port" || true) local info=$(ss -ltnp | grep ":$port" || true)
# If there's no process information, it means the process associated with the port is not running. # If there's no process information, it means the process associated with the port is not running.
if [[ -z $info ]]; then if [[ -z $info ]]; then
@@ -281,7 +281,12 @@ openim::util::check_ports() {
local fd=$(echo $details | awk '{print $3}') local fd=$(echo $details | awk '{print $3}')
# Get the start time of the process using the PID # Get the start time of the process using the PID
local start_time=$(ps -p $pid -o lstart=) if [[ -z $pid ]]; then
local start_time="N/A"
else
# Get the start time of the process using the PID
local start_time=$(ps -p $pid -o lstart=)
fi
started+=("Port $port - Command: $command, PID: $pid, FD: $fd, Started: $start_time") started+=("Port $port - Command: $command, PID: $pid, FD: $fd, Started: $start_time")
fi fi
-2
View File
@@ -6,8 +6,6 @@ github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46t
github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY= github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/marmotedu/iam v1.7.0 h1:9aWg5Enx+npHU9kxQ0eYsdXvbiGeUsuuzxaV49BQa0I=
github.com/marmotedu/iam v1.7.0/go.mod h1:kjQ1Tzr+M6/B49DSC3Zky+2Ai9vAr6PbhuHV8mWUS48=
github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0= github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0=
github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0= github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0=
github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0=