mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-10-26 21:22:16 +08:00
fix: update config file
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
This commit is contained in:
parent
2bc8390e9f
commit
d5996217a2
6
.github/workflows/openimci.yml
vendored
6
.github/workflows/openimci.yml
vendored
@ -84,12 +84,6 @@ jobs:
|
||||
echo "Generate all necessary files successfully"
|
||||
continue-on-error: true
|
||||
|
||||
- name: Run unit test and get test coverage
|
||||
run: |
|
||||
make cover
|
||||
echo "Run unit test and get test coverage successfully"
|
||||
continue-on-error: true
|
||||
|
||||
- name: Build source code for host platform
|
||||
run: |
|
||||
sudo make build
|
||||
|
||||
192
README.md
192
README.md
@ -109,199 +109,7 @@ Further enhancing your experience, we also provide an SDK client, wherein most c
|
||||
|
||||
✅ We have a large open source community called [OpenIMSDK](https://github.com/OpenIMSDK) that runs the core modules, we have an open source community called [openim-sigs](https://github.com/openim-sigs) to explore more IM-based infrastructure products.
|
||||
|
||||
## :rocket: Quick Start
|
||||
|
||||
<details> <summary>Deploying with Docker Compose</summary>
|
||||
|
||||
1. Clone the project
|
||||
|
||||
```bash
|
||||
# choose what you need
|
||||
BRANCH=release-v3.1
|
||||
git clone -b $BRANCH https://github.com/OpenIMSDK/Open-IM-Server openim && export openim=$(pwd)/openim && cd $openim && make build
|
||||
```
|
||||
|
||||
> **Note**
|
||||
> Read our release policy: https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/version.md
|
||||
|
||||
2. Modify `.env`
|
||||
|
||||
```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**
|
||||
> This command can only be executed once. It will modify the component passwords in docker-compose based on the `PASSWORD` variable in `.env`, and modify the component passwords in `config/config.yaml`. If the password in `.env` changes, you need to first execute `docker-compose down`; `rm components -rf` and then execute this command.
|
||||
|
||||
```bash
|
||||
make install
|
||||
```
|
||||
|
||||
4. Check the service
|
||||
|
||||
```bash
|
||||
make check
|
||||
```
|
||||
|
||||

|
||||
|
||||
</details>
|
||||
|
||||
<details> <summary>Compile from Source</summary>
|
||||
|
||||
Ur need `Go 1.18` or higher version, and `make`.
|
||||
|
||||
Version Details: https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/version.md
|
||||
|
||||
```bash
|
||||
# choose what you need
|
||||
BRANCH=release-v3.1
|
||||
git clone -b $BRANCH https://github.com/OpenIMSDK/Open-IM-Server openim && export openim=$(pwd)/openim && cd $openim && make build
|
||||
```
|
||||
|
||||
Read about the [OpenIM Version Policy](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/version.md)
|
||||
|
||||
`make help` to help you see the instructions supported by OpenIM.
|
||||
|
||||
All services have been successfully built as shown in the figure
|
||||
|
||||

|
||||
|
||||
</details>
|
||||
|
||||
<details> <summary>Component Configuration Instructions</summary>
|
||||
|
||||
The config/config.yaml file has detailed configuration instructions for the storage components.
|
||||
|
||||
- Zookeeper
|
||||
|
||||
- Used for RPC service discovery and registration, cluster support.
|
||||
|
||||
```bash
|
||||
zookeeper:
|
||||
schema: openim #Not recommended to modify
|
||||
address: [ 127.0.0.1:2181 ] #address
|
||||
username: #username
|
||||
password: #password
|
||||
```
|
||||
|
||||
- MySQL
|
||||
|
||||
- Used for storing users, relationships, and groups, supports master-slave database.
|
||||
|
||||
```bash
|
||||
mysql:
|
||||
address: [ 127.0.0.1:13306 ] #address
|
||||
username: root #username
|
||||
password: openIM123 #password
|
||||
database: openIM_v2 #Not recommended to modify
|
||||
maxOpenConn: 1000 #maximum connection
|
||||
maxIdleConn: 100 #maximum idle connection
|
||||
maxLifeTime: 60 #maximum time a connection can be reused (seconds)
|
||||
logLevel: 4 #log level 1=slient 2=error 3=warn 4=info
|
||||
slowThreshold: 500 #slow statement threshold (milliseconds)
|
||||
```
|
||||
|
||||
- Mongo
|
||||
|
||||
- Used for storing offline messages, supports mongo sharded clusters.
|
||||
|
||||
```bash
|
||||
mongo:
|
||||
uri: #Use this value directly if not empty
|
||||
address: [ 127.0.0.1:37017 ] #address
|
||||
database: openIM #default mongo db
|
||||
username: root #username
|
||||
password: openIM123 #password
|
||||
maxPoolSize: 100 #maximum connections
|
||||
```
|
||||
|
||||
- Redis
|
||||
|
||||
- Used for storing message sequence numbers, latest messages, user tokens, and mysql cache, supports cluster deployment.
|
||||
|
||||
```bash
|
||||
redis:
|
||||
address: [ 127.0.0.1:16379 ] #address
|
||||
username: #username
|
||||
password: openIM123 #password
|
||||
```
|
||||
|
||||
- Kafka
|
||||
|
||||
- Used for message queues, for message decoupling, supports cluster deployment.
|
||||
|
||||
```bash
|
||||
kafka:
|
||||
username: #username
|
||||
password: #password
|
||||
addr: [ 127.0.0.1:9092 ] #address
|
||||
latestMsgToRedis:
|
||||
topic: "latestMsgToRedis"
|
||||
offlineMsgToMongo:
|
||||
topic: "offlineMsgToMongoMysql"
|
||||
msgToPush:
|
||||
topic: "msqToPush"
|
||||
msgToModify:
|
||||
topic: "msgToModify"
|
||||
consumerGroupID:
|
||||
msgToRedis: redis
|
||||
msgToMongo: mongo
|
||||
msgToMySql: mysql
|
||||
msgToPush: push
|
||||
msgToModify: modify
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details> <summary>Start and Stop Services</summary>
|
||||
|
||||
Start services
|
||||
|
||||
```
|
||||
./scripts/start-all.sh;
|
||||
```
|
||||
|
||||
Check services
|
||||
|
||||
```
|
||||
./scripts/check_all.sh
|
||||
```
|
||||
|
||||
Stop services
|
||||
|
||||
```
|
||||
./scripts/stop-all.sh
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details> <summary>Open IM Ports</summary>
|
||||
|
||||
| TCP Port | Description | Operation |
|
||||
| --------- | ------------------------------------------------------------ | ----------------------------------------------------- |
|
||||
| TCP:10001 | ws protocol, message port such as message sending, pushing etc, used for client SDK | Port release or nginx reverse proxy, and firewall off |
|
||||
| TCP:10002 | api port, such as user, friend, group, message interfaces. | Port release or nginx reverse proxy, and firewall off |
|
||||
| TCP:10005 | Required when choosing minio storage (openIM uses minio storage by default) | Port release or nginx reverse proxy, and firewall off |
|
||||
|
||||
</details>
|
||||
|
||||
<details> <summary>Open Chat Ports</summary>
|
||||
|
||||
+ chat warehouse: https://github.com/OpenIMSDK/chat
|
||||
|
||||
| TCP Port | Description | Operation |
|
||||
| --------- | --------------------------------------------------- | ----------------------------------------------------- |
|
||||
| TCP:10008 | Business system, such as registration, login etc | Port release or nginx reverse proxy, and firewall off |
|
||||
| TCP:10009 | Management backend, such as statistics, banning etc | Port release or nginx reverse proxy, and firewall off |
|
||||
|
||||
</details>
|
||||
|
||||
## :link: Relationship Between APP and OpenIM
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# TODO: This config file is the template file
|
||||
# --| source: scripts/template/config-tmpl/openim_config.yaml
|
||||
# --| source: scripts/template/config-tmpl/config.yaml
|
||||
# --| env: scripts/install/environment.sh
|
||||
# --| target: config/config.yaml
|
||||
# -----------------------------------------------------------------
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# This config file is the template file
|
||||
# --| source: scripts/template/config-tmpl/openim_config.yaml
|
||||
# --| source: scripts/template/config-tmpl/config.yaml
|
||||
# --| env: scripts/install/environment.sh
|
||||
# --| target: config/config.yaml
|
||||
# -----------------------------------------------------------------
|
||||
|
||||
@ -14,8 +14,8 @@
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# TODO: This config file is the template file
|
||||
# --| source: scripts/template/config-tmpl/openim_config.yaml
|
||||
# --| env: scripts/install/environment.sh
|
||||
# --| source: deployments/templates/openim.yaml
|
||||
# --| env: scripts/install/environment
|
||||
# --| target: config/config.yaml
|
||||
# -----------------------------------------------------------------
|
||||
|
||||
|
||||
@ -98,86 +98,91 @@ services:
|
||||
restart: always
|
||||
command: minio server /data --console-address ':9090'
|
||||
|
||||
# openim-server:
|
||||
# # image: ghcr.io/openimsdk/openim-server:latest
|
||||
# image: registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-server:v3.2.1-beta.4
|
||||
# # image: openim/openim-server:latest
|
||||
# # build: .
|
||||
# container_name: openim-server
|
||||
# volumes:
|
||||
# - ./logs:/openim/openim-server/logs
|
||||
# - ./config:/openim/openim-server/config
|
||||
# - ./scripts:/openim/openim-server/scripts
|
||||
# restart: always
|
||||
# depends_on:
|
||||
# - zookeeper
|
||||
# - kafka
|
||||
# - mysql
|
||||
# - mongodb
|
||||
# - redis
|
||||
# - minio
|
||||
# network_mode: "host"
|
||||
# logging:
|
||||
# driver: json-file
|
||||
# options:
|
||||
# max-size: "1g"
|
||||
# max-file: "2"
|
||||
openim-server:
|
||||
# image: ghcr.io/openimsdk/openim-server:latest
|
||||
image: registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-server:latest
|
||||
# image: openim/openim-server:latest
|
||||
# build: .
|
||||
container_name: openim-server
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "./scripts/check_all.sh"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 5
|
||||
volumes:
|
||||
- ${DATA_DIR}/_output/openim/logs:/openim/openim-server/logs
|
||||
- ${DATA_DIR}/config:/openim/openim-server/config
|
||||
- ${DATA_DIR}/scripts:/openim/openim-server/scripts
|
||||
restart: always
|
||||
depends_on:
|
||||
- zookeeper
|
||||
- kafka
|
||||
- mysql
|
||||
- mongodb
|
||||
- redis
|
||||
- minio
|
||||
network_mode: "host"
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: "1g"
|
||||
max-file: "2"
|
||||
|
||||
# openim-chat:
|
||||
# # image: ghcr.io/openimsdk/openim-chat:latest
|
||||
# image: registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-chat:latest
|
||||
# # image: openim/openim-chat:latest
|
||||
# container_name: openim-chat
|
||||
# healthcheck:
|
||||
# test: ["CMD-SHELL", "./scripts/check_all.sh"]
|
||||
# interval: 30s
|
||||
# timeout: 10s
|
||||
# retries: 5
|
||||
# volumes:
|
||||
# - ${DATA_DIR}/_output/openim/openim-chat/logs:/openim/openim-chat/logs
|
||||
# - ${DATA_DIR}/_output/openim/openim-chat/config:/openim/openim-chat/config
|
||||
# - ${DATA_DIR}/_output/openim/openim-chat/scripts:/openim/openim-chat/scripts
|
||||
# restart: always
|
||||
# user: root:root
|
||||
# depends_on:
|
||||
# - mysql
|
||||
# - mongodb
|
||||
# - redis
|
||||
# - minio
|
||||
# - openim-server
|
||||
# network_mode: "host"
|
||||
# logging:
|
||||
# driver: json-file
|
||||
# options:
|
||||
# max-size: "1g"
|
||||
# max-file: "2"
|
||||
openim-chat:
|
||||
# image: ghcr.io/openimsdk/openim-chat:latest
|
||||
image: registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-chat:latest
|
||||
# image: openim/openim-chat:latest
|
||||
container_name: openim-chat
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "./scripts/check_all.sh"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 5
|
||||
volumes:
|
||||
- ${DATA_DIR}/_output/openim/openim-chat/logs:/openim/openim-chat/logs
|
||||
- ${DATA_DIR}/_output/openim/openim-chat/config:/openim/openim-chat/config
|
||||
- ${DATA_DIR}/_output/openim/openim-chat/scripts:/openim/openim-chat/scripts
|
||||
restart: always
|
||||
user: root:root
|
||||
depends_on:
|
||||
- mysql
|
||||
- mongodb
|
||||
- redis
|
||||
- minio
|
||||
- openim-server
|
||||
network_mode: "host"
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: "1g"
|
||||
max-file: "2"
|
||||
|
||||
# prometheus:
|
||||
# image: prom/prometheus
|
||||
# volumes:
|
||||
# - ./.docker-compose_cfg/prometheus-compose.yml:/etc/prometheus/prometheus.yml
|
||||
# container_name: prometheus
|
||||
# # ports:
|
||||
# # - 9091:9091
|
||||
# depends_on:
|
||||
# - openim-server
|
||||
# command: --web.listen-address=:9091 --config.file="/etc/prometheus/prometheus.yml"
|
||||
# network_mode: "host"
|
||||
|
||||
# grafana:
|
||||
# image: grafana/grafana
|
||||
# volumes:
|
||||
# - ./.docker-compose_cfg/datasource-compose.yaml:/etc/grafana/provisioning/datasources/datasource.yaml
|
||||
# - ./.docker-compose_cfg/grafana.ini:/etc/grafana/grafana.ini
|
||||
# - ./.docker-compose_cfg/node-exporter-full_rev1.json:/var/lib/grafana/dashboards/node-exporter-full_rev1.json
|
||||
# container_name: grafana
|
||||
# depends_on:
|
||||
# - prometheus
|
||||
# network_mode: "host"
|
||||
|
||||
# node-exporter:
|
||||
# image: quay.io/prometheus/node-exporter
|
||||
# container_name: node-exporter
|
||||
# restart: always
|
||||
prometheus:
|
||||
image: prom/prometheus
|
||||
volumes:
|
||||
- ./.docker-compose_cfg/prometheus-compose.yml:/etc/prometheus/prometheus.yml
|
||||
container_name: prometheus
|
||||
# ports:
|
||||
# - "9100:9100"
|
||||
# - 9091:9091
|
||||
depends_on:
|
||||
- openim-server
|
||||
command: --web.listen-address=:9091 --config.file="/etc/prometheus/prometheus.yml"
|
||||
network_mode: "host"
|
||||
|
||||
grafana:
|
||||
image: grafana/grafana
|
||||
volumes:
|
||||
- ./.docker-compose_cfg/datasource-compose.yaml:/etc/grafana/provisioning/datasources/datasource.yaml
|
||||
- ./.docker-compose_cfg/grafana.ini:/etc/grafana/grafana.ini
|
||||
- ./.docker-compose_cfg/node-exporter-full_rev1.json:/var/lib/grafana/dashboards/node-exporter-full_rev1.json
|
||||
container_name: grafana
|
||||
depends_on:
|
||||
- prometheus
|
||||
network_mode: "host"
|
||||
|
||||
node-exporter:
|
||||
image: quay.io/prometheus/node-exporter
|
||||
container_name: node-exporter
|
||||
restart: always
|
||||
ports:
|
||||
- "9100:9100"
|
||||
|
||||
@ -24,7 +24,7 @@ In the `scripts/init_config.sh` file, we defined some template files. These temp
|
||||
# Defines an associative array where the keys are the template files and the values are the corresponding output files.
|
||||
declare -A TEMPLATES=(
|
||||
["${OPENIM_ROOT}/scripts/template/config-tmpl/env.template"]="${OPENIM_OUTPUT_SUBPATH}/bin/.env"
|
||||
["${OPENIM_ROOT}/scripts/template/config-tmpl/openim_config.yaml"]="${OPENIM_OUTPUT_SUBPATH}/bin/openim_config.yaml"
|
||||
["${OPENIM_ROOT}/scripts/template/config-tmpl/config.yaml"]="${OPENIM_OUTPUT_SUBPATH}/bin/config.yaml"
|
||||
)
|
||||
```
|
||||
|
||||
|
||||
@ -24,6 +24,13 @@ openim::util::desc "========> Press Enter to continue...."
|
||||
openim::util::run "make advertise"
|
||||
clear
|
||||
|
||||
openim::util::desc "========> Initialize the project and generate configuration files"
|
||||
openim::util::run "make init"
|
||||
|
||||
openim::util::desc "========> You can look git diff"
|
||||
openim::util::run "git diff"
|
||||
clear
|
||||
|
||||
openim::util::desc "You can learn a lot about automation using make help"
|
||||
openim::util::run "make help"
|
||||
clear
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
# 本脚本功能:根据 scripts/environment.sh 配置,生成 OPENIM 组件 YAML 配置文件。
|
||||
# 示例:./scripts/genconfig.sh scripts/install/environment.sh scripts/template/openim_config.yaml
|
||||
# 示例:./scripts/genconfig.sh scripts/install/environment.sh scripts/template/config.yaml
|
||||
# Read: https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/contrib/init_config.md
|
||||
|
||||
env_file="$1"
|
||||
|
||||
@ -30,7 +30,7 @@ readonly ENV_FILE=${ENV_FILE:-${OPENIM_ROOT}/scripts/install/environment.sh}
|
||||
# 定义关联数组,其中键是模板文件,值是对应的输出文件 (en: Defines an associative array where the keys are the template files and the values are the corresponding output files.)
|
||||
declare -A TEMPLATES=(
|
||||
["${OPENIM_ROOT}/deployments/templates/env_template.yaml"]="${OPENIM_ROOT}/.env"
|
||||
["${OPENIM_ROOT}/deployments/templates/openim.yaml"]="${OPENIM_ROOT}/config/openim_config.yaml"
|
||||
["${OPENIM_ROOT}/deployments/templates/openim.yaml"]="${OPENIM_ROOT}/config/config.yaml"
|
||||
)
|
||||
|
||||
for template in "${!TEMPLATES[@]}"; do
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user