fix: update config file

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

@ -84,12 +84,6 @@ jobs:
echo "Generate all necessary files successfully" echo "Generate all necessary files successfully"
continue-on-error: true 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 - name: Build source code for host platform
run: | run: |
sudo make build sudo make build

@ -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. ✅ 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
```
![https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/images/docker_build.png](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/images/docker_build.png)
</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
![Successful Compilation](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/images/build.png)
</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 ## :link: Relationship Between APP and OpenIM

@ -14,7 +14,7 @@
# ----------------------------------------------------------------- # -----------------------------------------------------------------
# TODO: This config file is the template file # 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 # --| env: scripts/install/environment.sh
# --| target: config/config.yaml # --| target: config/config.yaml
# ----------------------------------------------------------------- # -----------------------------------------------------------------

@ -14,7 +14,7 @@
# ----------------------------------------------------------------- # -----------------------------------------------------------------
# This config file is the template file # 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 # --| env: scripts/install/environment.sh
# --| target: config/config.yaml # --| target: config/config.yaml
# ----------------------------------------------------------------- # -----------------------------------------------------------------

@ -14,8 +14,8 @@
# ----------------------------------------------------------------- # -----------------------------------------------------------------
# TODO: This config file is the template file # TODO: This config file is the template file
# --| source: scripts/template/config-tmpl/openim_config.yaml # --| source: deployments/templates/openim.yaml
# --| env: scripts/install/environment.sh # --| env: scripts/install/environment
# --| target: config/config.yaml # --| target: config/config.yaml
# ----------------------------------------------------------------- # -----------------------------------------------------------------

@ -98,86 +98,91 @@ services:
restart: always restart: always
command: minio server /data --console-address ':9090' command: minio server /data --console-address ':9090'
# openim-server: openim-server:
# # image: ghcr.io/openimsdk/openim-server:latest # image: ghcr.io/openimsdk/openim-server:latest
# image: registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-server:v3.2.1-beta.4 image: registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-server:latest
# # image: openim/openim-server:latest # image: openim/openim-server:latest
# # build: . # build: .
# container_name: openim-server container_name: openim-server
# volumes: healthcheck:
# - ./logs:/openim/openim-server/logs test: ["CMD-SHELL", "./scripts/check_all.sh"]
# - ./config:/openim/openim-server/config interval: 30s
# - ./scripts:/openim/openim-server/scripts timeout: 10s
# restart: always retries: 5
# depends_on: volumes:
# - zookeeper - ${DATA_DIR}/_output/openim/logs:/openim/openim-server/logs
# - kafka - ${DATA_DIR}/config:/openim/openim-server/config
# - mysql - ${DATA_DIR}/scripts:/openim/openim-server/scripts
# - mongodb restart: always
# - redis depends_on:
# - minio - zookeeper
# network_mode: "host" - kafka
# logging: - mysql
# driver: json-file - mongodb
# options: - redis
# max-size: "1g" - minio
# max-file: "2" network_mode: "host"
logging:
driver: json-file
options:
max-size: "1g"
max-file: "2"
# openim-chat: openim-chat:
# # image: ghcr.io/openimsdk/openim-chat:latest # image: ghcr.io/openimsdk/openim-chat:latest
# image: registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-chat:latest image: registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-chat:latest
# # image: openim/openim-chat:latest # image: openim/openim-chat:latest
# container_name: openim-chat container_name: openim-chat
# healthcheck: healthcheck:
# test: ["CMD-SHELL", "./scripts/check_all.sh"] test: ["CMD-SHELL", "./scripts/check_all.sh"]
# interval: 30s interval: 30s
# timeout: 10s timeout: 10s
# retries: 5 retries: 5
# volumes: volumes:
# - ${DATA_DIR}/_output/openim/openim-chat/logs:/openim/openim-chat/logs - ${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/config:/openim/openim-chat/config
# - ${DATA_DIR}/_output/openim/openim-chat/scripts:/openim/openim-chat/scripts - ${DATA_DIR}/_output/openim/openim-chat/scripts:/openim/openim-chat/scripts
# restart: always restart: always
# user: root:root user: root:root
# depends_on: depends_on:
# - mysql - mysql
# - mongodb - mongodb
# - redis - redis
# - minio - minio
# - openim-server - openim-server
# network_mode: "host" 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"
# prometheus: prometheus:
# image: prom/prometheus image: prom/prometheus
# volumes: volumes:
# - ./.docker-compose_cfg/prometheus-compose.yml:/etc/prometheus/prometheus.yml - ./.docker-compose_cfg/prometheus-compose.yml:/etc/prometheus/prometheus.yml
# container_name: prometheus container_name: prometheus
# # ports: # ports:
# # - 9091:9091 # - 9091:9091
# depends_on: depends_on:
# - openim-server - openim-server
# command: --web.listen-address=:9091 --config.file="/etc/prometheus/prometheus.yml" command: --web.listen-address=:9091 --config.file="/etc/prometheus/prometheus.yml"
# network_mode: "host" network_mode: "host"
# grafana: grafana:
# image: grafana/grafana image: grafana/grafana
# volumes: volumes:
# - ./.docker-compose_cfg/datasource-compose.yaml:/etc/grafana/provisioning/datasources/datasource.yaml - ./.docker-compose_cfg/datasource-compose.yaml:/etc/grafana/provisioning/datasources/datasource.yaml
# - ./.docker-compose_cfg/grafana.ini:/etc/grafana/grafana.ini - ./.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 - ./.docker-compose_cfg/node-exporter-full_rev1.json:/var/lib/grafana/dashboards/node-exporter-full_rev1.json
# container_name: grafana container_name: grafana
# depends_on: depends_on:
# - prometheus - prometheus
# network_mode: "host" network_mode: "host"
# node-exporter: node-exporter:
# image: quay.io/prometheus/node-exporter image: quay.io/prometheus/node-exporter
# container_name: node-exporter container_name: node-exporter
# restart: always restart: always
# ports: ports:
# - "9100:9100" - "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. # Defines an associative array where the keys are the template files and the values are the corresponding output files.
declare -A TEMPLATES=( declare -A TEMPLATES=(
["${OPENIM_ROOT}/scripts/template/config-tmpl/env.template"]="${OPENIM_OUTPUT_SUBPATH}/bin/.env" ["${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" openim::util::run "make advertise"
clear 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::desc "You can learn a lot about automation using make help"
openim::util::run "make help" openim::util::run "make help"
clear clear

@ -14,7 +14,7 @@
# limitations under the License. # limitations under the License.
# 本脚本功能:根据 scripts/environment.sh 配置,生成 OPENIM 组件 YAML 配置文件。 # 本脚本功能:根据 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 # Read: https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/contrib/init_config.md
env_file="$1" 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.) # 定义关联数组,其中键是模板文件,值是对应的输出文件 (en: Defines an associative array where the keys are the template files and the values are the corresponding output files.)
declare -A TEMPLATES=( declare -A TEMPLATES=(
["${OPENIM_ROOT}/deployments/templates/env_template.yaml"]="${OPENIM_ROOT}/.env" ["${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 for template in "${!TEMPLATES[@]}"; do

Loading…
Cancel
Save