Installation and deployment of im-cloud distributed middleware



  • Im-cloud builds distributed push middleware based on swoole native collaboration
  • Installation and deployment of im-cloud distributed middleware
  • IM-cloud <> GOIM distributed middleware concurrent pressure measurement comparison
  • Analysis of im-cloud distributed middleware (1) – Communication Protocol
  • Analysis of im-cloud distributed middleware (2) – Implementation of cloud node
  • Analysis of im-cloud distributed middleware (3) – Implementation of job node
  • IM-cloud Distributed Middleware Analysis (IV) – Logic Node Implementation

Installation methods are mainly providedDocker single node deployment Docker-compose automated orchestration deployment Manual deploymentThree ways to deploy the environment

I. docker deployment

The base mirror is small enough. Don’t worry.Base image + php7.2 + swoole 4 is 75M

Docker-compose network namespace is host mode, so you need to pay attention to the problem of local port conflicts, and you can also change the compose.yml configuration according to your environment.

1. Docker deployed separately

  • image

    • consul
    • redis
    • brewlin/cloud
    • brewlin/job
    • brewlin/logic
  • Start Consul
docker run --network host consul
  • Start redis
docker run --network host redis
  • Start cloud node
docker run --network host brewlin/cloud
  • Start job node
docker run --network host  brewlin/job
  • Start Logic Node
docker run --network host  brewlin/logic

2. docker-compose choreography service

git clone
cd im-cloud
docker-compose up

Manual deployment

Environmental requirements

  • swoole 4 +
  • php 7.2 +
  • console
  • rabbitmq
  • redis

1. Installation Dependence

Make scripts use composer to automatically install related components

cd path/im-cloud
make install

2. Start cloud nodes

cd path/im-cloud/app/cloud
php bin/app

3. Start Logic Node

cd path/im-cloud/app/logic;
php bin/app

4. Start job node

cd path/im-cloud/app/job;
php bin/app

5. Install and start Consul

1. Log on to the official website for download and download address


2. Setting environment variables, if not set, you can directly move consul execution files to / usr / bin directory

mv consul /usr/bin

3. Single-machine configuration. This method is suitable for building service debugging.

consul agent -bootstrap-expect 1 -server -data-dir /data/consul -node=cloud -bind= -config-dir /etc/consul.d -enable-script-checks=true -datacenter=dc1 -client= -ui

Service information can be viewed at

6. Install rabbitmq

  • 1. Add new sources
echo 'deb testing main' |
     sudo tee /etc/apt/sources.list.d/rabbitmq.list
  • 2. Download public key
wget -O- |
     sudo apt-key add -
  • 3. Update & Installation
sudo apt-get update
sudo apt-get install rabbitmq-server
  • 4. Modify configuration files
cd /etc/rabbitmq/
new file
touch rabbitmq.config

Add in the configuration file

[{rabbit, [{loopback_users, []}]}].
  • 5. State Management
Rabbitmqctl status allows you to view the status of rabbitmq
  • 6. Open Web Management Interface
# Open rabbitmq web interface
Host]# rabbitmq-plugins enable rabbitmq_management
    The following plugins have been enabled:
  • 7. Creating Users
Host]# rabbitmqctl add_user xiaodo xiaodo
    Creating user "admin"
Host]# rabbitmqctl set_user_tags xiaodo administrator
    Setting tags for user "admin" to [administrator]

III. Testing

  • 1. Register to cloud using demo provided by JS SDK
  • http://host:9600/im/push/mids?mids=123&operation=9&msg=pushtestSingle push