In this post, we will discuss how to use JENNIFER java agent with Red Hat OpenShift V3.
The general workflow involves three steps. The first step is to create an enhanced builder image with JENNIFER agent. This builder image will be used as the basis to create application images and deploy them to OpenShift.
The second step is to use the builder image to create an application image. Lastly, we can use the created builder image and deploy it to OpenShift.
There are some requirements needed before we get into this tutorial:
The first step is to create the builder image with JENNIFER java agent. We will use Wildfly 12. Final
1- Clone the repository
https://github.com/JENNIFER-University/s2i-wildfly-jennifer
Alternatively, You can use s2i to scaffold a boilerplates project, or If you want to use a different version of wildly, you can consider using the following repo
https://github.com/openshift-s2i/s2i-wildfly
The repository we provided is actually a kind of subset of the s2i-wildly repository
2- Download JENNIFER Java agent Package and place the zip file in the s2i-wildfly-jennifer project root directory.
3- Open the control/jennifer.conf file and modify the server_address IP address
4- Build the builder image.
docker build -t jennifer-oc-builder .
A new image called jennifer-oc-builder will be available once the docker build command is completed successfully.
At this point, the builder image is ready to be used. The Operation team can make this image available to the dev team by adding it to OpenShift internal registry or docker hub.
Once we have our builder image ready, we can create our application image. We will use the sample application "openshift-jee-sample" provided by openshift. Its available at the following GitHub repo
https://github.com/openshift/openshift-jee-sample
To build the application image, we need to use the s2i script. Make sure you have downloaded it and it is in your PATH. As the source code of our sample application is hosted on Github, we can just add the GitHub repo URL as input to the s2i script. For more information on how to use the source to image script without git repository, please refer to the documentation https://github.com/openshift/source-to-image
1- Execute the s2i build script, the s2i build script format is as follow: s2i build REPO_LINK BUILD_IMAGE APP_IMAGE_NAME . Where the APP_IMAGE_NAME is the output image name you want to create. we will call our Application Image jennifer-oc-app, so the command is as follow
s2i build https://github.com/openshift/openshift-jee-sample jennifer-oc-builder jennifer-oc-app
I will tag this image and push to OpenShift internal registry. But before that i need to create and image stream first using the oc cli.
2- Create the image stream
oc login 192.168.10.10
oc create is jennifer-oc-app -n myproject
The oc create is command will create an image stream called jennifer-oc-app in the namespace myproject.
3- Tag our application image and push it to openshift internal registry
docker tag jennifer-oc-app oc-docker-reigstry.dev/myproject/jennifer-oc-app
docker login oc-docker-reigstry.dev
docker push oc-docker-reigstry.dev/myproject/jennifer-oc-app
Alternatively, you can use Dockerhub
The Last step is to deploy the application into openshift.
1- Login to Openshift console.
2- Select the deploy image option. Select the namespace you are using. In our example our namespace is myproject.
3- Select the image stream "jennifer-oc-app" we created in the previous step and hit the deploy button.
4- Once the application is deployed, you can check JENNIFER dashboard and you will be able to see JENNIFER agent instance on the dashboard
In a previous article, JENNIFER Events and Alerts, we gave an introduction to JENNIFER EVENTS system. In this article, we will see how the EVENT system can be used in action. We will see how to analyz...
JENNIFER Events is a flexible notification system that allows the operation teams to receive notification about incidents that take place in a system. JENNIFER Event Rules allows you to configure Even...
Dynamic method profile is a powerful feature in JENNIFER that allows you to increase/decrease the profiling level of a transaction without restarting the application server. First of all, what is a...
What is Deployment Indicator When a new version of the code is deployed in production, JENNIFER can automatically detect this change and display the changed resource in the deployment. A vertical...
Mule is a lightweight Java-based enterprise service bus (ESB) and integration framework developed by MuleSoft. Mule ESB allows developers to connect applications together easily and quickly, enabling...