Skip to main content

🛠 Source Code Deployment

1. Environment and Component Requirements

For server environment, system, and dependent component details, please refer to this document.

2. Deploying OpenIM Server (IM)

2.1 Clone the repository using the main branch or switch to the release-v3.7 or later release branches

git clone https://github.com/openimsdk/open-im-server && cd open-im-server

2.2 Deploy Components (mongodb/redis/zookeeper/kafka/MinIO, etc.)

docker compose up -d

2.3 Set External IP. If using a domain name, Nginx configuration is required.

Modify the `externalAddress` in `config/minio.yml` to `http://external_IP:port` or a domain name.
Modify the `grafanaURL` in `config/openim-api.yml` to `http://ExternalIP:port` or a domain name.

2.4 🛠️ Initialization

Before the first compilation, execute on Linux/Mac platforms:

bash bootstrap.sh

On Windows execute:

bootstrap.bat

2.5 🛠️ Compilation (available on Linux/Windows/Mac platforms)

mage

2.6 🚀 Start/Stop/Check (available on Linux/Windows/Mac platforms)

# Start
mage start
# Start in background and collect logs
nohup mage start >> _output/logs/openim.log 2>&1 &
# Stop
mage stop
# Check
mage check

2.7 Modify Other Configuration Items

See linked documentation

3. Deploying App Server (Chat)

3.1 Clone the repository using the main branch or switch to release-v1.7 or later release branches

git clone https://github.com/openimsdk/chat && cd chat

3.2 🛠️ Initialization

Before the first compilation, execute on Linux/Mac platforms:

bash bootstrap.sh

On Windows execute:

bootstrap.bat

3.3 🛠️ Compilation (available on Linux/Windows/Mac platforms)

mage

3.4 🚀 Start/Stop/Check (available on Linux/Windows/Mac platforms)

# Start
mage start
# Start in background and collect logs
nohup mage start >> _output/logs/chat.log 2>&1 &
# Stop
mage stop
# Check
mage check

3.5 Modify Other Configuration Items

See linked documentation



For deployment of release-v3.6 and earlier versions

2. Deploy OpenIM Server (IM)

2.1 📡 Set OPENIM_IP

🔔 It is mandatory to set OPENIM_IP, and it cannot be 127.0.0.1

# If the server has an external IP
export OPENIM_IP="external IP"

# If providing only internal network services
export OPENIM_IP="internal IP"

2.2 🏗️ Deploy Components (mongodb/redis/zookeeper/kafka/MinIO, etc.)

git clone https://github.com/OpenIMSDK/open-im-server && cd open-im-server 
# It is recommended to switch to the release-v3.6 or later release branches
make init && docker compose up -d

2.3 🛠️ Compilation

make build

2.4 🚀 Start/Stop/Check

# Start
make start
# Stop
make stop
# Check
make check


3. Deploying App Server (Chat)

3.1 🏗️ Clone chat repository

#Return to the previous directory
cd ..
# Clone repository, it is recommended to switch to release-v1.6 or later release branches
git clone https://github.com/OpenIMSDK/chat chat && cd chat

3.2 🛠️ Compilation

make init
make build

3.3 🚀 Start/Stop/Check

# Start
make start
# Stop
make stop
# Check
make check

4. Quick Verification

Please refer to the Quick Verification document


5. Admin Panel and Monitoring System

Please refer to the Admin Panel and Monitoring System document.


6. About Configuring Items

6.1 🛠️ Modifying Common Configuration Items

Configuration ItemFile to be ModifiedAction
mongo/kafka/minio related.env, openim-server/config/config.yamlNeed to restart components and IM
redis/zookeeper related.env, openim-server/config/config.yaml, chat/config/config.yamlNeed to restart components, IM, and Chat
SECRETopenim-server/config/config.yaml, chat/config/config.yamlNeed to restart IM and Chat

6.2 🔄 Special Items in Common Configuration

Special configuration items: API_OPENIM_PORT/MINIO_PORT/OPENIM_IP/GRAFANA_PORT

  1. Modify the special configuration items in the .env file
  2. Modify the configuration in openim-server/config/config.yaml according to the rules
object:
apiURL: "http://$OPENIM_IP:$API_OPENIM_PORT"
minio:
endpoint: "http://$DOCKER_BRIDGE_GATEWAY:$MINIO_PORT"
signEndpoint: "http://$OPENIM_IP:$MINIO_PORT"

grafanaUrl: http://$OPENIM_IP:$GRAFANA_PORT
  1. Modify the configuration in chat/config/config.yaml according to the rules
If IM is not on the same machine as Chat, replace 127.0.0.1 with the IP of the machine where IM is located
openIMUrl: "http://127.0.0.1:$API_OPENIM_PORT"
  1. Restart IM and Chat

6.3 🛠️ Modifying Other Configuration Items

For other configuration items in .env, chat/config/config.yaml, and openim-server/config/config.yaml, you can modify these items individually in the respective files.

6.4 Modifying Ports

Especially note that any port modification related to IM also needs to be synchronized with the ports in open-im-server/scripts/install/environment.sh


7. Common Issues

7.1 📜 Viewing Logs

Log locations:

  • Runtime logs, to be viewed for problem resolution after successful startup: _output/logs/openim-all*
  • Startup logs, to be checked if there are errors during startup: _output/logs/openim-*.log

7.2 🚀 Startup Sequence

The startup sequence is as follows:

  • Components dependent on IM: mongo/redis/kafka/zookeeper/minio, etc.
  • IM
  • Chat

7.3 🐳 Docker Version

The new version of Docker has integrated docker-compose. Older versions of Docker may not support the gateway feature❌. We recommend upgrading to a newer version, such as 23.0.1🔝