Automating Application Deployment From Jenkins or Hudson

Last modified by David Avendasora on 2012/05/29 07:54

With the combination of the Jenkins or Hudson continuous integration server and the REST Routes and Direct Actions that have been added to Wonder's JavaMonitor you can automatically deploy from Hudson directly to your app servers!

Included as an attachment to this page is a small Perl script that I demonstrated at WOWODC 2010. This script will take a build out of Hudson and deploy it to your wotaskd/JavaMonitor server. It will also add the app and create an instance if the app is not found in wotaskd.

You need to:

  1. Install a few CPAN Modules on your Hudson host perl -MCPAN -e 'install Math::Pari'
    perl -MCPAN -e 'install REST::Client'
    perl -MCPAN -e 'install JSON'
    perl -MCPAN -e 'install File::Rsync'
    perl -MCPAN -e 'install Net::SSH::Perl'
    Installing Net::SSH::Perl on Ubuntu is a bit of a pig. I found these instructions helpful.
    On CentOS, you will have to install the openssl-devel package. You will also need to install the perl-CPAN package (yum install perl-CPAN).
  2. Install the wodeploy.pl script on your Jenkins host
  3. Install the Hudson Batch Tasks Plugin using Jenkins' built-in Plugin Manager (Manage Jenkins -> Manage Plugins)
  4. In your Jenkins job, create a new Batch Task with the following call: 
Add This as a Batch Task to your Hudson Job

/path/to/wodeploy.pl -U http://your.womonitorserver.com:56789/cgi-bin/WebObjects/JavaMonitor.woa -n ${DEPLOYED_APPLICATION_NAME} -P ${WORKSPACE}/Projects/${PROJECT_NAME}/dist/${DEPLOYED_APPLICATION_NAME}.woa -W ${WORKSPACE}/Projects/${PROJECT_NAME}/dist/Split/WebObjects/${DEPLOYED_APPLICATION_NAME}.woa -p yourMonitorPassword