Building and running DAP components in a Docker Container

Overview 

This article describes detail steps create a Docker images for AgileApps server and other required products (DAP component). The script and instructions contained in this article are for webMethods Product version 10.3 and above.

Prerequisites

  • Minimum Knowledge of Docker and Dockerfile.
  • Hands on experience on product installation scripts and images
  • A new Linux machine. Preferably CentOS7 / RHEL with Docker installed 

Important Points to Be Considered 

Does product need an external database?
We will use mysql 5.7 community edition as a database. Which will be a separate container in the same docker daemon.

Need to keep data in persistent file storage for products?
In case you want to keep a backup of files which is been used by products like log files, configuration etc, try to use volume mounted for containers.

Does all products supports mysql database?
As per the 10.3 product documentation, Currently WmRules is not supported in mysql.

Architecture of DAP on docker will look like as follows:

Building a Docker image for DAP

Let’s create a Docker image for AgileApps and for this we need to  

  • Create AgileApps product installation image 
  • Create a product installation script to install products from image

Create a product installation image 

You may be already familiar with the procedure to create a product installation image and script but in this document let’s describe those steps in detail.
Launch installer and create a product image which we will be using for product installation in Docker container. Let’s name our product installation image as “DAPimage”

For simplicity we will keep following folder structure

Keep required license file and installer in the same folder

While creating image note to select Typical Installation of Dynamic Apps Platform Enterprise Edition

Write a Product Installation Script

We will create a product installation script to install products from created image. In our case it is a DAPInstallationImage.zip

Launch installer and create a script to install product from the image.

Goto “Advanced Option >Scripts” and  provide details for installation script name and location. Make sure to uncheck Install products on local machine

Name our product installation script as “DAPInstallationScript”

Now from Image tab select an image which we have already created 

Proceed with other details like Hostname and installation directory, license location and make sure to provide localhost as a Hostname

We will select mysql community edition as RDBMS and provide connection details accordingly

Once you have created an installation script,

Make the required changes in the installation script like InstallDir, imageFile, HostName as required in the container. Notice that we have set HostName as ‘localhost’ which is nothing but the host name of Docker daemon.

Write a Dockerfile 

Once we are done with Product installation image and script, we would need to  create a Dockerfile to pull a CentOS image and install pre requisites like wget, java 1.8 for our product installation in the image

Steps would be:

  • Pull a Centos latest image from the Docker hub
  • Install wget
  • Download oracle jdk 1.8 tarball from official site. Here we will use a link currently available.
  • Extract and set JAVA_HOME
  • Add required files to filesystem of the image
    DAPInstallationScript, SoftwareAGInstaller103.jar and DAPInstallationImage.zip
  • Install DAP using installation script 

Our dockerfile would look like 

From centos:7
Maintainer Manoj Jannu
RUN yum -y install wget
RUN wget -c --header "Cookie: oraclelicense=accept-securebackup-cookie" 
http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz
RUN tar -zxvf jdk-8u131-linux-x64.tar.gz
ENV JAVA_HOME /jdk1.8.0_131
ENV PATH /jdk1.8.0_131/bin:$PATH
ADD DAPInstallationScript /
ADD DAPInstallationImage.zip /
ADD SoftwareAGInstaller103.jar /
RUN mkdir -p /home/testuser
ADD license/ /home/testuser/license/
RUN java -jar SoftwareAGInstaller103.jar -readScript ./DAPInstallationScript ;echo Succcesfully Installed;exit

Save our dockerfile with the name ‘Dockerfile’

Keep SoftwareAG Installer, license, Installation script, mysql connector jar product installation image and Dockerfile in the same directory. Make sure you have given right path in the Dockerfile.  i.e current directory 

Build a Docker Image from Dockerfile

Build a UM image from our Dockerfile by executing the following command from location where we have kept our Dockerfile

$docker build -t dapimage:v10.3 .
OR
$docker build -t dapimage:v10.3 –f 

You will notice the following input.

To verify, execute the following command which will list local images. Here you will see dapimage has been created with the tag v10.3 

$docker images

Running DAP as a container

We will be using run command to spin a DAP container. The Docker run command has a wide range of options that can be passed, which pretty much includes all capabilities of Docker.

Run DAP container run as a daemon process which means docker container would run in the background completely detached from your current shell for this -d is an option with run command. 

$ docker run -itd --name agileapp -p 5555:5555 -p 8585:8585 -p 8284:8284 dapimage:v10.3 bash

Validate DAP container 

Execute docker ps command to list out running containers.

 $docker ps 

Console output shows our DAP container is running and now we will login to dap container

Make changes in DAP installation to support Mysql community edition

  1. To configure "Database Configurator" to connect for MySql CE
    1. Place downloaded mysql-java-connector jar in below mentioned directory:
      <Software AG_directory>/common/lib/ext/
    2. In a text editor, open the setEnv.sh file from
      <Software AG_directory>/common/db/bin
      Add the following classpath entry in the setEnv.sh file. It adds the location of mysql-java-connector jar file to the classpath
      CLASSPATH=%CLASSPATH%;%DCI_HOME%/../lib/ext/mysql_driver_jar
      Example:
      CLASSPATH="$CLASSPATH:$DCI_HOME/../lib/ext/mysql-connector-java-5.1.41.jar" 
    3. Create DB tables by running “dbConfiguratorUI.bat” 
      from <Software AG_directory>/common/db/bin, by providing same DB details as given  during the DAP product installation and MySql user credentials.
  2. To Configure “Integration server” with MySql CE
    1. In a text editor, open the ini.cnf file from the following directory:
      <Software AG_directory>/IntegrationServer/instances/default/bin
    2. Add the following entry to the application.classpath property:
      %COMMON_LIB_EXT%mysql-connector-java-5.1.41.jar;\ 
    3. Restart Integration SErver [If it's already up].
  3. To configure “MyWebmethods” Server with MySql CE
    1.  Place downloaded mysql-java-connector jar in the following directory:
      <Software AG_directory>\MWS\lib
    2. Create a < mysql-connector-name>.bnd text file in
      <Software AG_directory>\MWS\lib directory,
      Example:
      mysql-connector-java-version.bnd
    3. Provide instructions for the OSGi bundle conversion in the .bnd text file
      # attach as fragment to the caf.server bundle
      Fragment-Host: com.webmethods.caf.server
      Bundle-SymbolicName: mysql-connector-java-
      Bundle-Version: < mysql-connector-version >
      Include-Resource: < mysql-connector-jar >
      -exportcontents: *
      Bundle-ClassPath: < mysql-connector-jar >
      Import-Package: *;resolution:=optional


      Example:
      # attach as fragment to the caf.server bundle
      Fragment-Host: com.webmethods.caf.server
      Bundle-SymbolicName: mysql-connector-java-
      Bundle-Version: 5.1.41
      Include-Resource: mysql-connector-java-5.1.41.jar
      -exportcontents: *
      Bundle-ClassPath: mysql-connector-java-5.1.41.jar
      Import-Package: *;resolution:=optional
    4. Run following command at
      <Software AG_directory>\MWS\bin
      mws.bat -s < serverInstanceName > update
      Example:
      mws.bat –s default update

Write a docker-compose file

Write a docker-compose file which will handle bringing up mysql and DAP container and creating required database tables and start required servers.You can find the my.cnf file attached in this artical which will start mysql with custom configurations 

Following is the snippet:

version: "2.1"
services:
     database:
       image: mysql:5.7
       container_name: mysqldb
       volumes:
        - ./my.cnf:/etc/mysql/my.cnf
       ports:
        - "3306:3306"
       environment:
        MYSQL_DATABASE: "productdb"
        MYSQL_ROOT_PASSWORD: "manage"
        MYSQL_ROOT_HOST: "%"
       healthcheck:
        test: ["CMD", "mysqladmin" ,"ping", "-h", "mysqldb"]
        timeout: 20s
        retries: 10
      
     agileapp:
       image: dapimage:v10.3
       command: bash -c "cd /home/testuser/SoftwareAG/common/db/bin && 
./dbConfigurator.sh -a create -c All -v latest -d mysqlc -l 
jdbc:mysql://mysqldb:3306/productdb -u root -p manage && cd 
/home/testuser/SoftwareAG/IntegrationServer/instances && ./is_instance.sh update 
-Dinstance.name=default -Dpackage.list=WmAgileApps && cd 
/home/testuser/SoftwareAG/IntegrationServer/instances/default/bin/ && ./server.sh 
&& cd /home/testuser/SoftwareAG/MWS/server/default/bin && ./run.sh"
       container_name: agileapp
       ports:
        - "5555:5555"
        - "8284:8284"
        - "8585:8585"   
       environment:
        - DEBUG=1
       restart: always
       container_name: agileapp
       depends_on:
        database:
         condition: service_healthy

Verify DAP components

Execute the docker compose file which will do the following

  • Start mysql and DAP container 
  • Create required db tables 
  • Start required servers
$docker-compose up &

You will notice following console output

To verify running containers execute the following command

$docker ps -a

Access AgileApps server with following URL from Docker daemon host

https://localhost:8284/networking/servicedesk/index.jsp

my.cnf (13.4 KB)