Thursday, November 27, 2014

Jenkins (Hudson) - Easier than thought...


I always had fascination for automated build systems. For me it was always some magic happening behind those web pages.
Recently I got a chance to unravel the magic by doing a Jenkins install. To be honest it was really really simple; easier than configuring tomcat. Below steps are just high level view to let you know how simple it is, for proper steps please refer the Jenkins site

High level steps:
  1. Download Jenkins WAR
  2. Run with Java (Java -jar jenkins.war). Jenkins war comes with inbuilt jetty, so no need to have a separate container
  3. Configure few properties in the Jenkins web page like JAVA_HOME, ANT you want to use.
  4. Configure the Job (Project)
    1. Specify the source control tool: For us it was perforce, with a very easy to use Jenkins Perforce plug-in the config was simple. Just create a separate perforce work-space that Jenkins will use to sync the code, provide user id etc.
    2. Specify the build file (for us ANT), targets etc.
    3. Specify the polling interval.
That’s it.

Fired some build manually to check if everything was working fine.
Next morning the build ran as per the schedule, it even synced the code taking latest change lists.
Still looks like magic ... :)

Pitfalls:
  1. Initially whole build was OK, but the Dojo part was failing with errors giving hint that there is some path issue. After losing one day, realized that dojo build fails if the path contains a “.”. Jenkins by default creates a home directory by name “.Jenkins” in the user directory and all project, job etc are synced there only. So to avoid any such issue, before you start Jenkins for the first time: Create a system variable by the name of “JENKINS_HOME”, and give a path of your choice.
  2. First time also faced some issue where build was not able to create / update some files. Had to manually set the source folders/files writeable. 

Wednesday, November 5, 2014

Profiling WebSphere Liberty


Took up the job to profile the application I am working on. As WAS Liberty is my favourite app server, wanted to do the profiling on that only.
Tried various tools like VisualVM, JProfiler etc. But even after lot of search couldn't find a good page describing how to enable the application for profiling. Looks like some JMX port configuration is required, didn't check further.

Then tried IBM Heath Center. Initially I was bit sceptical as a related IBM tool - 'Support assistant' is very heavy and had bad experience with it in the past.

But I was pleasantly surprised the way IHC was so easy to install and configure. And good thing, it works with IBM JDK out of the box :)

So below are the steps:

1) Install 'Health Center'

2) Enable the application we need to profile, in our case the Liberty server.
In the Eclipse Liberty Server project, edit the jvm.options file, add following lines:
-Xhealthcenter:port=1973
-agentlib:healthcenter

Start the server. In the startup log you should see:  
INFO: Health Center agent started on port 1973

Port can vary as per your setup

3) Connect the health center
Open the HC perspective: Window -> Open Perspective > Health Center Status Summary
File -> New Connection...' . Specify the port mentioned in the log.
Start using the application and the agent will start collecting the information and display in neat interface.