复制项目

This commit is contained in:
kim.dev.6789
2026-01-14 22:35:45 +08:00
parent 305d526110
commit b7f8db7d08
297 changed files with 81784 additions and 0 deletions

44
config/README.md Normal file
View File

@@ -0,0 +1,44 @@
# OpenIM Chat Configuration Files and Common Configuration Item Modifications Guide
## Configuration Files Explanation
| Configuration File | Description |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| **redis.yml** | Configurations for Redis password, address, etc. |
| **mongodb.yml** | Configurations for MongoDB username, password, address, etc. |
| **share.yml** | Common configurations needed by various OpenIM services, such as secret. |
| **discovery.yml** | Service discovery account, password, service name and other configurations. |
| **chat-api-chat.yml** | Configurations for listening IP, port, etc., in chat-api-chat service. |
| **chat-api-admin.yml** | Configurations for listening IP, port, etc., in chat-api-admin service. |
| **chat-rpc-chat.yml** | Configurations for listening IP, port, login registration verification code, registration allowance, and livekit in chat-rpc-chat service. |
| **chat-rpc-admin.yml** | Configurations for listening IP, port, chat backend token expiration policy, and chat backend Secret in chat-rpc-admin service. |
## Common Configuration Item Modifications
| Configuration Item to Modify | Configuration File |
| ----------------------------------------- | -------------------- |
| Modify OpenIM secret | `share.yml` |
| Production environment logs | `log.yml` |
| Modify chat Admin username and password | `share.yml` |
| Modify verification code | `chat-rpc-chat.yml` |
| Allow user registration | `chat-rpc-chat.yml` |
| Modify chat Admin token expiration policy | `chat-rpc-admin.yml` |
| Modify chat Admin Secret | `chat-rpc-admin.yml` |
## Starting Multiple Instances of an OpenIM Service
To launch multiple instances of an OpenIM service, you just need to increase the corresponding number of ports and modify the `start-config.yml` file in the project's root directory, then restart the service for the changes to take effect. For example, the configuration for launching 2 instances of `chat-rpc` is as follows:
```yaml
rpc:
registerIP: ""
listenIP: 0.0.0.0
ports: [30300, 30301]
```
Modify `start-config.yml`:
```yaml
serviceBinaries:
chat-rpc: 2
```

45
config/README_zh_CN.md Normal file
View File

@@ -0,0 +1,45 @@
# OpenIM Chat 配置文件说明以及常用配置修改说明
## 配置文件说明
| Configuration File | Description |
| ---------------------- | ----------------------------------------------------------------------------------------- |
| **redis.yml** | Redis 密码、地址等配置 |
| **mongodb.yml** | MongoDB 用户名、密码、地址等配置 |
| **log.yml** | 日志级别及存储目录等配置 |
| **share.yml** | OpenIM 各服务所需的公共配置,如 secret、Admin 后台密码等 |
| **discovery.yml** | 服务发现对应的账号密码和服务名等配置 |
| **chat-api-chat.yml** | chat-api-chat 服务的监听 IP、端口等配置 |
| **chat-api-admin.yml** | chat-api-admin 服务的监听 IP、端口等配置 |
| **chat-rpc-chat.yml** | chat-rpc-chat.yml 服务的监听 IP、端口以及登录注册验证码、是否允许注册和 livekit 等配置 |
| **chat-rpc-admin.yml** | chat-rpc-admin 服务的监听 IP、端口以及 chat 后台 token 过期策略和 chat 后台 Secret 等配置 |
## 常用配置修改
| 修改配置项 | 配置文件 |
| ----------------------------- | -------------------- |
| 修改 OpenIM secret | `share.yml` |
| 生产环境日志调整 | `log.yml` |
| 修改 chat Admin | `share.yml` |
| 修改验证码相关配置 | `chat-rpc-chat.yml` |
| 允许用户注册 | `chat-rpc-chat.yml` |
| 修改 chat 后台 token 过期策略 | `chat-rpc-admin.yml` |
| 修改 chat 后台 Secret | `chat-rpc-admin.yml` |
## 启动某个 OpenIM 服务的多个实例
若要启动某个 OpenIM 的多个实例,只需增加对应的端口数,并修改项目根目录下的`start-config.yml`文件,重启服务即可生效。例如,启动 2 个`chat-rpc`实例的配置如下:
```yaml
rpc:
registerIP: ""
listenIP: 0.0.0.0
ports: [30300, 30301]
```
Modify start-config.yml:
```yaml
serviceBinaries:
chat-rpc: 2
```

View File

@@ -0,0 +1,6 @@
api:
# Listening IP; 0.0.0.0 means both internal and external IPs are listened to, default is recommended
listenIP: 0.0.0.0
# Listening ports; if multiple are configured, multiple instances will be launched
ports: [ 10009 ]

6
config/chat-api-bot.yml Normal file
View File

@@ -0,0 +1,6 @@
api:
# Listening IP; 0.0.0.0 means both internal and external IPs are listened to, default is recommended
listenIP: 0.0.0.0
# Listening ports; if multiple are configured, multiple instances will be launched
ports: [ 10010 ]

6
config/chat-api-chat.yml Normal file
View File

@@ -0,0 +1,6 @@
api:
# Listening IP; 0.0.0.0 means both internal and external IPs are listened to, default is recommended
listenIP: 0.0.0.0
# Listening ports; if multiple are configured, multiple instances will be launched
ports: [ 10008 ]

12
config/chat-rpc-admin.yml Normal file
View File

@@ -0,0 +1,12 @@
rpc:
# The IP address where this RPC service registers itself; if left blank, it defaults to the internal network IP
registerIP: ''
# IP address that the RPC service listens on; setting to 0.0.0.0 listens on both internal and external IPs. If left blank, it automatically uses the internal network IP
listenIP: 0.0.0.0
# List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances.
ports: [ 30200 ]
tokenPolicy:
expire: 90
secret: chat123

10
config/chat-rpc-bot.yml Normal file
View File

@@ -0,0 +1,10 @@
rpc:
# The IP address where this RPC service registers itself; if left blank, it defaults to the internal network IP
registerIP: ''
# IP address that the RPC service listens on; setting to 0.0.0.0 listens on both internal and external IPs. If left blank, it automatically uses the internal network IP
listenIP: 0.0.0.0
# List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances.
ports: [ 30400 ]
# Model request timeout. Unit: s
timeout: 20

44
config/chat-rpc-chat.yml Normal file
View File

@@ -0,0 +1,44 @@
rpc:
# The IP address where this RPC service registers itself; if left blank, it defaults to the internal network IP
registerIP: ''
# IP address that the RPC service listens on; setting to 0.0.0.0 listens on both internal and external IPs. If left blank, it automatically uses the internal network IP
listenIP: 0.0.0.0
# List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances.
ports: [ 30300 ]
verifyCode:
validTime: 300
validCount: 5
uintTime: 86400
maxCount: 10
superCode: "666666"
len: 6
phone:
use: "superCode" # superCode: user superCode; ali: use ali verify code; bao: use bao verify code;
ali:
endpoint: ""
accessKeyId: ""
accessKeySecret: ""
signName: ""
verificationCodeTemplateCode: ""
bao:
endpoint: "http://127.0.0.1:18080"
accessKeyId: "local"
accessKeySecret: "local"
signName: "local"
verificationCodeTemplateCode: ""
mail:
use: "superCode" # superCode: user superCode; mail: use mail verify code;
title: ""
senderMail: ""
senderAuthorizationCode: ""
smtpAddr: ""
smtpPort:
liveKit:
url: "ws://127.0.0.1:7880" # LIVEKIT_URL, LiveKit server address and port
key: "devkey"
secret: "devsecret"
allowRegister: true
allowVerifyCodeLogin: false # 是否允许验证码登录设置为false则隐藏验证码登录功能

14
config/discovery.yml Normal file
View File

@@ -0,0 +1,14 @@
enable: "etcd"
etcd:
rootDirectory: openim
address: [ localhost:12379 ]
username: ''
password: ''
kubernetes:
namespace: default
rpcService:
chat: chat-rpc-service
admin: admin-rpc-service
bot: bot-rpc-service

14
config/log.yml Normal file
View File

@@ -0,0 +1,14 @@
# Log storage path, default is acceptable, change to a full path if modification is needed
storageLocation: ../../../../logs/
# Log rotation period (in hours), default is acceptable
rotationTime: 24
# Number of log files to retain, default is acceptable
remainRotationCount: 2
# Log level settings: 3 for production environment; 6 for more verbose logging in debugging environments
remainLogLevel: 6
# Whether to output to standard output, default is acceptable
isStdout: true
# Whether to log in JSON format, default is acceptable
isJson: false
# output simplify log when KeyAndValues's value len is bigger than 50 in rpc method log
isSimplify: true

16
config/mongodb.yml Normal file
View File

@@ -0,0 +1,16 @@
# URI for database connection, leave empty if using address and credential settings directly
uri: ""
# List of MongoDB server addresses
address: [localhost:37017]
# Name of the database
database: openim_v3
# Username for database authentication
username: openIM
# Password for database authentication
password: openIM123
# Authentication source for database authentication, if use root user, set it to admin
authSource: openim_v3
# Maximum number of connections in the connection pool
maxPoolSize: 100
# Maximum number of retry attempts for a failed database connection
maxRetry: 10

14
config/redis.yml Normal file
View File

@@ -0,0 +1,14 @@
# List of Redis server addresses
address: [ localhost:16379 ]
# Username for Redis authentication (leave blank if not used)
username: ''
# Password for Redis authentication
password: openIM123
# Enable or disable pipeline processing
enablePipeline: false
# Enable or disable cluster mode
clusterMode: false
# Database index to be used
db: 0
# Maximum number of retry attempts for a failed connection
maxRetry: 10

13
config/share.yml Normal file
View File

@@ -0,0 +1,13 @@
openIM:
# OpenIM API address
apiURL: http://127.0.0.1:10002
# OpenIM secret key, must be consistent with OpenIM
secret: openIM123
# OpenIM administrator userID, must be consistent with OpenIM
adminUserID: imAdmin
# Refresh OpenIM token interval
tokenRefreshInterval: 120 # unit: minute
chatAdmin:
# Default username and password for the admin
- "chatAdmin"