Tutorial on how to containerize IBM ACE application using docker

Tutorial on how to containerize IBM ACE application using docker

IBM ACE (App Connect Enterprise) is the successor of the IBM Integration bus. In a nutshell, IBM ACE provides the features of IIB (IBM Integration Bus) and many more in a cloud-native way. I typically deal with various technologies in my day job, IBM ACE being one of them. I plan to write a few articles to share my learnings of how to use IBM ACE in a cloud-native way. First, in this blog, I will write a tutorial on how to containerize a simple IBM ACE application using docker.

I assume that you have some knowledge about docker and IBM ACE.

IBM ACE Hello World application

I will write a simple application in ACE that has a message flow with nodes in the following order: HTTP Input Node -> Compute Node -> HTTP Reply node.

IBM ACE Hello World

When invoked over HTTP, the message flow replies with JSON data.

Response of the Hello World Message Flow

I won’t show you the detailed development process of this message flow as that’s not the purpose of this blog.

Create base docker image for ACE

There are two options for us. We can either pull a prebuilt developer edition image from the docker hub or create the base image ourselves. Here I’ll explain both the options. Depending on your comfort & preference, you can use either of them.

Option1: Create it easy way

We can obtain a prebuilt developer edition ACE server image from docker hub – ibmcom/ace-server. You need to issue the below command from your favorite command-line utility.

It’ll take some time, depending on your internet connection. Once done, issue the docker images command to confirm that the base image is in your local system. In the below snippet, I have highlighted the pulled image with yellow.

Option2: Create it by yourself (a bit tricky)

If you are a bit more experimental, you can opt for this option, where we’ll create the base image by ourselves using the materials provided by IBM.

Head to https://github.com/ot4i/ace-docker and download the repo content as a zip file in a folder. I have downloaded it to D:\ drive.

Download ot4i/ace-docker code base
Download ot4i/ace-docker code base

Head to this IBM link sign-in with your credential and the available ACE server. Please ensure to download the Linux version. Copy the downloaded file (11.0.0.11-ACE-LINUX64-DEVELOPER.tar.gz at the time of writing this blog) to D:\ace-docker-master\deps folder.

Download the ACE server linux image
Download the ACE server Linux image

NOTE:- We are working with developer edition of the ACE here. For production grade use, you need to download it from IBM authorized product page.

Now, traverse to the D:\ace-docker-master folder and launch a command prompt. As you might have noticed, I am using the git-bash command-line utility. Now, issue the following command:

If you notice, for ACE_INSTALL argument, we have passed the name of the file that we downloaded from IBM site.

It’ll take a while, and then it will create the base image.

docker image ace-server
docker image ace-server

Dockerize the IBM ACE application

Now, we’ll learn how to dockerize the above-created simple IBM ACE application and run it as a docker container.

  • I’ll create a fresh new folder in D:\ drive with name ACEDocker. You can use any folder/drive of your choice. There is no binding. I would like to keep the PI and Bar file of my project into this folder.
  • Now, I’ll open the toolkit and export the PI file of the application into a folder D:\ACEDocker\PI
  • Next, I will export the bar file of this application into a folder D:\ACEDocker\BAR
ACEDocker Folder Structure
ACEDocker Folder Structure
 BAR Folder Structure
BAR Folder Structure
PI Folder Structure
PI Folder Structure
  • Next, inside the D:\ACEDocker\ folder, create an empty file called Dockerfile
  • The first line in the Dockerfile will tell Docker as to what will be our base image from which we want to build our own image. In this case, we will use the latest version of ace image that we have in our local registry. So let’s write the following command as the first line of Dockerfile.
  • Now, I’ll change the user to root in the next line
  • In the next line of the Dockerfile, I’ll use COPY instruction to bundle application bar file inside the docker image
  • In the next line of the Dockerfile, I’ll change the permission of the folder:
  • I’ll change the user from ROOT in the next line
  • Next, we have to run the script for compiling the application bar file
  • The next 3 lines are straightforward. We change the user and permission.
  • Now, if we put all of the above, our docker file will look like below

Build the docker image of IBM ACE application

  • Now, we are ready to build the docker image with the instructions we have just put in the above Dockerfile.
  • To build the docker image, we’ll to run a command like below from D:\ACEDocker folder
docker build image
  • With this, we have successfully built the image which can be verified by issuing docker images command

Run the docker container

  • Now that the image is built up, let’s launch the container. One important point to note here is that the port 7800 that we have used in our code and also exposed in the image will not be visible outside of the container. Hence, we’ll need map the container internal port 7800 to an external port (on host machine). Let’s use an external port 7801. While launching the container, we will use following parameter: -p [external port]:[internal port]
  • So, without further delay, let’s execute following command

Conclusion

This tutorial taught us how to containerize the IBM ACE application using docker. Stay tuned for more!

Reference

https://github.com/ot4i/ace-docker

https://hub.docker.com/r/ibmcom/ace-server

181

No Responses

Write a response

This site uses Akismet to reduce spam. Learn how your comment data is processed.