Docker Deployment for OpenIM
๐ Environment Preparationโ
- Install Docker with the Compose plugin or docker-compose on your server. For installation details, visit the Docker Compose Installation Guide.
๐๏ธ Repository Cloningโ
git clone https://github.com/openimsdk/openim-docker
๐ง Configuration Modificationโ
Modify the
.env
file to set up the external IP. If using a domain name, Nginx configuration is required.# Set the external access address for MinIO service (external IP or domain)
MINIO_EXTERNAL_ADDRESS="http://external_ip:10005"
# Set the external access address for Grafana service (external IP or domain)
GRAFANA_URL="http://external_ip:13000/"Please refer to the comments in the .env file for other configurations.
๐ Service Launchโ
- To start the service:
docker compose up -d
- To stop the service:
docker compose down
- To view logs:
docker logs -f openim-server
docker logs -f openim-chat
โก Quick Experienceโ
For a quick experience with OpenIM services, please visit the Quick Test Server Guide.
Below are the deployment processes for versions release-v3.6 and earlier:โ
๐ Docker Deployment
1. Environment and Component Requirementsโ
For server environment, system, and storage components, refer to this document.
2. Docker Deploymentโ
2.1 Clone Repository and Initializeโ
git clone https://github.com/openimsdk/openim-docker openim-docker && cd openim-docker && make init
๐ก Tips
If you obtained openim-docker not by cloning but by downloading a zip file, run the command find ./ -name "*.sh" | xargs chmod +x to grant script execution permissions.
2.2 Set OPENIM_IPโ
๐ You must set OPENIM_IP, and it cannot be 127.0.0.1
# If the server has an external IP
export OPENIM_IP="external IP"
# If only providing internal network service
export OPENIM_IP="internal IP"
2.3 Start Service and View Logsโ
docker compose up -d
docker ps
docker compose logs -f openim-chat
docker compose logs -f openim-server
3. Quick Verificationโ
Please refer to the Quick Verification document.
4. Admin Panel and Monitoring Systemโ
Please refer to the Admin Panel and Monitoring System document.
5. About Configuration Modificationโ
This project has complex configuration items, primarily because some settings involve .env
, openim-chat/config/config.yaml
, and openim-server/config/config.yaml
multiple files. The explanation for modifying configuration items is divided into two parts: shared configuration items and other configuration items.
5.1 Shared Configuration Itemsโ
Shared configuration items across .env
, openim-chat/config/config.yaml
, and openim-server/config/config.yaml
:
- MySQL/Mongo/Redis/Kafka/Zookeeper/MinIO ports and passwords;
- SECRET;
- API_OPENIM_PORT;
- OPENIM_IP;
- MINIO_PORT;
- GRAFANA_PORT
5.2 Modification Methodsโ
For modifying shared configuration items, choose one of the following methods:
Method One: Regenerate all configurations
If a comprehensive update of configurations is needed, follow these steps:
- Delete existing configuration files: Remove
openim-server/config/config.yaml
andopenim-chat/config/config.yaml
files. - Modify the
.env
file: Update relevant settings in the.env
file. - Regenerate configurations and restart service: Execute
docker compose down ; docker compose up -d
, which will regenerate configuration files based on the new settings in the.env
file and restart the service.
Method Two: Modify multiple configuration files separately
If only a partial update is needed, follow these steps:
- Modify the
.env
file: Update relevant settings in the.env
file. - Manually update configuration files: According to modifications in the
.env
file, update corresponding settings inopenim-server/config/config.yaml
andopenim-chat/config/config.yaml
files
.
3. Special variable additional handling: If you modified OPENIM_IP
, API_OPENIM_PORT
, MINIO_PORT
, GRAFANA_PORT
, then you need to update the following configuration items in openim-server/config/config.yaml
:
```yaml
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
```
- Restart the service: Execute
docker compose down ; docker compose up -d
to apply changes and restart the service.
5.3 Other Configuration Item Modificationโ
For non-shared variables in .env
, openim-chat/config/config.yaml
, and openim-server/config/config.yaml
, you can individually modify these configuration items in the respective files. Execute docker compose down ; docker compose up -d
to apply changes and restart the service.
โ 6. Common Issuesโ
6.1 Text messages are sent normally, but sending pictures fails ๐โ
This may be because the OPENIM_IP
environment variable was not set before executing the docker compose up -d
command. You can confirm this by checking the startup logs or by using the following command to search for "127.0.0.1" in the logs:
grep "127.0.0.1" openim-server/_output/logs/openim-docker.log
Solution:โ
Set the
OPENIM_IP
environment variable to your public IP address, or to your internal IP address if only providing internal network service:export OPENIM_IP="<Public-IP>"
Use the
sed
command to update theapiURL
andsignEndpoint
configuration items in theconfig.yaml
file, changing the address to use theOPENIM_IP
environment variable specified IP address:sed -i -e "s/apiURL: \"http:\/\/127\.0\.0\.1/apiURL: \"http:\/\/${OPENIM_IP}/" \
-e "s/signEndpoint: \"http:\/\/127\.0\.0\.1/signEndpoint: \"http:\/\/${OPENIM_IP}/" \
openim-server/config/config.yaml
After making these configuration changes and restarting the service, you should be able to send picture messages normally.
6.2 About Docker Versions ๐โ
It is strongly recommended to use the docker compose
command instead of docker-compose
, as older versions of Docker may not support the gateway featureโ. We advise upgrading to a newer version, such as 23.0.1
๐.
6.3 Viewing Logs ๐โ
Log locations:
- Runtime logs:
{openim-server, openim-chat}/_output/logs/openim-all.*
- Startup logs:
{openim-server, openim-chat}/_output/logs/openim-docker.log