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.yaml | Need to restart components, IM, and Chat | | SECRET | openim-server/config/config.yaml, chat/config/config.yaml | Need 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๐Ÿ”