Files
open-im-server/README.md
T

364 lines
17 KiB
Markdown
Raw Normal View History

2023-07-12 12:28:18 +08:00
<p align="center">
<a href="https://www.openim.online">
<img src="./assets/logo-gif/openim-logo.gif" width="60%" height="30%"/>
</a>
</p>
2023-07-21 21:20:23 +08:00
2023-07-12 12:28:18 +08:00
<h3 align="center" style="border-bottom: none">
⭐️ Open source Instant Messaging Server ⭐️ <br>
<h3>
2023-06-29 22:35:31 +08:00
2023-05-11 00:49:41 +08:00
<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>
2023-05-11 01:09:39 +08:00
<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>
2023-05-13 18:00:28 +08:00
<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>
2023-07-26 17:28:35 +08:00
<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>
2023-05-11 00:52:15 +08:00
<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>
2023-05-11 00:49:41 +08:00
<a href="https://golang.org/"><img src="https://img.shields.io/badge/Language-Go-blue.svg"></a>
</p>
2023-06-29 22:35:31 +08:00
2023-05-13 18:03:50 +08:00
</p>
2023-05-10 23:17:13 +08:00
2023-05-13 18:03:50 +08:00
<p align="center">
2023-06-30 10:31:13 +08:00
<a href="./README.md"><b> English </b></a> •
2023-08-06 15:08:11 +08:00
<a href="./README-zh_CN.md"><b> 简体中文 </b></a> •
<a href="https://www.openim.online/en"><b> Docs </b></a>
2023-05-13 18:03:50 +08:00
</p>
2023-05-10 23:17:13 +08:00
2023-08-06 15:08:11 +08:00
2023-05-13 18:03:50 +08:00
</p>
2023-08-06 15:08:11 +08:00
## ✨ About OpenIM
2023-05-10 23:17:13 +08:00
2023-08-06 13:37:16 +08:00
Open-IM-Server is a robust instant messaging server engineered using pure Golang, leveraging JSON over WebSocket for communication. The server treats everything as a message, facilitating straightforward customization without modifying the server code. Its microservice architecture enables deployment using clusters, ensuring high performance and scalability.
2023-08-06 13:37:16 +08:00
Whether you're looking to integrate instant messaging or real-time networking into your applications, Open-IM-Server is your go-to solution! :rocket:
2023-06-29 22:35:31 +08:00
2023-08-06 13:37:16 +08:00
It's important to note that Open-IM-Server isn't a standalone product, and it doesn't include account registration and login services. However, we've made your life easier by open-sourcing the [chat repository](https://github.com/OpenIMSDK/chat) that includes login and registration features. Deploying the chat business server alongside Open-IM-Server quickly sets up a comprehensive chat product. :busts_in_silhouette:
2023-06-29 22:35:31 +08:00
2023-08-06 13:37:16 +08:00
## :star2: Why OpenIM
2023-06-29 22:35:31 +08:00
2023-08-06 15:08:11 +08:00
**🔍 Function screenshot display**
2023-06-29 22:35:31 +08:00
2023-08-06 15:08:11 +08:00
<div align="center">
2023-06-29 22:35:31 +08:00
2023-08-07 10:05:22 +08:00
| multiple message | Efficient meetings |
| :-----------------------------------------------------: | :---------------------------------------------------------: |
| ![multiple-message](./assets/demo/multiple-message.png) | ![efficient-meetings](./assets/demo/efficient-meetings.png) |
| **One-to-one and group chats** | **Special features - Custom messages** |
2023-08-07 10:07:33 +08:00
| ![group-chat](./assets/demo/group-chat.png) | ![special-function](./assets/demo/special-function.png) |
2023-08-06 13:37:16 +08:00
2023-08-06 15:08:11 +08:00
</div>
2023-08-06 13:37:16 +08:00
2023-08-06 15:08:11 +08:00
1. **Comprehensive Message Type Support :speech_balloon:**
2023-08-06 15:39:06 +08:00
✅ Supports almost all types of messages, including text, images, emojis, voice, video, geographical location, files, quotes, business cards, system notifications, custom messages and more
2023-08-06 15:08:11 +08:00
✅ Supports one-on-one and multi-person audio and video calls
2023-08-06 13:37:16 +08:00
2023-08-06 15:08:11 +08:00
✅ Provides terminal support for multiple platforms such as iOS, Android, Flutter, uni-app, ReactNative, Electron, Web, H5
2023-08-06 13:37:16 +08:00
2023-08-06 15:08:11 +08:00
2. **Efficient Meetings Anytime, Anywhere :earth_americas:**
2023-08-06 13:37:16 +08:00
2023-08-06 15:08:11 +08:00
✅ Based on IM (Instant Messaging) with 100% reliable forced signaling capabilities, it paves the way for IM systems, deeply integrated with chat applications
2023-08-06 13:37:16 +08:00
2023-08-06 15:08:11 +08:00
✅ Supports hundreds of people in a single meeting, with subscription numbers reaching thousands, and server-side audio and video recording
2023-08-06 13:37:16 +08:00
2023-08-06 15:08:11 +08:00
3. **One-on-one and Group Chats for Various Social Scenarios :busts_in_silhouette:**
2023-08-06 13:37:16 +08:00
2023-08-06 15:08:11 +08:00
✅ OpenIM has four roles: application administrator, group owner, group administrator, and regular member
2023-08-06 13:37:16 +08:00
2023-08-06 15:08:11 +08:00
✅ Powerful group features such as muting, group announcements, group validation, unlimited group members, and loading group messages as needed
2023-08-06 13:37:16 +08:00
2023-08-06 15:08:11 +08:00
4. **Unique Features :star2:**
2023-08-06 13:37:16 +08:00
2023-08-06 15:08:11 +08:00
✅ Supports read-and-burn private chats, customizable duration
2023-08-06 13:37:16 +08:00
2023-08-06 15:08:11 +08:00
✅ Message editing function broadens social scenarios, making instant communication more diverse and interesting
2023-08-06 13:37:16 +08:00
2023-08-06 15:08:11 +08:00
5. **Open Source :open_hands:**
2023-08-06 13:37:16 +08:00
2023-08-06 15:08:11 +08:00
✅ 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
2023-08-06 13:37:16 +08:00
2023-08-06 15:08:11 +08:00
✅ 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)
2023-08-06 13:37:16 +08:00
2023-08-06 15:08:11 +08:00
6. **Easy to Expand :wrench:**
2023-08-06 13:37:16 +08:00
2023-08-06 15:08:11 +08:00
✅ 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
2023-08-06 13:37:16 +08:00
2023-08-06 15:08:11 +08:00
7. **High Performance :racing_car:**
2023-08-06 13:37:16 +08:00
2023-08-06 15:08:11 +08:00
✅ 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
2023-08-06 13:37:16 +08:00
2023-08-06 15:08:11 +08:00
8. **Full Platform Support :tv:**
2023-08-06 15:39:06 +08:00
✅ 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
2023-08-06 13:37:16 +08:00
2023-08-06 15:08:11 +08:00
9. **The ultimate deployment experience 🤖**
2023-08-06 13:37:16 +08:00
2023-08-06 15:33:48 +08:00
✅ Supports [cluster deployment](https://github.com/OpenIMSDK/Open-IM-Server/edit/main/deployments/README.md)
2023-08-06 13:37:16 +08:00
2023-08-06 15:08:11 +08:00
✅ 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.
2023-08-06 13:37:16 +08:00
2023-08-06 15:39:06 +08:00
11. **A large ecosystem of open source communities 🤲**
2023-08-06 13:37:16 +08:00
2023-08-06 15:08:11 +08:00
✅ We have tens of thousands of users and many solutions to problems.
2023-08-06 15:39:06 +08:00
2023-08-06 15:08:11 +08:00
✅ 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.
2023-08-06 13:37:16 +08:00
## :rocket: Quick Start
<details> <summary>Deploying with Docker Compose</summary>
1. Clone the project
2023-07-26 18:50:50 +08:00
```bash
# choose what you need
2023-08-06 13:37:16 +08:00
BRANCH=release-v3.1
2023-07-26 18:50:50 +08:00
git clone -b $BRANCH https://github.com/OpenIMSDK/Open-IM-Server openim && export openim=$(pwd)/openim && cd $openim && make build
```
2023-08-06 13:37:16 +08:00
> **Note**
> Read our release policy: https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/version.md
2023-08-06 15:33:48 +08:00
2. Modify `.env`
2023-07-26 18:50:50 +08:00
```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
```
2023-07-26 18:50:50 +08:00
3. Deploy and start
2023-07-26 17:28:35 +08:00
> **Note**
2023-08-06 13:37:16 +08:00
> 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.
2023-08-06 15:33:48 +08:00
```bash
2023-07-26 18:50:50 +08:00
make install
```
2023-07-26 18:50:50 +08:00
4. Check the service
2023-07-26 18:50:50 +08:00
```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)
2023-08-06 13:37:16 +08:00
</details>
2023-08-06 13:37:16 +08:00
<details> <summary>Compile from Source</summary>
2023-07-26 18:50:50 +08:00
Ur need `Go 1.18` or higher version, and `make`.
2023-07-31 15:37:46 +08:00
Version Details: https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/version.md
2023-07-26 18:50:50 +08:00
```bash
# choose what you need
2023-07-31 15:37:46 +08:00
BRANCH=release-v3.1
2023-07-26 18:50:50 +08:00
git clone -b $BRANCH https://github.com/OpenIMSDK/Open-IM-Server openim && export openim=$(pwd)/openim && cd $openim && make build
```
2023-08-06 13:37:16 +08:00
2023-07-26 17:28:35 +08:00
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.
2023-06-29 22:35:31 +08:00
All services have been successfully built as shown in the figure
2023-06-29 22:35:31 +08:00
![Successful Compilation](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/images/build.png)
2023-06-29 22:35:31 +08:00
2023-08-06 13:37:16 +08:00
</details>
<details> <summary>Component Configuration Instructions</summary>
2023-06-29 22:35:31 +08:00
The config/config.yaml file has detailed configuration instructions for the storage components.
2023-06-29 22:35:31 +08:00
- Zookeeper
2023-06-29 22:35:31 +08:00
- Used for RPC service discovery and registration, cluster support.
2023-06-29 22:35:31 +08:00
2023-08-06 13:37:16 +08:00
```bash
zookeeper:
schema: openim #Not recommended to modify
address: [ 127.0.0.1:2181 ] #address
username: #username
password: #password
```
2023-06-29 22:35:31 +08:00
- MySQL
2023-06-29 22:35:31 +08:00
- Used for storing users, relationships, and groups, supports master-slave database.
2023-08-06 13:37:16 +08:00
```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)
```
2023-06-29 22:35:31 +08:00
- Mongo
- Used for storing offline messages, supports mongo sharded clusters.
2023-08-06 13:37:16 +08:00
```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
```
2023-06-29 22:35:31 +08:00
- Redis
- Used for storing message sequence numbers, latest messages, user tokens, and mysql cache, supports cluster deployment.
2023-08-06 13:37:16 +08:00
```bash
redis:
address: [ 127.0.0.1:16379 ] #address
username: #username
password: openIM123 #password
```
2023-06-29 22:35:31 +08:00
- Kafka
- Used for message queues, for message decoupling, supports cluster deployment.
2023-08-06 13:37:16 +08:00
```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
```
2023-08-06 13:37:16 +08:00
</details>
<details> <summary>Start and Stop Services</summary>
Start services
```
2023-08-06 13:37:16 +08:00
./scripts/start_all.sh;
```
Check services
```
2023-08-06 13:37:16 +08:00
./scripts/check_all.sh
```
Stop services
```
2023-08-06 13:37:16 +08:00
./scripts/stop_all.sh
```
2023-08-06 13:37:16 +08:00
</details>
<details> <summary>Open IM Ports</summary>
2023-06-29 22:35:31 +08:00
| 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 |
2023-06-29 22:35:31 +08:00
2023-08-06 13:37:16 +08:00
</details>
<details> <summary>Open Chat Ports</summary>
+ chat warehouse: https://github.com/OpenIMSDK/chat
2023-06-29 22:35:31 +08:00
| 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 |
2023-06-29 22:35:31 +08:00
2023-08-06 13:37:16 +08:00
</details>
2023-06-29 22:35:31 +08:00
2023-08-06 13:37:16 +08:00
## :link: Relationship Between APP and OpenIM
2023-06-29 22:35:31 +08:00
2023-08-06 13:37:16 +08:00
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.
2023-06-29 22:35:31 +08:00
2023-08-06 13:37:16 +08:00
![App-OpenIM Relationship](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/images/open-im-server.png)
2023-06-29 22:35:31 +08:00
2023-08-06 13:37:16 +08:00
## :building_construction: Overall Architecture
2023-06-29 22:35:31 +08:00
2023-08-06 13:37:16 +08:00
Delve into the heart of Open-IM-Server's functionality with our architecture diagram.
2023-05-11 23:35:26 +08:00
2023-08-06 13:37:16 +08:00
![Overall Architecture](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/images/Architecture.jpg)
2023-05-11 23:35:26 +08:00
2023-08-06 13:37:16 +08:00
## :hammer_and_wrench: To start developing OpenIM
2023-04-28 13:21:33 +08:00
2023-08-06 15:08:11 +08:00
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).
2023-04-28 13:21:33 +08:00
2023-08-06 15:08:11 +08:00
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.
2023-05-11 23:35:26 +08:00
2023-08-06 15:08:11 +08:00
- [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)
2023-05-11 23:35:26 +08:00
2023-08-06 13:37:16 +08:00
## :calendar: Community Meetings
2023-05-11 23:35:26 +08:00
2023-08-06 15:08:11 +08:00
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.
2023-08-06 13:37:16 +08:00
2023-08-06 15:08:11 +08:00
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
2023-08-06 13:37:16 +08:00
2023-08-06 15:08:11 +08:00
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).
2023-08-06 13:37:16 +08:00
2023-08-06 15:08:11 +08:00
## :eyes: Who are using OpenIM
2023-05-10 23:40:41 +08:00
2023-08-06 15:08:11 +08:00
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.
2023-04-28 13:29:44 +08:00
2023-08-06 13:37:16 +08:00
## :page_facing_up: License
2023-08-06 15:08:11 +08:00
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.
2023-08-06 13:37:16 +08:00
2023-08-06 15:08:11 +08:00
## 🔮 Thanks to our contributors!
2023-06-29 22:35:31 +08:00
2023-08-06 15:08:11 +08:00
<a href="https://github.com/OpenIMSDK/Open-IM-Server/graphs/contributors">
<img src="https://contrib.rocks/image?repo=OpenIMSDK/Open-IM-Server" />
</a>