DEV Community

skiffer-git
skiffer-git

Posted on

Deploy OpenIM using Docker

๐ŸŒŸ Environment Requirements

Considerations Details
Operating System Linux, ideally Ubuntu 22.04, root user
Hardware Resources At least 4GB RAM, for user volume <100,000, single machine deployment: 8C 16G 10Mb 1T regular disk
golang 1.18 and above
docker Docker version 24.0.5, build ced0996 or newer
git 2.17.1 and above

๐Ÿ“ฆ Storage Component Requirements

Storage Component Recommended Version
mongodb 6.0.2 and above
redis 7.0.0 and above
zookeeper latest
kafka latest
mysql 5.7 and above
minio latest

๐Ÿ›  1. Set Common Environment Variables

  • CHAT_BRANCH

    • Description: chat version
    • Default: release-v1.3
    • Consideration: Supports version 1.3 and above
    export CHAT_BRANCH="release-v1.3"
    
  • SERVER_BRANCH

    • Description: OpenIMServer version
    • Default: release-v3.3
    • Consideration: Supports version 3.3 and above
    export SERVER_BRANCH="release-v3.3"
    
  • PASSWORD

    • Description: Component password (mysql/mongodb/redis/minio)
    • Default: openIM123
    • Consideration: Password should be โ‰ฅ8 characters and without special characters
    export PASSWORD="openIM123"
    
  • USER

    • Description: Component username (mysql/mongodb/redis/minio)
    • Default: root
    export USER="root"
    
  • API_URL

    • Description: API address
    • Note: Automatically fetched if there's an external IP; for internal network, set it to the server IP
    export API_URL="http://ip:10002"
    
  • DATA_DIR

    • Description: Data volume directory
    • Default: ./
    export DATA_DIR="./"
    


๐Ÿ›  More Environment Variables

๐ŸŸข For a detailed understanding of various environment variables, please refer to this document.

โš ๏ธ Note: Variables set using export have higher priority than the ones in the script.


๐Ÿš€ 2. Pull and Launch Image

git clone https://github.com/openim-sigs/openim-docker openim/openim-docker && export openim=$(pwd)/openim && cd $openim/openim-docker && make init && docker compose up -d
Enter fullscreen mode Exit fullscreen mode

๐ŸŸข If your docker doesn't support compose, it's recommended to upgrade following this guide.

๐Ÿ“œ View Logs

docker compose logs openim-server
docker compose logs openim-chat
Enter fullscreen mode Exit fullscreen mode

๐ŸŸข More logs can be found at: openim-server/branch/logs/ and openim-chat/branch/logs

๐Ÿฉบ Check Health Status

docker ps
Enter fullscreen mode Exit fullscreen mode

docker-ps

3. Quick Verification

Please refer to the Quick Verification document.

โ“ Frequently Asked Questions ๐Ÿง


1. How to modify using external components? ๐Ÿ› ๏ธ

Example: Using external mysql๐Ÿ”—:

  • ๐Ÿ“ Edit docker-compose.yaml and comment out mysql configuration and its corresponding depends_on.
  • ๐Ÿ“ Edit scripts/install/environment.sh and change the mysql configuration.
  • ๐Ÿ’ป Run the command: make init
  • ๐Ÿš€ Run the command: docker compose up -d

2. Health status is starting? ๐ŸŸ 

Initially, before the health check, Docker's default status is startingโณ. Approximately after 1 minute, the status changes to healthyโœ….


3. Port Mapping ๐ŸŒ

Docker networks allow for user-defined settings๐Ÿ”ง. You can map ports as usual๐Ÿ”€.


4. About Docker Version ๐Ÿ‹

The new version of Docker has integrated docker-compose. Older versions of Docker might not support the gateway featureโŒ. It's recommended to upgrade to a newer version, such as 23.0.1๐Ÿ”.


About OpenIM

Open source, and universal instant messaging components

OpenIM includes server and client SDKs, achieving high performance, lightweight, and easy-to-extend features. Developers can integrate instant messaging and real-time networking capabilities quickly into their applications by integrating the OpenIM SDK and deploying the server privately, ensuring the security and privacy of business data.

Currently, the github star is over 12,000, including iOS, Android, Flutter, ReactNative, web, pc, and Uniapp platforms.

GitHub: https://github.com/openimsdk/open-im-server
Official Website: https://docs.openim.io/

Image description

Top comments (0)