Building and running the IBM IoT MessageSight messaging server Docker image
Build and deploy the IBM® IoT MessageSight messaging server Docker image and start the IBM IoT MessageSight messaging server Docker container. The IBM IoT MessageSight messaging server handles connected clients and devices, and processes messages.
Before you begin
- Ensure that you have access to a yum repository so that you can use the Dockerfile in the .tz file to build the Docker image.
- Ensure that core files can be redirected to a known location. For more information about how to redirect core files, see Core file redirection.
Procedure
-
Build the messaging server Docker image.
-
In the imaserver subdirectory, rename the IBMIoTMessageSightServer-<build_info>.rpm file to imaserver.rpm by entering the following command:
mv IBMIoTMessageSightServer-<build_info>.rpm imaserver.rpm -
If you are not logged in as the root user, enter the following command:
Issuing this command enables you to run subsequent commands without having to specifysudo shsudo -
If your host OS is Red Hat, you need to modify the Dockerfile.
Change "FROM centos:latest" to "FROM rhel:latest".
-
Build the IBM IoT MessageSight
imaserver Docker image by entering the following command:
Ensure that you include the period at the end of the command.docker build --force-rm=true -t imaserver:2.0 .This command builds the Docker container by using the Dockerfile, installs the imaserver.rpm, applies additional RPMs to the container, and updates any existing RPMs in the container. Successful completion of the command is indicated by output that is similar to the following line:Successfully built 3017eae88d88 -
Confirm that the IBM IoT MessageSight
imaserver Docker image has been built successfully by entering the
following command:
and look for output that is similar to the following line:docker imagesimaserver 2.0 0952b6b30178 2 seconds ago
-
In the imaserver subdirectory, rename the IBMIoTMessageSightServer-<build_info>.rpm file to imaserver.rpm by entering the following command:
-
Create a .tar file of the image so that you can deploy the IBM IoT MessageSight messaging server on other
hosts by entering the following command:
docker save -o ./imaserver-2.0-dockerimage.tar imaserver:2.0 -
Start the IBM IoT MessageSight messaging server by entering the following command:
where:docker run --cap-add SYS_ADMIN --net=host -P -it --name IMA --env-file=IBMIoTMessageSightServer-docker.env -m <memory_size> -v <data_volume> -d imaserver:2.0- <memory_size>
- The amount of memory available to the container. The minimum value is 4 GB. You can, however, specify a value that is as high as the available memory on the host.
- <data_volume>
- The external data volume to which the /var/messagesight directory is to be mapped. Mapping the directory to an external data volume is required so that data can be persisted over container updates. For information about using data volumes in Docker, see Managing data in containers.
This command creates and starts the IBM IoT MessageSight messaging server Docker container.
The following table shows the environment variables that are in the IBMIoTMessageSightServer-docker.env file. You can set the environment variables and include them in the IBMIoTMessageSightServer-docker.env file and include the file in thedocker runcommand or you can specify them separately in the command by using the-eargument on the command.Table 1. IBM IoT MessageSight messaging server container environment variables Environment variable name Required? Description MESSAGESIGHT_CONTAINER_NAME Required IBM IoT MessageSight messaging server Docker container name. MESSAGESIGHT_MEMORY_SIZE Required Amount of memory, in GB, for use by the IBM IoT MessageSight messaging server. The minimum value is 4 GB. MESSAGESIGHT_NO_CPUS Optional Number of CPUs to be used for the container. The value of this environment variable should match the value of the --cpuset-cpusargument of thedocker runcommand.MESSAGESIGHT_ADMIN_HOST Optional IP address of the admin endpoint. The default is AllMESSAGESIGHT_ADMIN_PORT Optional Port number of the admin endpoint. The default is 9089. -
Verify that the IBM IoT MessageSight messaging server container is running by entering the following command:
docker ps- Optional:
To reconfirm that your browser has access to the messaging server container, load this URL in your web browser:
https://<IP_Address>:9089>where IP_Address is the IP address of the host where the server is installed.
- Optional:
To reconfirm that your browser has access to the messaging server container, load this URL in your web browser:
-
If you are not logged in as the root user, enter the following command to exit from the sudo shell that you created at step 1.b:
exit - Set the licensed usage and accept the license agreement. For more information about using a REST Administration API to set the licensed usage and accept the license agreement, see Configuring the licensed usage for IBM IoT MessageSight and accepting the license by using REST Administration APIs.