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

  1. Build the messaging server Docker image.
    1. 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
    2. If you are not logged in as the root user, enter the following command:
      sudo sh
      Issuing this command enables you to run subsequent commands without having to specify sudo
    3. If your host OS is Red Hat, you need to modify the Dockerfile.
      Change "FROM centos:latest" to "FROM rhel:latest".
    4. Build the IBM IoT MessageSight imaserver Docker image by entering the following command:
      docker build --force-rm=true -t imaserver:2.0 .
      Ensure that you include the period at the end of the command.
      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
    5. Confirm that the IBM IoT MessageSight imaserver Docker image has been built successfully by entering the following command:
      docker images
      and look for output that is similar to the following line:
      imaserver     2.0    0952b6b30178    2 seconds ago
  2. 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
  3. Start the IBM IoT MessageSight messaging server by entering the following command:
    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
    where:
    <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 the docker run command or you can specify them separately in the command by using the -e argument 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-cpus argument of the docker run command.
    MESSAGESIGHT_ADMIN_HOST Optional IP address of the admin endpoint. The default is All
    MESSAGESIGHT_ADMIN_PORT Optional Port number of the admin endpoint. The default is 9089.
  4. Verify that the IBM IoT MessageSight messaging server container is running by entering the following command:
    docker ps
    1. 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.

  5. 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
  6. 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.

What to do next

You can create and run an IBM IoT MessageSight Web UI Docker image that you can use to administer the IBM IoT MessageSight messaging server. For more information, see Building and running the IBM IoT MessageSight Web UI Docker image.