提交 bfc28cab 编写于 作者: programor_guo's avatar programor_guo

Merge remote-tracking branch 'origin/main'

...@@ -37,15 +37,15 @@ business data. ...@@ -37,15 +37,15 @@ business data.
* Join the Telegram-OpenIM group: https://t.me/joinchat/zSJLPaHBNLZmODI1 * Join the Telegram-OpenIM group: https://t.me/joinchat/zSJLPaHBNLZmODI1
* 扫码加入微信群:[二维码](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/Wechat.jpg) * 扫码加入微信群:[二维码](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/Wechat.jpg)
* 中文访问这里:[Open-IM中文官网](http://open-im.io:9528/website/index.html#/) * 中文访问这里:[Open-IM中文官网](https://www.rentsoft.cn/developer)
## Quick start ## Quick start
### Installing Open-IM-Server ### Installing Open-IM-Server
#### Building from Source > Open-IM relies on five open source high-performance components: **ETCD**, **MySQL**, **MongoDB**, **Redis**, **Kafka**. Before you deploy Open-IM-Server privately, please make sure that you have installed the above five components and **check the component connection parameters** in the configuration file. you must install the missing components first,If your server does not have the above components. **It is recommended to use it directly, if you have the above components, if not, Docker-compose is recommended, which you don't need to install dependenciesis and more convenient**.
> Open-IM relies on five open source high-performance components: **ETCD**, **MySQL**, **MongoDB**, **Redis**, **Kafka**. Before you deploy Open-IM-Server privately, please make sure that you have installed the above five components and **check the component connection parameters** in the configuration file. you must install the missing components first,If your server does not have the above components. **It is recommended to use it directly, if you have the above components, if not, Docker installation is recommended, which is faster and more convenient**. #### Building from Source
1. Install [Go environment](https://golang.org/doc/install). Make sure Go version is at least 1.15. 1. Install [Go environment](https://golang.org/doc/install). Make sure Go version is at least 1.15.
...@@ -56,7 +56,7 @@ business data. ...@@ -56,7 +56,7 @@ business data.
``` ```
3. Open [config.yaml](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/config/config.yaml),then modify the 3. Open [config.yaml](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/config/config.yaml),then modify the
following parameters. following parameters,**127.0.0.1 replace with your host IP**.
- Check or modify the Etcd connection parameters. - Check or modify the Etcd connection parameters.
...@@ -70,31 +70,25 @@ business data. ...@@ -70,31 +70,25 @@ business data.
``` ```
mysql: mysql:
dbAddress: [ 127.0.0.1:3306 ] dbAddress: [ 127.0.0.1:3306 ]
dbUserName: xxx
dbPassword: xxx
dbDatabaseName: openIM
``` ```
- Check or modify database(MongoDB) connection parameters are correct for your - Check or modify database(MongoDB) connection parameters are correct for your
database.`No authentication mode if dbUserName and dbPassword is empty else authentication` database.`No authentication mode if dbUserName and dbPassword is empty else authentication`
``` ```
mongo: mongo:
dbAddress: [ 127.0.0.1:27017 ] dbAddress: [ 127.0.0.1:27017 ]
dbUserName:
dbPassword:
``` ```
- Check or modify Redis connection parameters.`No authentication mode if dbPassword is empty else authentication` - Check or modify Redis connection parameters.`No authentication mode if dbPassword is empty else authentication`
``` ```
redis: redis:
dbAddress: [ 127.0.0.1:6379 ] dbAddress: [ 127.0.0.1:6379 ]
dbPassWord:
``` ```
- Check or modify Kafka connection parameters. - Check or modify Kafka connection parameters.
``` ```
kafka: kafka:
ws2mschat: ws2mschat:
...@@ -102,107 +96,89 @@ business data. ...@@ -102,107 +96,89 @@ business data.
ms2pschat: ms2pschat:
addr: [ 127.0.0.1:9092 ] addr: [ 127.0.0.1:9092 ]
``` ```
4. Database initializer: 4. Build and start Service.
- **MySQL**
1. Shell authorization 1. Shell authorization
``` ```
chmod +x *.sh #cd Open-IM-server/scrip
```
2. Enter the script directory and execute `mysql_database_init.sh`
```
#1.Enter the directory
cd Open-IM-server/scrip
#2.execute the shell chmod +x *.sh
./mysql_database_init.sh
``` ```
5. Build and start Service. 2. Execute the build shell
1. Execute the build shell
``` ```
./build_all_service.sh ./build_all_service.sh
``` ```
2. Start service 3. Start service
``` ```
./start_all.sh ./start_all.sh
``` ```
#### Using Docker to run Open-IM-Server #### Using Docker to run Open-IM-Server(One-click deployment)
> Open-IM relies on five open source high-performance components: **ETCD**, **MySQL**, **MongoDB**, **Redis**, **Kafka**. Before you deploy Open-IM-Server privately, please make sure that you have installed the above five components and **check the component connection parameters** in the configuration file. you must install the missing components first,If your server does not have the above components. **It is recommended to use it directly, if you have the above components, if not, Docker installation is recommended, which is faster and more convenient**.
All images are available at https://hub.docker.com/r/lyt1123/open_im_server All images are available at https://hub.docker.com/r/lyt1123/open_im_server
1. [Install Docker](https://docs.docker.com/install/) 1.13 or above. 1. [Install Docker](https://docs.docker.com/install/) 1.13 or above.
3. Pull Open_IM_Server Image from docker 3. [Install Docker Compose](https://docs.docker.com/compose/install/) 1.22 or above.
3. [Download redis configuration](https://redis.io/topics/config) download the redis configuration file to **`/home/redis/config`**
4. Git clone Open-IM project
``` ```
docker pull docker.io/lyt1123/open_im_server:[tag] git clone https://github.com/OpenIMSDK/Open-IM-Server.git
#eg
docker pull docker.io/lyt1123/open_im_server:1.0
``` ```
3. External config file,the container comes with a built-in config file which can be customized with values from the 5. Open [docker-compose](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docker-compose.yaml),then modify the
environment variables .**If changes are extensive it may be more convenient to replace the built-in config file with following parameters,**127.0.0.1 replace with your host IP**.
a custom one**. In that case map the config file located on your host.
- Create configuration folder directory - Check or modify docker-compose Kafka connection parameters.
``` ```
mkdir -p open_im_server/config KAFKA_ZOOKEEPER_CONNECT: 127.0.0.1:2181
``` KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://127.0.0.1:9092
```
- Download the [config.yaml](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/config/config.yaml) file from 6. Open [config.yaml](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/config/config.yaml),then modify the
github, then modify the following parameters following parameters,**127.0.0.1 replace with your host IP**.
- Check or modify the ETCD connection parameters. - Check or modify the Etcd connection parameters.
``` ```
etcd: etcd:
etcdAddr: [ 127.0.0.1:2379 ] etcdAddr: [ 127.0.0.1:2379 ]
``` ```
- Check or modify database(MySQL) connection parameters are correct for your database. - Check or modify database(MySQL) connection parameters are correct for your database.
``` ```
mysql: mysql:
dbAddress: [ 127.0.0.1:3306 ] dbAddress: [ 127.0.0.1:3306 ]
dbUserName: xxx
dbPassword: xxx
``` ```
- Check or modify database(MongoDB) connection parameters are correct for your - Check or modify database(MongoDB) connection parameters are correct for your
database.`No authentication mode if dbUserName and dbPassword is empty else authentication` database.`No authentication mode if dbUserName and dbPassword is empty else authentication`
``` ```
mongo: mongo:
dbAddress: [ 127.0.0.1:27017 ] dbAddress: [ 127.0.0.1:27017 ]
dbUserName:
dbPassword:
``` ```
- Check or modify the Redis connection - Check or modify Redis connection parameters.`No authentication mode if dbPassword is empty else authentication`
parameters.`No authentication mode if dbPassword is empty else authentication`
``` ```
redis: redis:
dbAddress: [ 127.0.0.1:6379 ] dbAddress: [ 127.0.0.1:6379 ]
dbPassWord:
``` ```
- Check or modify the Kafka connection parameters. - Check or modify Kafka connection parameters.
``` ```
kafka: kafka:
ws2mschat: ws2mschat:
...@@ -211,23 +187,13 @@ All images are available at https://hub.docker.com/r/lyt1123/open_im_server ...@@ -211,23 +187,13 @@ All images are available at https://hub.docker.com/r/lyt1123/open_im_server
addr: [ 127.0.0.1:9092 ] addr: [ 127.0.0.1:9092 ]
``` ```
4. Upload the [config.yaml](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/config/config.yaml) file that you 7. Start docker-compose with one click(Docker automatically pulls all images)
modified to the **open_im_server/config** that you create in the server.
5. Start Open-IM-Server image
``` ```
docker run -p 10000:10000 -p 17778:17778 --name open_im_server -v /home/open_im_server/logs:/home/open_im_server/logs -v /home/open_im_server/config/config.yaml:/home/open_im_server/config/config.yaml --restart always -d docker.io/lyt1123/open_im_server:1.0 docker-compose up -d
``` ```
- -p `10000:10000` The container port maps the host 10000 port, provides api service.
- -p `17778:17778` The container port maps the host 17778 port, provides message services.
- --name `open_im_server` Container service name
- -v `/home/open_im_server/logs:/home/open_im_server/logs` The container log directory maps the host directory
- -v `/home/open_im_server/config/config.yaml:/home/open_im_server/config/config.yaml` The container
configuration file maps the host configuration file
- --restart `always` Automatically start when the container is closed abnormally
- -d Running service in the background
### CONFIGURATION INSTRUCTIONS ### CONFIGURATION INSTRUCTIONS
>Open-IM configuration is divided into basic component configuration and business internal service configuration. Developers need to fill in the address of each component as the address of their server component when using the product, and ensure that the internal service port of the business is not occupied >Open-IM configuration is divided into basic component configuration and business internal service configuration. Developers need to fill in the address of each component as the address of their server component when using the product, and ensure that the internal service port of the business is not occupied
...@@ -250,7 +216,7 @@ All images are available at https://hub.docker.com/r/lyt1123/open_im_server ...@@ -250,7 +216,7 @@ All images are available at https://hub.docker.com/r/lyt1123/open_im_server
* **api&&rpcport&&longconnsvr&&rpcregistername** * **api&&rpcport&&longconnsvr&&rpcregistername**
* The api port is the http interface, longconnsvr is the websocket listening port, and rpcport is the internal service startup port. Both support cluster deployment. Make sure that these ports are not used. If you want to open multiple services for a single service, fill in multiple ports separated by commas. rpcregistername is the service name registered by each service to the registry etcd, no need to modify * The api port is the http interface, longconnsvr is the websocket listening port, and rpcport is the internal service startup port. Both support cluster deployment. Make sure that these ports are not used. If you want to open multiple services for a single service, fill in multiple ports separated by commas. rpcregistername is the service name registered by each service to the registry etcd, no need to modify
* **log&&modulename** * **log&&modulename**
* The log configuration includes the storage path of the log file, and the log is sent to elasticsearch for log viewing. Currently, the log is not supported to be sent to elasticsearch. The configuration does not need to be modified for the time being. The modulename is used to split the log according to the name of the service module. The default configuration is fine. * The log configuration includes the storage path of the log file, and the log is sent to elasticsearch for log viewing. Currently, the log is not supported to be sent to elasticsearch. The configuration does not need to be modified for the time being. The modulename is used to split the log according to the name of the service module. The default configuration is fine.
* **multiloginpolicy&&tokenpolicy** * **multiloginpolicy&&tokenpolicy**
* Open-IM supports multi-terminal login. Currently, there are three multi-terminal login policies. The PC terminal and the mobile terminal are online at the same time by default. When multiple policies are configured to be true, the first policy with true is used by default, and the token policy is the generated token policy. , The developer can customize the expiration time of the token * Open-IM supports multi-terminal login. Currently, there are three multi-terminal login policies. The PC terminal and the mobile terminal are online at the same time by default. When multiple policies are configured to be true, the first policy with true is used by default, and the token policy is the generated token policy. , The developer can customize the expiration time of the token
...@@ -267,7 +233,7 @@ All images are available at https://hub.docker.com/r/lyt1123/open_im_server ...@@ -267,7 +233,7 @@ All images are available at https://hub.docker.com/r/lyt1123/open_im_server
* Total script, start all services and close all services * Total script, start all services and close all services
### Server-side authentication api graphic explanation of the login authentication process ### Server-side authentication api graphic explanation of the login authentication process
- **User Register** - **User Register**
- **Request URL** - **Request URL**
``` ```
...@@ -336,7 +302,7 @@ All images are available at https://hub.docker.com/r/lyt1123/open_im_server ...@@ -336,7 +302,7 @@ All images are available at https://hub.docker.com/r/lyt1123/open_im_server
``` ```
- **API call description** - **API call description**
``` ```
app:app client app:app client
app-server:app server app-server:app server
...@@ -347,7 +313,7 @@ All images are available at https://hub.docker.com/r/lyt1123/open_im_server ...@@ -347,7 +313,7 @@ All images are available at https://hub.docker.com/r/lyt1123/open_im_server
- **Authentication Clow Chart** - **Authentication Clow Chart**
![avatar](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/open-im-server.png) ![avatar](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/open-im-server.png)
## Architecture ## Architecture
![avatar](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/Architecture.jpg) ![avatar](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/Architecture.jpg)
......
...@@ -9,10 +9,10 @@ services: ...@@ -9,10 +9,10 @@ services:
container_name: mysql container_name: mysql
volumes: volumes:
- /home/mysql/data:/var/lib/mysql - /home/mysql/data:/var/lib/mysql
- /etc/timezone:/etc/timezone
- /etc/localtime:/etc/localtime - /etc/localtime:/etc/localtime
environment: environment:
MYSQL_ROOT_PASSWORD: "123456" MYSQL_ROOT_PASSWORD: openIM
TZ: Asia/Shanghai
restart: always restart: always
mongodb: mongodb:
...@@ -39,7 +39,7 @@ services: ...@@ -39,7 +39,7 @@ services:
restart: always restart: always
sysctls: sysctls:
net.core.somaxconn: 1024 net.core.somaxconn: 1024
command: 'redis-server /usr/local/redis/config/redis.conf' command: redis-server /usr/local/redis/config/redis.conf
zookeeper: zookeeper:
...@@ -76,10 +76,10 @@ services: ...@@ -76,10 +76,10 @@ services:
- 2380:2380 - 2380:2380
container_name: etcd container_name: etcd
volumes: volumes:
- /etc/timezone:/etc/timezone
- /etc/localtime:/etc/localtime - /etc/localtime:/etc/localtime
environment: environment:
ETCDCTL_API: 3 ETCDCTL_API: 3
TZ: Asia/Shanghai
restart: always restart: always
command: /usr/local/bin/etcd --name etcd0 --data-dir /etcd-data --listen-client-urls http://0.0.0.0:2379 --advertise-client-urls http://0.0.0.0:2379 --listen-peer-urls http://0.0.0.0:2380 --initial-advertise-peer-urls http://0.0.0.0:2380 --initial-cluster etcd0=http://0.0.0.0:2380 --initial-cluster-token tkn --initial-cluster-state new command: /usr/local/bin/etcd --name etcd0 --data-dir /etcd-data --listen-client-urls http://0.0.0.0:2379 --advertise-client-urls http://0.0.0.0:2379 --listen-peer-urls http://0.0.0.0:2380 --initial-advertise-peer-urls http://0.0.0.0:2380 --initial-cluster etcd0=http://0.0.0.0:2380 --initial-cluster-token tkn --initial-cluster-state new
...@@ -92,8 +92,8 @@ services: ...@@ -92,8 +92,8 @@ services:
# - 17778:17778 # - 17778:17778
# container_name: open-im-server # container_name: open-im-server
# volumes: # volumes:
# - /home/Open-IM-server/logs:/home/open_im_server/logs # - ./logs:/home/open_im_server/logs
# - /home/Open-IM-server/config/config.yaml:/home/open_im_server/config/config.yaml # - ./config/config.yaml:/home/open_im_server/config/config.yaml
# restart: always # restart: always
# build: # build:
# context: . # context: .
...@@ -113,8 +113,8 @@ services: ...@@ -113,8 +113,8 @@ services:
- 17778:17778 - 17778:17778
container_name: open-im-server container_name: open-im-server
volumes: volumes:
- /home/Open-IM-server/logs:/home/open_im_server/logs - ./logs:/home/open_im_server/logs
- /home/Open-IM-server/config/config.yaml:/home/open_im_server/config/config.yaml - ./config/config.yaml:/home/open_im_server/config/config.yaml
restart: always restart: always
depends_on: depends_on:
- kafka - kafka
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册