EventMesh Runtime with Docker
The documentation introduces the steps to install the latest release of EventMesh Runtime with Docker and connect to Apache RocketMQ. It’s recommended to use a Linux-based system with Docker Engine. Please follow the Docker tutorial to get familiar with the basic concepts (registry, volume, etc.) and commands of Docker.
1. Dependencies
64-bit OS,we recommend Linux/Unix;
64-bit JDK 1.8+;
Gradle 7.0+, we recommend 7.0.*
4g+ available disk to deploy eventmesh-store
If you choose standalone mode, you could skip this file and go to the next step: Start Eventmesh-Runtime; if not, you could choose RocketMQ as the store layer.
2. Pull EventMesh Image
Download the pre-built image of eventmesh from Docker Hub with docker pull
:
sudo docker pull eventmesh/eventmesh:v1.4.0
To verify that the eventmesh/eventmesh
image is successfully installed, list the downloaded images with docker images
:
$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
eventmesh/eventmesh v1.4.0 6e2964599c78 16 months ago 937MB
3. Edit Configuration
Edit the eventmesh.properties
to change the configuration (e.g. TCP port, client blacklist) of EventMesh Runtime. To integrate RocketMQ as a connector, these two configuration files should be created: eventmesh.properties
and rocketmq-client.properties
.
sudo mkdir -p /data/eventmesh/rocketmq/conf
cd /data/eventmesh/rocketmq/conf
sudo touch eventmesh.properties
sudo touch rocketmq-client.properties
4. Configure eventmesh.properties
The eventmesh.properties
file contains the properties of EventMesh runtime environment and integrated plugins. Please refer to the default configuration file for the available configuration keys.
sudo vim eventmesh.properties
Configuration Key | Default Value | Description |
---|---|---|
eventMesh.server.http.port | 10105 | EventMesh HTTP server port |
eventMesh.server.tcp.port | 10000 | EventMesh TCP server port |
eventMesh.server.grpc.port | 10205 | EventMesh gRPC server port |
5. Configure rocketmq-client.properties
The rocketmq-client.properties
file contains the properties of the Apache RocketMQ nameserver.
sudo vim rocketmq-client.properties
Please refer to the default configuration file and change the value of eventMesh.server.rocketmq.namesrvAddr
to the nameserver address of RocketMQ.
Configuration Key | Default Value | Description |
---|---|---|
eventMesh.server.rocketmq.namesrvAddr | 127.0.0.1:9876;127.0.0.1:9876 | The address of RocketMQ nameserver |
6. Run and Manage EventMesh Container
Run an EventMesh container from the eventmesh/eventmesh
image with the docker run
command. The -p
option of the command binds the container port with the host machine port. The -v
option of the command mounts the configuration files from files in the host machine.
sudo docker run -d -p 10000:10000 -p 10105:10105 \
-v `pwd`/data/eventmesh/rocketmq/conf/eventmesh.properties:/data/app/eventmesh/conf/eventmesh.properties \
-v `pwd`/data/eventmesh/rocketmq/conf/rocketmq-client.properties:/data/app/eventmesh/conf/rocketmq-client.properties \
eventmesh/eventmesh:v1.4.0
The docker ps
command lists the details (id, name, status, etc.) of the running containers. The container id is the unique identifier of the container.
$ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5bb6b6092672 eventmesh/eventmesh:v1.4.0 "/bin/sh -c 'sh star…" 5 seconds ago Up 3 seconds 0.0.0.0:10000->10000/tcp, :::10000->10000/tcp, 0.0.0.0:10105->10105/tcp, :::10105->10105/tcp eager_driscoll
As you can see from this message, the container id
is 5bb6b6092672
, and the `name
is eager_driscoll
, and they can both be used to uniquely identify this container. Note: On your computer, their values may be different from the ones here.
7. Managing EventMesh Containers
After successfully running an EventMesh container, you can manage the container by entering it, viewing logs, deleting it, and so on.
To connect to the EventMesh container:
sudo docker exec -it [container id or name] /bin/bash
To read the log of the EventMesh container:
tail -f ../logs/eventmesh.out
To stop or remove the container:
sudo docker stop [container id or name]
sudo docker rm -f [container id or name]
8. Explore more
Now that EventMesh is running through a container, you can refer to the eventmesh-examples module to write and test your own code.
I hope you enjoy the process and get more out of it!