Go to file
withchao 5f6b2b7f9d
chore: tools, pb replaced by public warehouse (#662)
* fix: StringValue When there are double quotes in the string value, serialization and deserialization fail

Signed-off-by: withchao <993506633@qq.com>

* test: StatusTemporaryRedirect -> StatusFound

Signed-off-by: withchao <993506633@qq.com>

* chore: pb a2r

Signed-off-by: withchao <993506633@qq.com>

* chore: replacement package

Signed-off-by: withchao <993506633@qq.com>

* chore: replacement package

Signed-off-by: withchao <993506633@qq.com>

* chore: replacement package

Signed-off-by: withchao <993506633@qq.com>

* fix: remove go mod replace

Signed-off-by: withchao <993506633@qq.com>

* fix: tools version

Signed-off-by: withchao <993506633@qq.com>

* fix: config.yaml

Signed-off-by: withchao <993506633@qq.com>

---------

Signed-off-by: withchao <993506633@qq.com>
2023-07-25 12:13:32 +00:00
.docker-compose_cfg feat: add license 2023-07-10 18:13:30 +08:00
.github feat: add file: (#650) 2023-07-25 01:25:51 +00:00
CHANGELOG feat: add scripts (#525) 2023-07-13 11:37:23 +08:00
assets fix: delete batch build all file (#561) 2023-07-21 13:20:23 +00:00
cmd chore: tools, pb replaced by public warehouse (#662) 2023-07-25 12:13:32 +00:00
config chore: tools, pb replaced by public warehouse (#662) 2023-07-25 12:13:32 +00:00
deployments feat: add deployments readme file 2023-07-10 18:13:30 +08:00
docs fix: actions milestones auto (#642) 2023-07-24 13:06:16 +00:00
internal chore: tools, pb replaced by public warehouse (#662) 2023-07-25 12:13:32 +00:00
pkg chore: tools, pb replaced by public warehouse (#662) 2023-07-25 12:13:32 +00:00
scripts fix: actions milestones auto (#642) 2023-07-24 13:06:16 +00:00
test fix: delete batch build all file (#561) 2023-07-21 13:20:23 +00:00
.dockerignore feat: add test file 2023-07-13 17:07:45 +08:00
.env fix: delete batch build all file (#561) 2023-07-21 13:20:23 +00:00
.gitignore fix: delete batch build all file (#561) 2023-07-21 13:20:23 +00:00
.golangci.yml fix: actions milestones auto (#642) 2023-07-24 13:06:16 +00:00
.goreleaser.yaml fix: delete batch build all file (#561) 2023-07-21 13:20:23 +00:00
CHANGELOG.md feat: add link file 2023-07-10 18:19:25 +08:00
CONTRIBUTING.md docs: fix lint update CONTRIBUTING.md (#632) 2023-07-22 13:04:01 +00:00
Dockerfile feat: Add light mode and dark mode.(#89) (#558) 2023-07-14 08:17:59 +00:00
LICENSE v3 - main to cut out 2023-06-29 22:35:31 +08:00
Makefile fix: delete batch build all file (#561) 2023-07-21 13:20:23 +00:00
README-zh_CN.md update readme: With the release of the new system, the readme is also updated accordingly. 2023-07-17 21:18:34 +08:00
README.md fix: delete batch build all file (#561) 2023-07-21 13:20:23 +00:00
docker-compose.yaml fix: release 3.0 2023-07-14 22:10:01 +08:00
go.mod chore: tools, pb replaced by public warehouse (#662) 2023-07-25 12:13:32 +00:00
go.sum chore: tools, pb replaced by public warehouse (#662) 2023-07-25 12:13:32 +00:00
init_docker.sh fix: delete batch build all file (#561) 2023-07-21 13:20:23 +00:00
install_guide.sh fix: script v3.0 2023-07-14 21:39:30 +08:00

README.md

Open source Instant Messaging Server

A+ good first

English 中文

What is Open-IM-Server

Open-IM-Server is an instant messaging server developed using pure Golang, adopting JSON over WebSocket as the communication protocol. In Open-IM-Server, everything is a message, so you can easily extend custom messages without modifying the server code. With a microservice architecture, Open-IM-Server can be deployed using clusters. By deploying Open-IM-Server on a server, developers can quickly integrate instant messaging and real-time networking features into their applications, ensuring the security and privacy of business data.

Open-IM-Server is not a standalone product and does not include account registration and login services. For your convenience, we have open-sourced the chat repository which includes login and registration functionality. By deploying the chat business server alongside Open-IM-Server, a chat product can be set up.

Features

  • Open source
  • Easy to integrate
  • Excellent scalability
  • High performance
  • Lightweight
  • Supports multiple protocols

Community

Quick Start

Deploying with docker-compose

  1. Clone the project
clone https://github.com/OpenIMSDK/Open-IM-Server 
cd Open-IM-Server
git checkout release-v3.0 #or other release branch
  1. Modify .env
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
  1. 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.

chmod +x install_im_server.sh;
./install_im_server.sh;
  1. Check the service
cd scripts;
./docker_check_service.sh

https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/images/docker_build.png

Compile from source

  1. Go 1.18 or higher version.

  2. Clone

    git clone https://github.com/OpenIMSDK/Open-IM-Server 
    cd Open-IM-Server
    git checkout release-v3.0 #or other release branch
    
  3. Compile

    cd Open-IM-server/scripts
    chmod +x *.sh
    ./build_all_service.sh
    

All services have been successfully built as shown in the figure

Successful Compilation

Component Configuration Instructions

The config/config.yaml file has detailed configuration instructions for the storage components.

  • Zookeeper

    • Used for RPC service discovery and registration, cluster support.

      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.

      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.

      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.

      redis:
        address: [ 127.0.0.1:16379 ]            #address
        username:                               #username
        password: openIM123                     #password
      
  • Kafka

    • Used for message queues, for message decoupling, supports cluster deployment.

      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
      

Start and Stop Services

Start services

./start_all.sh;

Check services

./check_all.sh

Stop services

./stop_all.sh

Open IM Ports

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

Open Chat Ports

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

Relationship Between APP and OpenIM

OpenIM is an open source instant messaging component, it is not an independent product. This image shows the relationship between AppServer, AppClient, Open-IM-Server and Open-IM-SDK.

https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/open-im-server.png

Overall Architecture

https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/Architecture.jpg

To start developing OpenIM

The community repository hosts all information about building Kubernetes from source, how to contribute code and documentation, who to contact about what, etc.

Contributing

Contributions to this project are welcome! Please see CONTRIBUTING.md for details.

Community Meetings

We want anyone to get involved in our community, we offer gifts and rewards, and we welcome you to join us every Thursday night.

We take notes of each biweekly meeting in GitHub discussions, and our minutes are written in Google Docs.

Who are using Open-IM-Server

The user case studies page includes the user list of the project. You can leave a 📝comment to let us know your use case.

avatar

License

Open-IM-Server is under the Apache 2.0 license. See the LICENSE file for details