Universal Messaging as a Docker container

Docker support in Universal Messaging:

From UM 9.10 version onwards there was Docker support in UM i.e,

A Universal Messaging Packaging Kit for Docker is part of the standard Universal Messaging installation on Linux.
The Kit is present at <SAG_Install_Folder>/UniversalMessaging/server/<UM_Instance_Name>/bin/docker

The Kit includes,

  • Dockerfile for creating Docker images from UM installation on linux.
  • Samples showing how to start the Universal Messaging server from the Docker image and run the sample applications of Universal Messaging within the image.

From UM 10.3 onwards, There are two different things regarding docker support in UM. i.e,

Official Universal Messaging docker images at Docker Hub:

There are official Universal Messaging images present at Software AG repository in Docker Hub.
These are the images that Software AG builds, tests and promotes on regular basis.

There are two images i.e,

  • Software AG Universal Messaging Server: Docker Hub.
    This image contains UM server and UM administration and monitoring tools which are available in tools image.

  • Software AG Universal Messaging Tools : Docker Hub.
    This image contains just the tools for command line administration and monitoring of Universal Messaging.

Docker hub will contain the latest UM images with latest fix. They are available from 10.3 version onwards.

Docker scripts on Github:

Using the docker scripts present at github Users can build their own Universal Messaging docker image to run the UM in a container. These scripts are like template for building UM images. There is enough documentation present to try it out. These docker scripts use Centos as Base image.

From 10.11 onwards we have Support for creating Docker images for Universal Messaging using Software AG Installer

Users can use Software AG Installer to create Docker images for a Universal Messaging server on Linux operating systems. The Installer client creates a Docker image with a Universal Messaging server entry point and support for command-line tools similar to the images provided in the Software AG repository on Docker Hub. For a detailed description of this feature with usage examples, see the documentation about creating Docker images with Software AG Installer on Linux in the Using Software AG Installer guide.

Some useful UM Docker information:

  • After running the um container using UM official image. We can check the logs of UM Container which contains information from nirvana.log and UMRealmService.log file with the following command.

      	docker logs <ContainerID/ContainerName>
    

    The output will be like:

      [UMRealmService.log]: INFO   | jvm 1    | 2021/12/27 10:32:54 | Plugin Class Loader Loading file:/opt/softwareag/UniversalMessaging/lib/umTransport.jar
      [UMRealmService.log]: INFO   | jvm 1    | 2021/12/27 10:32:54 | Plugin Class Loade[nirvana.log]: [Mon Dec 27 10:32:54.404 UTC 2021] [main]   Copyright (c) Software AG Limited. All rights reserved
      [nirvana.log]: [Mon Dec 27 10:32:54.635 UTC 2021] [ServerStarterThread] Licence expiry checked OK : 2022/03/26
      [nirvana.log]: [Mon Dec 27 10:32:54.636 UTC 2021] [ServerStarterThread] Licence product code checked OK : NUMWF
    
  • We are trying to run a UM container and it created the container but the container is not running. Sometimes, Logs alone might not be useful here to figure out why it’s not running. To examine what has happened inside container we need the environment. By using docker export command, we can get the UM container environment. Which we can extract later to check the environment. The following commands will export the container to tar file and extract to a specific folder.

      docker export -o <tarFileName>.tar <UMContainerName>
      mkdir ContainerTarFileContents
      tar -xvf <tarFileName>.tar -C ContainerTarFileContents
    
  • To pull the docker images from dockerhub, You need to first login to dockerhub with user credentials and then you can pull the image.

      > docker login
      	<Provide the docker hub credentials>
      
      > docker pull store/softwareag/universalmessaging-server:10.11
      	<This will pull the image from Docker hub>
    
  • Inside docker container the Universal Messaging run on port number 9000, To expose the port number to the outside, We need to map the port with -p option. i.e.,

      > docker run -d -p 9000:9000 --name <UMContainerName> store/softwareag/universalmessaging-server:10.11
    
  • Command to run the UM in a container with named volumes

      > docker run -d 
      -v datadir:/opt/softwareag/UniversalMessaging/server/umserver/data 
      -v logdir:/opt/softwareag/UniversalMessaging/server/umserver/logs 
      -v licdir:/opt/softwareag/UniversalMessaging/server/umserver/licence 
      -v userdir:/opt/softwareag/common/conf 
      -p 9001:9000 
      --name umcontainer_one 
      store/softwareag/universalmessaging-server:10.5
    
  • To login to the UM container which is running, We can use following command:

      > docker exec -it <ContainerID/Container Name> bash
      	<You will login as sagadmin user>
    
  • Users can set the environment variables for a realm server container during container creation. This is optional.
    Users can set it using -e option.

      > docker run -e REALM_NAME=umtest -e INIT_JAVA_MEM_SIZE=2048 -e MAX_JAVA_MEM_SIZE=2048
      -e MAX_DIRECT_MEM_SIZE=3G -e BASIC_AUTH_ENABLE=Y -e BASIC_AUTH_MANDATORY=Y -e 
      STARTUP_COMMAND="runUMTool.sh CreateChannel -channelname=test -rname=nsp://localhost:9000" 
      -p 9000:9000 --name <UMContainerName> <UMImageName>
      
      Note: REALM_NAME once this value and set and persisted, We can't modify it. 
    
  • While using the docker script present at Github. If you want to build the image for different instance other than umserver.
    By default the docker script will look for umserver instance and build the image from that instance. But we can build the image for different
    instance by providing the build time argument i.e.

      > docker build  --build-arg __instance_name=<UMInstanceNameFromInstallation> --tag universalmessaging-server:dev_image .