feat: add save scripts

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

@ -1,16 +1,19 @@
<h1 align="center" style="border-bottom: none">
<b>
<a href="https://doc.rentsoft.cn/">Open IM Server</a><br>
</b>
⭐️ Open source Instant Messaging Server ⭐️ <br>
</h1>
<p align="center">
<a href="https://www.openim.online">
<img src="./assets/logo-gif/openim-logo.gif" width="60%" height="30%"/>
</a>
</p>
<h3 align="center" style="border-bottom: none">
⭐️ Open source Instant Messaging Server ⭐️ <br>
<h3>
<p align=center>
<a href="https://goreportcard.com/report/github.com/OpenIMSDK/Open-IM-Server"><img src="https://goreportcard.com/badge/github.com/OpenIMSDK/Open-IM-Server" alt="A+"></a>
<a href="https://github.com/OpenIMSDK/Open-IM-Server/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3A%22good+first+issue%22"><img src="https://img.shields.io/github/issues/OpenIMSDK/Open-IM-Server/good%20first%20issue?logo=%22github%22" alt="good first"></a>
<a href="https://github.com/OpenIMSDK/Open-IM-Server"><img src="https://img.shields.io/github/stars/OpenIMSDK/Open-IM-Server.svg?style=flat&logo=github&colorB=deeppink&label=stars"></a>
<a href="https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg"><img src="https://img.shields.io/badge/Slack-100%2B-blueviolet?logo=slack&amp;logoColor=white"></a>
<a href="https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg"><img src="https://img.shields.io/badge/Slack-300%2B-blueviolet?logo=slack&amp;logoColor=white"></a>
<a href="https://github.com/OpenIMSDK/Open-IM-Server/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0-green"></a>
<a href="https://golang.org/"><img src="https://img.shields.io/badge/Language-Go-blue.svg"></a>
</p>
@ -18,164 +21,220 @@
</p>
<p align="center">
<a href="./README.md"><b>English</b></a>
<a href="./README_zh-CN.md"><b>中文</b></a>
<a href="./README.md"><b> English </b></a>
<a href="./README-zh_CN.md"><b> 简体中文 </b></a>
<a href="https://www.openim.online/en"><b> Docs </b></a>
</p>
</p>
## Open-IM-Server 是什么
## ✨ 关于 OpenIM
Open-IM-Server 是使用纯 Golang 精心制作的强大的即时消息服务器。其通过 JSON over WebSocket 进行通信的独特方法将每次交互都视为消息。这简化了定制并消除了修改服务器代码的需求。通过利用微服务架构,服务器可以通过集群部署,保证出色的性能和可伸缩性。
Open-IM-Server 不仅仅是一个即时消息服务器;它是将实时网络集成到您的应用程序中的强大工具,定位为您集成的首选选择!🚀
请注意Open-IM-Server 不作为独立产品运行,也不提供内置的帐户注册或登录服务。为了简化您的实施过程,我们已开源了 [chat repository](https://github.com/OpenIMSDK/chat),其中包括这些功能。与 Open-IM-Server 一起部署此聊天业务服务器可加快全面的聊天产品的设置。👥
为了进一步增强您的体验,我们还提供了 SDK 客户端,在其中实现了大多数复杂逻辑。可以在 [此链接](https://github.com/OpenIMSDK/openim-sdk-core) 找到 [SDK repository](https://github.com/OpenIMSDK/openim-sdk-core)。[chat repository](https://github.com/OpenIMSDK/chat) 是我们的业务服务器,而 'core' 代表 SDK 的高级封装,它们协同工作以提供卓越的结果。✨
## :star2: 为什么选择 OpenIM
**🔍 功能截图显示**
<div align="center">
| 💻🔄📱 多终端同步 🔄🖥️ | 📅⚡ 高效会议 🚀💼 |
| :----------------------------------------------------------: | :----------------------------------------------------------: |
| ![multiple-message](./assets/demo/multi-terminal-synchronization.png) | ![efficient-meetings](./assets/demo/efficient-meetings.png) |
| 📲🔄 **一对一和群聊** 👥🗣️ | 🎁💻 **特殊功能 - 自定义消息** ✉️🎨 |
| ![group-chat](./assets/demo/group-chat.png) | ![special-function](./assets/demo/special-function.png) |
</div>
1. **全面的消息类型支持 :speech_balloon:**
✅ 支持几乎所有类型的消息,包括文本、图片、表情符号、语音、视频、地理位置、文件、报价、名片、系统通知、自定义消息等
✅ 支持一对一和多人音视频通话
✅ 为 iOS、Android、Flutter、uni-app、ReactNative、Electron、Web、H5 等多个平台提供终端支持
2. **随时随地的高效会议 :earth_americas:**
✅ 基于具有 100% 可靠强制信令功能的 IM (Instant Messaging),为与聊天应用程序深度集成的 IM 系统铺平了道路
✅ 支持单次会议中的数百人,订阅人数达到数千,以及服务器端音视频录制
3. **适用于各种社交场景的一对一和群聊 :busts_in_silhouette:**
✅ OpenIM 有四种角色:应用程序管理员、群主、群管理员和普通成员
✅ 强大的群特性,如静音、群公告、群验证、无限群成员和根据需要加载群消息
4. **独特的功能 :star2:**
✅ 支持读取并烧毁私人聊天,可自定义时长
✅ 消息编辑功能扩大了社交场景,使即时通讯变得更加多样化和有趣
5. **开源 :open_hands:**
Open-IM-Server 是一款即时通讯服务器,使用纯 Golang 开发,采用 JSON over WebSocket 传输协议。在 Open-IM-Server 中所有东西都是消息因此您可以轻松扩展自定义消息而无需修改服务器代码。使用微服务架构Open-IM-Server 可以使用集群进行部署。通过在服务器上部署 Open-IM-Server开发人员可以快速地将即时通讯和实时网络功能集成到自己的应用程序中并确保业务数据的安全性和隐私性。
✅ OpenIM 的代码是开源的,数据自控,旨在构建一个全球领先的 IM 开源社区,包括客户端 SDK 和服务器
Open-IM-Server并不是一个独立的产品本身不包含账号的注册和登录服务。
为方便大家测试,我们开源了包括登录注册功能的 [chat 仓库](https://github.com/OpenIMSDK/chat)chat 业务服务端和 Open-IM-Server 一起部署,即可搭建一个聊天产品。
✅ 基于开源服务器,已经开发了许多出色的开源项目,例如 [OpenKF](https://github.com/OpenIMSDK/OpenKF) (开源 AI 客户服务系统)
## 特点
6. **易于扩展 :wrench:**
+ 开源
+ 易于集成
+ 良好的可扩展性
+ 高性能
+ 轻量级
+ 支持多种协议
✅ OpenIM 服务器是用 Golang 实现的,引入了创新的 "一切都是消息" 通信模型,简化了自定义消息和扩展功能的实现
## 社区
7. **高性能 :racing_car:**
+ 访问中文官方网站:[OpenIM中文开发文档](https://doc.rentsoft.cn/)
✅ OpenIM 支持集群中的分层治理架构,经过大量用户的测试,并抽象了在线消息、离线消息和历史消息的存储模型
## 快速开始
8. **全平台支持 :tv:**
### 使用 docker-compose 部署
✅ 支持原生 iOS、Android跨平台 Flutter、uni-app、ReactNative主要的 Web 前端框架如 React、Vue小程序和 Electron 支持的 PC 平台
9. **终极部署体验 🤖**
✅ 支持 [集群部署](https://github.com/OpenIMSDK/Open-IM-Server/edit/main/deployments/README.md)
✅ 支持多架构镜像,我们的 Docker 镜像不仅托管在 GitHub 上,而且还在阿里云和 Docker Hub 上支持多个架构。请访问 [我们的 GitHub packages](https://github.com/orgs/OpenIMSDK/packages?repo_name=Open-IM-Server) 并阅读我们的 [版本管理文档](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/version.md) 以获取更多信息。
10. **开源社区的大生态系统 🤲**
✅ 我们有数万用户和许多解决方案来解决问题。
✅ 我们有一个大型的开源社区叫 [OpenIMSDK](https://github.com/OpenIMSDK),它运行核心模块,我们还有一个开源社区叫 [openim-sigs](https://github.com/openim-sigs) 以探索更多基于 IM 的基础设施产品。
## :rocket: 快速开始
<details> <summary>使用 Docker Compose 部署</summary>
1. 克隆项目
```
git clone https://github.com/OpenIMSDK/Open-IM-Server
cd Open-IM-Server
git checkout release-v3.0 #or other release branch
bashCopy code# 选择您需要的
BRANCH=release-v3.1
git clone -b $BRANCH https://github.com/OpenIMSDK/Open-IM-Server openim && export openim=$(pwd)/openim && cd $openim && make build
```
2. 修改 .env
> **注意** 阅读我们的发布策略https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/version.md
1. 修改 `.env`
```
此处主要修改相关组件密码
USER=root #不用修改
PASSWORD=openIM123 #8位以上的数字和字母组合密码密码对redis mysql mongo生效以及config/config.yaml中的accessSecret
ENDPOINT=http://127.0.0.1:10005 #minio对外服务的ip和端口或用域名storage.xx.xxapp要能访问到此ip和端口或域名
API_URL=http://127.0.0.1:10002/object/ #app要能访问到此ip和端口或域名
bashCopy codeUSER=root #无需修改
PASSWORD=openIM123 #8位或更多数字和字母的组合此密码适用于redis、mysql、mongo以及config/config.yaml中的accessSecret
ENDPOINT=http://127.0.0.1:10005 #minio的外部服务IP和端口或使用域名storage.xx.xx应用程序必须能够访问此IP和端口或域名
API_URL=http://127.0.0.1:10002/object/ #应用程序必须能够访问此IP和端口或域名
DATA_DIR=./ #指定大磁盘目录
```
3. 部署和启动
1. 部署并启动
注意:此命令只能执行一次,它会根据.env 中的 PASSWORD 变量修改 docker-compose 中组件密码,并修改 config/config.yaml 中的组件密码
如果.env 中的密码变了,需要先 docker-compose down ; rm components -rf 后再执行此命令。
> **注意** 此命令只能执行一次。它会基于 `.env` 中的 `PASSWORD` 变量修改 docker-compose 中的组件密码,并修改 `config/config.yaml` 中的组件密码。如果 `.env` 中的密码发生变化,您需要首先执行 `docker-compose down``rm components -rf` 然后执行此命令。
```
chmod +x install_im_server.sh;
./install_im_server.sh;
bashCopy code
make install
```
4. 检查服务
1. 检查服务
```
cd scripts;
./docker_check_service.sh
bashCopy code
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>从源码编译</summary>
1. Go 1.18或更高版本
您需要 `Go 1.18` 或更高版本,以及 `make`
2. 克隆
版本详情https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/version.md
```
git clone https://github.com/OpenIMSDK/Open-IM-Server
cd Open-IM-Server
git checkout release-v3.0 #or other release branch
```
```
bashCopy code# 选择您需要的
BRANCH=release-v3.1
git clone -b $BRANCH https://github.com/OpenIMSDK/Open-IM-Server openim && export openim=$(pwd)/openim && cd $openim && make build
```
3. 编译
阅读关于 [OpenIM 版本策略](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/version.md)
```
cd Open-IM-server/scripts
chmod +x *.sh
./build_all_service.sh
```
使用 `make help` 来查看 OpenIM 支持的指令。
所有服务已成功构建如图所示
如图所示,所有服务已成功构建
![编译成功](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/images/build.png)
![成功编译](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/images/build.png)
### 组件配置说明
</details> <details> <summary>组件配置说明</summary>
config/config.yaml中针对存储组件有详细的配置说明
config/config.yaml 文件为存储组件提供了详细的配置说明。
+ Zookeeper
+ 用于RPC 服务发现和注册,支持集群。
- Zookeeper
- 用于 RPC 服务发现和注册,支持集群。
````
```
zookeeper:
bashCopy codezookeeper:
schema: openim #不建议修改
address: [ 127.0.0.1:2181 ] #地址
username: #用户名
password: #密码
```
````
+ MySQL
- MySQL
+ 用于存储用户、关系链、群组,支持数据库主备
- 用于存储用户、关系和群组,支持主从数据库
```
mysql:
bashCopy codemysql:
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 #慢语句阈值 (毫秒)
maxOpenConn: 1000 #最大连接
maxIdleConn: 100 #最大空闲连接
maxLifeTime: 60 #连接可重用的最大时间(秒)
logLevel: 4 #日志级别 1=静音 2=错误 3=警告 4=信息
slowThreshold: 500 #慢语句阈值(毫秒)
```
- Mongo
+ Mongo
+ 用于存储离线消息支持mongo分片集群。
- 用于存储离线消息,支持 mongo 分片集群。
```
mongo:
uri: #不为空则直接使用该
bashCopy codemongo:
uri: #如果不为空,则直接使用此
address: [ 127.0.0.1:37017 ] #地址
database: openIM #mongo db 默认即可
database: openIM #默认 mongo 数据库
username: root #用户名
password: openIM123 #密码
maxPoolSize: 100 #最大连接数
```
+ Redis
+ 用于存储消息序列号、最新消息、用户token及mysql缓存支持集群部署。
- Redis
- 用于存储消息序列号、最新消息、用户令牌和 mysql 缓存,支持集群部署。
```
redis:
bashCopy coderedis:
address: [ 127.0.0.1:16379 ] #地址
username: #用户名
password: openIM123 #密码
```
+ Kafka
+ 用于消息队列,用于消息解耦,支持集群部署。
- Kafka
- 用于消息队列,用于消息解耦,支持集群部署。
```
kafka:
bashCopy codekafka:
username: #用户名
password: #密码
addr: [ 127.0.0.1:9092 ] #地址
@ -195,71 +254,104 @@ config/config.yaml中针对存储组件有详细的配置说明
msgToModify: modify
```
### 启停服务
</details> <details> <summary>启动和停止服务</summary>
启动服务
```
./start_all.sh;
bashCopy code
./scripts/start_all.sh;
```
检查服务
```
./check_all.sh
bashCopy code
./scripts/check_all.sh
```
停止服务
```
./stop_all.sh
bashCopy code
./scripts/stop_all.sh
```
### 开放 IM 端口
</details>
<details> <summary>开放 IM 端口</summary>
| TCP 端口 | 说明 | 操作 |
| --------- | ----------------------------------------------------- | --------------------------------------- |
| TCP:10001 | ws 协议,消息端口如消息发送、推送等,用于客户端 SDK | 端口放或 nginx 反向代理,并关闭防火墙 |
| TCP:10002 | api 端口,如用户、好友、群组、消息等接口。 | 端口放行或 nginx 反向代理,并关闭防火墙 |
| TCP:10005 | 选择 minio 存储时需要(openIM 默认使用 minio 存储) | 端口放行或 nginx 反向代理,并关闭防火墙 |
| TCP 端口 | 描述 | 操作 |
| --------- | --------------------------------------------------- | --------------------------------------- |
| TCP:10001 | ws 协议,消息端口如消息发送、推送等,用于客户端 SDK | 端口放或 nginx 反向代理,并关闭防火墙 |
| TCP:10002 | api 端口,如用户、朋友、组、消息接口。 | 端口释放或 nginx 反向代理,并关闭防火墙 |
| TCP:10005 | 选择 minio 存储时所需 (openIM 默认使用 minio 存储) | 端口释放或 nginx 反向代理,并关闭防火墙 |
### 开放 Chat 端口
</details> <details> <summary>开放聊天端口</summary>
| TCP 端口 | 说明 | 操作 |
- 聊天仓库: https://github.com/OpenIMSDK/chat
| TCP 端口 | 描述 | 操作 |
| --------- | ------------------------ | --------------------------------------- |
| TCP:10008 | 业务系统,如注册、登录等 | 端口放行或 nginx 反向代理,并关闭防火墙 |
| TCP:10009 | 管理后台,如统计、封号等 | 端口放行或 nginx 反向代理,并关闭防火墙 |
| TCP:10008 | 业务系统,如注册、登录等 | 端口释放或 nginx 反向代理,并关闭防火墙 |
| TCP:10009 | 管理后台,如统计、封禁等 | 端口释放或 nginx 反向代理,并关闭防火墙 |
</details>
## :link: APP 和 OpenIM 之间的关系
OpenIM 不仅仅是一个开源的即时消息组件,它是您的应用程序生态系统的一个不可分割的部分。查看此图表以了解 AppServer、AppClient、Open-IM-Server 和 Open-IM-SDK 如何互动。
![App-OpenIM 关系](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/images/open-im-server.png)
## :building_construction: 总体架构
深入了解 Open-IM-Server 的功能与我们的架构图。
![总体架构](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/images/Architecture.jpg)
## :hammer_and_wrench: 开始开发 OpenIM
## APP和OpenIM关系
OpenIM 我们的目标是建立一个顶级的开源社区。我们有一套标准,在 [Community repository](https://github.com/OpenIMSDK/community) 中。
OpenIM 是开源的即时通讯组件它并不是一个独立的产品此图展示了AppServer、AppClient、Open-IM-Server以及Open-IM-SDK之间的关系
如果您想为这个 Open-IM-Server 仓库做贡献,请阅读我们的 [贡献者文档](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/CONTRIBUTING.md)。
![https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/open-im-server.png](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/images/open-im-server.png)
在您开始之前,请确保您的更改是需要的。最好的方法是创建一个 [新的讨论](https://github.com/OpenIMSDK/Open-IM-Server/discussions/new/choose) 或 [Slack 通讯](https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg),或者如果您发现一个问题,首先 [报告它](https://github.com/OpenIMSDK/Open-IM-Server/issues/new/choose)。
## 整体架构
- [代码标准](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/go_code.md)
- [Docker 图像标准](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/images.md)
- [目录标准](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/directory.md)
- [提交标准](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/commit.md)
- [版本控制标准](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/version.md)
- [接口标准](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/api.md)
- [日志标准](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/log.md)
- [错误代码标准](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/error_code.md)
![https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/Architecture.jpg](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/images/Architecture.jpg)
## :busts_in_silhouette: 社区
## 开始开发 OpenIM
- 📚 [OpenIM 社区](https://github.com/OpenIMSDK/community)
- 💕 [OpenIM 兴趣小组](https://github.com/Openim-sigs)
- 🚀 [加入我们的 Slack 社区](https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg)
- :eyes: [加入我们的微信群 (微信群)](https://openim-1253691595.cos.ap-nanjing.myqcloud.com/WechatIMG20.jpeg)
[社区存储库](https://github.com/OpenIMSDK/community)包含有关从源代码构建 Kubernetes、如何贡献代码和文档。
## :calendar: 社区会议
## 贡献
我们希望任何人都可以参与我们的社区并贡献代码,我们提供礼物和奖励,欢迎您每周四晚上加入我们。
欢迎对该项目进行贡献!请参见 [CONTRIBUTING.md](http://CONTRIBUTING.md) 了解详细信息
我们的会议在 [OpenIM Slack](https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg) 🎯,然后您可以搜索 Open-IM-Server 管道加入
## 社区会议
我们在 [GitHub 讨论](https://github.com/OpenIMSDK/Open-IM-Server/discussions/categories/meeting) 中记下每次 [双周会议](https://github.com/orgs/OpenIMSDK/discussions/categories/meeting) 的笔记,我们的历史会议记录以及会议回放都可在 [Google Docs :bookmark_tabs:](https://docs.google.com/document/d/1nx8MDpuG74NASx081JcCpxPgDITNTpIIos0DS6Vr9GU/edit?usp=sharing) 中找到。
我们希望任何人都能参与我们的社区,我们提供礼品和奖励,并欢迎您每周四晚上加入我们。
## :eyes: 谁在使用 OpenIM
我们在 [GitHub 讨论](https://github.com/OpenIMSDK/Open-IM-Server/discussions/categories/meeting) 中记录每个 [两周会议](https://github.com/OpenIMSDK/Open-IM-Server/issues/381),我们的记录写在 [Google 文档](https://docs.google.com/document/d/1nx8MDpuG74NASx081JcCpxPgDITNTpIIos0DS6Vr9GU/edit?usp=sharing) 中
查看我们的 [用户案例研究](https://github.com/OpenIMSDK/community/blob/main/ADOPTERS.md) 页面以获取项目用户列表。不要犹豫,留下一个 [📝评论](https://github.com/OpenIMSDK/Open-IM-Server/issues/379) 并分享您的使用案例
## 谁在使用 Open-IM-Server
## :page_facing_up: 许可证
[用户案例研究](https://github.com/OpenIMSDK/community/blob/main/ADOPTERS.md) 页面包括该项目的用户列表。您可以留下 [📝评论](https://github.com/OpenIMSDK/Open-IM-Server/issues/379) 让我们知道您的用例
OpenIM 根据 Apache 2.0 许可证授权。请查看 [LICENSE](https://github.com/OpenIMSDK/Open-IM-Server/tree/main/LICENSE) 以获取完整的许可证文本
![https://github.com/OpenIMSDK/OpenIM-Docs/blob/main/docs/images/WechatIMG20.jpeg](https://github.com/OpenIMSDK/OpenIM-Docs/blob/main/docs/images/WechatIMG20.jpeg)
OpenIM logo包括其变体和动画版本在此存储库 [OpenIM](https://github.com/OpenIMSDK/Open-IM-Server) 下的 [assets/logo](./assets/logo) 和 [assets/logo-gif](./assets/logo-gif) 目录中显示,受版权法保护。
## 许可证
## 🔮 感谢我们的贡献者!
Open-IM-Server 使用 Apache 2.0 许可证。有关详情,请参阅 LICENSE 文件。
<a href="https://github.com/OpenIMSDK/Open-IM-Server/graphs/contributors"> <img src="https://contrib.rocks/image?repo=OpenIMSDK/Open-IM-Server" /> </a>

@ -29,336 +29,3 @@
</p>
## ✨ About OpenIM
Open-IM-Server, crafted meticulously using pure Golang, stands as a robust instant messaging server. Its unique approach to communication, via JSON over WebSocket, treats every interaction as a message. This simplifies customization and eliminates the need for tinkering with server code. Harnessing the power of microservice architecture, the server can be deployed via clusters, promising impressive performance and scalability.
Open-IM-Server is more than an instant messaging server; it's a powerful tool for incorporating real-time networking into your applications, positioning itself as your premier choice for integration! 🚀
Please be aware that Open-IM-Server does not function as a standalone product and does not offer built-in account registration or login services. To ease your implementation process, we've open-sourced the [chat repository](https://github.com/OpenIMSDK/chat), which comprises these features. Deploying this chat business server in conjunction with Open-IM-Server expedites the setup of a comprehensive chat product. 👥
Further enhancing your experience, we also provide an SDK client, wherein most complex logics are implemented. The [SDK repository](https://github.com/OpenIMSDK/openim-sdk-core) can be found at [this link](https://github.com/OpenIMSDK/openim-sdk-core). The [chat repository](https://github.com/OpenIMSDK/chat) is our business server while the 'core' represents the high-level encapsulation of the SDK, synergistically working together to deliver superior results. ✨
## :star2: Why OpenIM
**🔍 Function screenshot display**
<div align="center">
| 💻🔄📱 Multi Terminal Synchronization 🔄🖥️ | 📅⚡ Efficient Meetings 🚀💼 |
| :----------------------------------------------------------: | :---------------------------------------------------------: |
| ![multiple-message](./assets/demo/multi-terminal-synchronization.png) | ![efficient-meetings](./assets/demo/efficient-meetings.png) |
| 📲🔄 **One-to-one and Group Chats** 👥🗣️ | 🎁💻 **Special Features - Custom Messages** ✉️🎨|
| ![group-chat](./assets/demo/group-chat.png) | ![special-function](./assets/demo/special-function.png) |
</div>
1. **Comprehensive Message Type Support :speech_balloon:**
✅ Supports almost all types of messages, including text, images, emojis, voice, video, geographical location, files, quotes, business cards, system notifications, custom messages and more
✅ Supports one-on-one and multi-person audio and video calls
✅ Provides terminal support for multiple platforms such as iOS, Android, Flutter, uni-app, ReactNative, Electron, Web, H5
2. **Efficient Meetings Anytime, Anywhere :earth_americas:**
✅ Based on IM (Instant Messaging) with 100% reliable forced signaling capabilities, it paves the way for IM systems, deeply integrated with chat applications
✅ Supports hundreds of people in a single meeting, with subscription numbers reaching thousands, and server-side audio and video recording
3. **One-on-one and Group Chats for Various Social Scenarios :busts_in_silhouette:**
✅ OpenIM has four roles: application administrator, group owner, group administrator, and regular member
✅ Powerful group features such as muting, group announcements, group validation, unlimited group members, and loading group messages as needed
4. **Unique Features :star2:**
✅ Supports read-and-burn private chats, customizable duration
✅ Message editing function broadens social scenarios, making instant communication more diverse and interesting
5. **Open Source :open_hands:**
✅ The code of OpenIM is open source, self-controlled data, aimed at building a globally leading IM open source community, including client SDK and server
✅ Based on open source Server, many excellent open source projects have been developed, such as [OpenKF](https://github.com/OpenIMSDK/OpenKF) (Open source AI customer service system)
6. **Easy to Expand :wrench:**
✅ The OpenIM server is implemented in Golang, introducing an innovative "everything is a message" communication model, simplifying the implementation of custom messages and extended features
7. **High Performance :racing_car:**
✅ OpenIM supports a hierarchical governance architecture in the cluster, tested by a large number of users, and abstracts the storage model of online messages, offline messages, and historical messages
8. **Full Platform Support :tv:**
✅ Supports native iOS, Android; cross-platform Flutter, uni-app, ReactNative; major web front-end frameworks such as React, Vue; applets; and PC platforms supported by Electron
9. **The ultimate deployment experience 🤖**
✅ Supports [cluster deployment](https://github.com/OpenIMSDK/Open-IM-Server/edit/main/deployments/README.md)
✅ Supports multi-architecture mirroring, our Docker images are hosted not only on GitHub but also on Alibaba Cloud and Docker Hub supporting multiple architectures. Visit [our GitHub packages](https://github.com/orgs/OpenIMSDK/packages?repo_name=Open-IM-Server) and read our [version management document](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/version.md) for more information.
11. **A large ecosystem of open source communities 🤲**
✅ We have tens of thousands of users and many solutions to problems.
✅ 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
OpenIM isn't just an open-source instant messaging component, it's an integral part of your application ecosystem. Check out this diagram to understand how AppServer, AppClient, Open-IM-Server, and Open-IM-SDK interact.
![App-OpenIM Relationship](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/images/open-im-server.png)
## :building_construction: Overall Architecture
Delve into the heart of Open-IM-Server's functionality with our architecture diagram.
![Overall Architecture](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/images/Architecture.jpg)
## :hammer_and_wrench: To start developing OpenIM
OpenIM Our goal is to build a top-level open source community. We have a set of standards, in the [Community repository](https://github.com/OpenIMSDK/community).
If you'd like to contribute to this Open-IM-Server repository, please read our [contributor documentation](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/CONTRIBUTING.md).
Before you start, please make sure your changes are in demand. The best for that is to create a [new discussion](https://github.com/OpenIMSDK/Open-IM-Server/discussions/new/choose) OR [Slack Communication](https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg), or if you find an issue, [report it](https://github.com/OpenIMSDK/Open-IM-Server/issues/new/choose) first.
- [Code Standards](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/go_code.md)
- [Docker Images Standards](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/images.md)
- [Directory Standards](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/directory.md)
- [Commit Standards](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/commit.md)
- [Versioning Standards](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/version.md)
- [Interface Standards](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/api.md)
- [Log Standards](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/log.md)
- [Error Code Standards](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/error_code.md)
## :busts_in_silhouette: Community
+ 📚 [OpenIM Community](https://github.com/OpenIMSDK/community)
+ 💕 [OpenIM Interest Group](https://github.com/Openim-sigs)
+ 🚀 [Join our Slack community](https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg)
+ :eyes: [Join our wechat (微信群)](https://openim-1253691595.cos.ap-nanjing.myqcloud.com/WechatIMG20.jpeg)
## :calendar: Community Meetings
We want anyone to get involved in our community and contributing code, we offer gifts and rewards, and we welcome you to join us every Thursday night.
Our conference is in the [OpenIM Slack](https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg) 🎯, then you can search the Open-IM-Server pipeline to join
We take notes of each [biweekly meeting](https://github.com/orgs/OpenIMSDK/discussions/categories/meeting) in [GitHub discussions](https://github.com/OpenIMSDK/Open-IM-Server/discussions/categories/meeting), Our historical meeting notes, as well as replays of the meetings are available at [Google Docs :bookmark_tabs:](https://docs.google.com/document/d/1nx8MDpuG74NASx081JcCpxPgDITNTpIIos0DS6Vr9GU/edit?usp=sharing).
## :eyes: Who are using OpenIM
Check out our [user case studies](https://github.com/OpenIMSDK/community/blob/main/ADOPTERS.md) page for a list of the project users. Don't hesitate to leave a [📝comment](https://github.com/OpenIMSDK/Open-IM-Server/issues/379) and share your use case.
## :page_facing_up: License
OpenIM is licensed under the Apache 2.0 license. See [LICENSE](https://github.com/OpenIMSDK/Open-IM-Server/tree/main/LICENSE) for the full license text.
The OpenIM logo, including its variations and animated versions, displayed in this repository [OpenIM](https://github.com/OpenIMSDK/Open-IM-Server) under the [assets/logo](./assets/logo) and [assets/logo-gif](assets/logo-gif) directories, are protected by copyright laws.
## 🔮 Thanks to our contributors!
<a href="https://github.com/OpenIMSDK/Open-IM-Server/graphs/contributors">
<img src="https://contrib.rocks/image?repo=OpenIMSDK/Open-IM-Server" />
</a>

@ -14,9 +14,9 @@
# -----------------------------------------------------------------
# This config file is the template file
# -| source: scripts/template/config-tmpl/openim_config.yaml
# -| env: scripts/install/environment.sh
# -| target: config/config.yaml
# --| source: scripts/template/config-tmpl/openim_config.yaml
# --| env: scripts/install/environment.sh
# --| target: config/config.yaml
# -----------------------------------------------------------------
###################### Zookeeper ######################

@ -21,6 +21,9 @@ OPENIM_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd -P)"
# 生成文件存放目录
LOCAL_OUTPUT_ROOT="${OPENIM_ROOT}/${OUT_DIR:-_output}"
source "${OPENIM_ROOT}/scripts/lib/util.sh"
IP=$(openim::util::get_server_ip)
function def() {
local var_name="$1"
@ -29,7 +32,7 @@ function def() {
}
# app要能访问到此ip和端口或域名
def "API_URL" "http://127.0.0.1:10002/object/"
def "API_URL" "http://${IP}:10002/object/"
def "DATA_DIR" "${OPENIM_ROOT}"
# 设置统一的用户名,方便记忆
@ -51,10 +54,9 @@ mkdir -p ${INSTALL_DIR}
def "ENV_FILE" "${OPENIM_ROOT}/scripts/install/environment.sh"
# 注意: 一般的配置都可以使用 def 来定义,如果是包含特殊字符,比如说:
# readonly MSG_DESTRUCT_TIME=${MSG_DESTRUCT_TIME:-'0 2 * * *'}
# 使用 readonly 来定义合适,负责无法正常解析
# TODO 注意: 一般的配置都可以使用 def 函数来定义,如果是包含特殊字符,比如说:
# TODO readonly MSG_DESTRUCT_TIME=${MSG_DESTRUCT_TIME:-'0 2 * * *'}
# TODO 使用 readonly 来定义合适,负责无法正常解析
###################### Zookeeper 配置信息 ######################
def "ZOOKEEPER_SCHEMA" "openim" # Zookeeper的模式
@ -85,7 +87,7 @@ def "MONGO_MAX_POOL_SIZE" "100" # 最大连接池大小
def "OBJECT_ENABLE" "minio" # 对象是否启用
def "OBJECT_APIURL" "http://127.0.0.1:10002/object/" # 对象的API地址
def "MINIO_BUCKET" "openim" # MinIO的存储桶名称
def "MINIO_ENDPOINT" "http://127.0.0.1:10005" # MinIO的端点URL
def "MINIO_ENDPOINT" "http://${IP}:10005" # MinIO的端点URL
def "MINIO_ACCESS_KEY" "${USER}" # MinIO的访问密钥ID
def "MINIO_SECRET_KEY" "${PASSWORD}" # MinIO的密钥
def "MINIO_SESSION_TOKEN" # MinIO的会话令牌
@ -207,6 +209,9 @@ def "THIRD_PROM_PORT" "21301" # Third 服务的 Prometheus 端
# Message Transfer 服务的 Prometheus 端口列表
readonly MSG_TRANSFER_PROM_PORTS=${MSG_TRANSFER_PROM_PORTS:-'21400, 21401, 21402, 21403'}
###################### 设计中...暂时不需要######################################
# openim 配置
def "OPENIM_DATA_DIR" "/data/openim"
def "OPENIM_INSTALL_DIR" "/opt/openim"

@ -354,7 +354,7 @@ openim::util::remove-gen-docs() {
# repo, e.g. "upstream" or "origin".
openim::util::git_upstream_remote_name() {
git remote -v | grep fetch |\
grep -E 'github.com[/:]marmotedu/openim|marmotedu.io/openim' |\
grep -E 'github.com[/:]OpenIMSDK/Open-IM-Server|openim.cc/server' |\
head -n 1 | awk '{print $1}'
}

Loading…
Cancel
Save