Skip to main content

๐Ÿ›  Source Code Deployment

1. Environment and Component Requirementsโ€‹

For server environment, system, and storage components, refer to this document.


2. Deploying OpenIM Server (IM)โ€‹

2.1 ๐Ÿ“ก Setting OPENIM_IPโ€‹

๐Ÿ”” It is mandatory to set OPENIM_IP, and it cannot be 127.0.0.1

# If the server has a public IP
export OPENIM_IP="Public IP"

# If only providing internal network service
export OPENIM_IP="Internal IP"

2.2 ๐Ÿ—๏ธ Deploying Components (mongodb/redis/zookeeper/kafka/MinIO, etc.)โ€‹

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

2.3 ๐Ÿ› ๏ธ Compilingโ€‹

make build

2.4 ๐Ÿš€ Starting/Stopping/Checkingโ€‹

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

3. Deploying App Server (Chat)โ€‹

3.1 ๐Ÿ—๏ธ Deploying Components (mysql)โ€‹

# Return to the previous directory
cd ..
# Clone the repository. It's recommended to switch to the release-v1.5 or later release branches
git clone https://github.com/OpenIMSDK/chat chat && cd chat
# Deploy mysql
docker run -d --name mysql2 -p 13306:3306 -p 33306:33060 -v "$(pwd)/components/mysql/data:/var/lib/mysql" -v "/etc/localtime:/etc/localtime" -e MYSQL_ROOT_PASSWORD="openIM123" --restart always mysql:5.7

3.2 ๐Ÿ› ๏ธ Compilingโ€‹

make init
make build

3.3 ๐Ÿš€ Starting/Stopping/Checkingโ€‹

# 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 Modifying Configuration Itemsโ€‹

6.1 ๐Ÿ› ๏ธ Modifying Shared Configuration Itemsโ€‹

Configuration ItemFiles to ModifyOperation
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 ๐Ÿ”„ Modifying Special Shared Configuration Itemsโ€‹

Special configuration items: API_OPENIM_PORT/MINIO_PORT/OPENIM_IP/GRAFANA_PORT

  1. Modify the special configuration items in the .env file.
  2. Modify configurations in openim-server/config/config.yaml as per 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 configurations in chat/config/config.yaml as per rules:
If IM and Chat are not on the same machine, you need to replace 127.0.0.1 with the IP address of the machine where IM is located
openIMUrl: "http://172.28.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, these can be modified individually in the respective files.

6.4 Modifying Portsโ€‹

Especially note that any modification of IM-related ports 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, for troubleshooting after successful startup: logs/OpenIM.log.all.*
  • Startup logs, for checking in case of errors during startup: _output/logs/openim_*.log

7.2 ๐Ÿš€ Startup Sequenceโ€‹

The startup sequence is as follows:

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

7.3 ๐Ÿณโ€‹

Docker Version

The newer 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๐Ÿ”.