Running Integration Server within a Docker container

Table of Contents [-]


Overview #

This article describes one of the ways in which you can create a Docker image from an installed and configured webMethods Integration Server and run the Docker image inside a Docker container.

The script and instructions contained in this article were validated on 64 bit GNU/Linux for Integration Server versions starting with 9.7 and up to and including 9.10.


Prerequisites #

  • You have some familiarity with the Docker technology.
  • You have Docker installed in your environment and it is running as a daemon. You can follow https://docs.docker.com/linux/step_one/ for more information on this.
  • You are logged in as root on the machine where Docker is executing.
  • You installed the “default” instance of Integration Server using the Software AG Installer. If you want to create an image of an instance that is not named “default”, you will need to edit the Dockerfile used in this article.


Building Docker image for Integration Server #

This section describes how to write a Dockerfile that can create a Docker image for Integration Server. To create the Docker image, minor changes need to be made to the is_instance.xml file installed with Integration Server.

Write a Dockerfile #

These instructions assume that you installed Integration Server in a directory named: /opt/SoftwareAG. 

Copy the content of following Dockerfile as Dockerfile_IS into /opt/SoftwareAG directory. 

The Dockerfile below is intended for the use case in which you want to create multiple Docker container instances with the same configuration of Integration Server.

The Dockerfile below makes the following assumptions:

  • The instance name for the Integration Server for which you want to create a Docker image is “default”. If you are using an instance name other than “default”, you will need to make necessary changes in the Dockerfile below. Specifically, replace “default” with the instance name that you want to use.
  • You want to expose the primary port 5555 and diagnostic port 9999 only in the Docker image. 
  • If you do not want to expose the primary port 5555 and diagnostic port 9999, then remove those lines from the Dockerfile. 
  • To expose ports other than 5555 and 9999, you will need to add instructions for those ports in the Dockerfile. Specifically, add a line like the following for each port to the Dockerfile :

            EXPOSE portNumber

Where portNumber is the number of the port that you want to expose in a Docker container.

  • The Dockerfile bundles various assets from SoftwareAG folder that are required for the execution of Integration Server.
  • The Dockerfile recreates the profile for the "default" instance that contains the required scripts for launching the instance of Integration Server in a Docker container.


FROM centos:7 

MAINTAINER SoftwareAG 

COPY ./jvm/jvm/ /sag/jvm/jvm/
ENV JAVA_HOME /sag/jvm/jvm 

COPY ./install/jars/ /sag/install/jars/ 

#Comment the line below for 9.7 version of Integration Server
COPY ./install/profile/ /sag/install/profile/

COPY ./install/products/ /sag/install/products/ 

COPY ./Licenses/sagosch /sag/Licenses/sagosch 

COPY ./common/bin/ /sag/common/bin/
COPY ./common/conf/ /sag/common/conf/
COPY ./common/lib/ /sag/common/lib/
COPY ./common/runtime/ /sag/common/runtime/
COPY ./common/security/ /sag/common/security/ 

COPY ./WS-Stack/ /sag/WS-Stack/ 

COPY ./IntegrationServer/bin/ /sag/IntegrationServer/bin/
COPY ./IntegrationServer/lib/ /sag/IntegrationServer/lib/
COPY ./IntegrationServer/sdk/ /sag/IntegrationServer/sdk/
COPY ./IntegrationServer/updates/ /sag/IntegrationServer/updates/
COPY ./IntegrationServer/web/ /sag/IntegrationServer/web/
COPY ./IntegrationServer/.tc.dev.log4j.properties /sag/IntegrationServer/.tc.dev.log4j.properties

COPY ./IntegrationServer/instances/default/ /sag/IntegrationServer/instances/default/
COPY ./IntegrationServer/instances/lib/ /sag/IntegrationServer/instances/lib/ 

COPY ./IntegrationServer/instances/is_instance.xml /sag/IntegrationServer/instances/is_instance.xml
COPY ./IntegrationServer/instances/is_instance.sh /sag/IntegrationServer/instances/is_instance.sh
COPY ./profiles/IS_default/configuration/custom_wrapper.conf /sag/IntegrationServer/instances/custom_wrapper.conf.template

RUN cd /sag/IntegrationServer/instances; ./is_instance.sh updateServerCnfFile -Dinstance.name=default
RUN cd /sag/IntegrationServer/instances; ./is_instance.sh create-osgi-profile -Dinstance.name=default 

CMD cd /sag/profiles/IS_default/bin && ./console.sh 

EXPOSE 5555
EXPOSE 9999


Edit the is_instance.xml File #

The server.cnf file of Integration Server contains a few hard-coded paths used by Integration Server. However, the hard-coded paths need to be updated when running inside a Docker container. To modify the hard-coded paths in server.cnf file, edit is_instance.xml file located under IntegrationServer/instances directory.

Add the following fragment to is_instance.xml file located in IntegrationServer/instances directory


...

<target name=“updateServerCnfFile” depends=“validateInstanceName”>                        
<propertyfile file="${instance.dir}/config/server.cnf" comment=“Default server.cnf file”>                                
<entry  key=“watt.server.homeDir” operation=“del”/>   
<entry key=“watt.server.compile” value="${javac.exe} -classpath {0} -d {1} {2}"/>                        
</propertyfile>        
</target>


Build an image from a Dockerfile #

As a next step, create a Docker image for Integration Server by executing Docker build.

To do so, in the UNIX shell, change the working directory to the folder you have created file Dockerfile_IS.

Once in the working directory, instruct Docker to create an image for Integration Server using Docker build and passing Dockerfile_IS as a file to use for building an image.

Please note the “.” at the end of the command - it refers to the build context to use for building an image. Note that the command tags the image being created as usakash/is, where usakash is a placeholder for an account in your Docker registry.

  

cd /opt/SoftwareAG

docker build -t usakash/is -f Dockerfile_IS .


Once the build is successful, execute the following command


docker images


If the Docker image was created successfully, you will see something like the following: 




Running a Docker image in a Docker container #

This section describes how to run the Docker image created for Integration Server in a Docker container.

Run the Docker Image #

Turn the Docker image into a running container using the "docker run" command. You can name your container with --name option. In the example below, the container is named as “IS_Default”.

The Dockerfile used to create the Docker image exposed port 5555 and 9999. The command used to run the Docker container instructs Docker to expose port 5555 and 9999. The Docker container maps the container’s 5555 and 9999 ports on-to the HOST network system. If you exposed any port other than 5555 and 9999 when creating the Docker image, you need to modify the -p arguments to docker command to include those ports.


docker run -d --name IS_Default -p 5555 -p 9999 usakash/is


Finding Mapped Ports and Connecting to Integration Server #

After there is a running instance of Integration Server in a Docker container, you need to determine which HOST ports are mapped to the Integration Server ports. To find the port mappings, execute the following command:


docker ps -a


You will see something like the following:



The image above indicates that ports 5555 and 9999 of the Integration Server Docker container are mapped to ports 32770 and 32669, respectively, on the HOST where the Docker engine runs.

You can use this information to connect to Integration Server from a browser or an application. For example, using the above information, specifying the following connects a browser or application to the primary port of the Integration Server with a host named “myHost” running on port 32770:

http://myHost:32770

Attaching into the Running Docker Container #

To view the logs and other artifacts that are present inside the running Docker container, you can attach to the running container. To attach to the running container, you need the container ID for the container that launched by the docker run command. You can use the first few unique letters of a container ID to attach to the container.

To view the server.log file for an instance named “default”, execute the command below.


docker exec -ti 1a11 /bin/bash

cd /sag/SoftwareAG/IntegrationServer/instances/default/logs

tail -f server.log


Considerations for Dockerfile and Running Integration Server in a Docker Container #

  • You can change the content of Dockerfile as per your requirements.
  • The provided sample assumes that no changes will be made in the running Integration Server inside a Docker container. If you plan to persist data for an instance running inside a Docker container, consider changing the Dockerfile to use Volume. For more information, see  https://docs.docker.com/engine/userguide/containers/dockervolumes/
  • If you have scheduled tasks configured to run on a specific host, it may not work with the Docker container as the hostname would be changed when Integration Server is running inside a Docker container. If your application uses any hard-coded paths that do not exist in a Docker container, the application needs to be changed to not rely on hard-coded paths or the Dockerfile can be modified to use Volume.