Build-server.xml

From Informatics

Jump to: navigation, search

Contents

About build-server.xml

build-server.xml is an buildfile for ant.

Now this file has been put under ginkgo package.

 cd ginkgo
 ant -f build-server.xml

above command will do following things:

  1. build bison-0.1-SNAPSHOT.jar and ginkgo-0.1-SNAPSHOT.jar
  2. update these two jars in grid service component's lib directory (only if previously exist - that seems true, but why?)
  3. compile and deploy components (currently Anova, SomClustering and HierarchicalClustering)
  4. copy copy xxx-common.jar & xxx-stubs.jar & xxx-client.jar into dispatcher/lib (as described in Dispatcher_Aware)
  5. deploy dispatcher
  6. if tomcat is running, restart tomcat server.

So, please be very careful, if you didn't set $CATALINA_HOME correctly, even you though you just want to compile some services, you'll accidentally restart another server.

prerequests

  • you'll need ant installed on your computer
  • you'll need a ant-contrib.jar file under the lib directory of your ant. (or you can download a local copy from here)
  • ginkgo, geworkbench, and dispatcher need to be checked-out from CVS server into the same directory as all grid service components. (ex: Anova, SomClustering and HierarchicalClustering)
  • if you want tomcat to be restart automatically, you'll need to set enviroment variable "CATALINA_HOME".

first time user

You'll need to deploy Dispatcher by itself first. Otherwise you'll get error "class file has wrong version" This only need to be done once.

Comment: I doubt this is still true. Never did this for a while and didn't have problem.

new components

If you are writing a new grid service component, you'll need to create the service and deploy the service using introduce only for the first time. After that, you can use this build-server.xml to speed up your routine. (This script just do the same things you previously need to do them manually)

targets

Following ant targets might be called directly: ex: "ant -f build-server.xml start" will start the Tomcat server.

start

"ant -f build-server.xml start" will start the Tomcat server only if tomcat server was not previously started. if tomcat server was already running, it will do nothing.

It consider job finished when port 8080 is listening and the url http://localhost:8080/wsrf/services/DefaultIndexService is accessable, or timeout.

PS: port number is written in build-server.xml, and will have different values for each instances on multiple tomcat instances machines. Detail see Production#Multiple_Tomcat_Instances_on_One_Machine

stop

"ant -f build-server.xml stop" will stop the Tomcat server only if tomcat server is running. if tomcat server was not running, it will do nothing.

It consider job finished when port 8080 is not accessable, or timeout.

restart

it will call target stop then call target start as described above

restartOnlyIfRuning

it will detect if the server is running or not, if the server is running, it will restart the server, otherwise, do nothing.

ginkgo-jar

It generates ginkgo-0.1-SNAPSHOT.jar in the parent directory of ginkgo.

updateGinkgoJars

It call target ginkgo-jar, to generate the jar, then looking for lib/ginkgo-0.1-SNAPSHOT.jar in all of the sibling folders of ginkgo. (it assume those folders are components folders) if it found that file under any of those folders, it will update those files using the newly generated one.

bison-jar

It generates bison-0.1-SNAPSHOT.jar in the parent directory of ginkgo.

updateBisonJars

similar to updateGinkgoJars, but updates bison-0.1-SNAPSHOT.jar

servers using build-server.xml

afdev2

settings on afdev2

We have three versions of grid services on afdev2. Each will have different settings;

ver 1.5

tomcat for geworkbench version 1.5 operated on port 8150 (control port 8155)

ver 1.6

tomcat for geworkbench version 1.6 operated on port 8160 (control port 8165)

ver dev

tomcat for geworkbench developer version operated on port 8080 (control port 8005)

Other detail see afdev2

usage

deploy services on afdev2

ver 1.5
 export CATALINA_HOME=/opt/tomcat/tomcat_g1.5/jakarta-tomcat-5.0.28
 cd /opt/tomcat/workspace_g1.5/ginkgo
 ant -f build-server.xml

then modify XXX_registration.xml according to registration.xml

ver 1.6
 export CATALINA_HOME=/opt/tomcat/tomcat_g1.6/jakarta-tomcat-5.0.28
 cd /opt/tomcat/workspace_g1.6/ginkgo
 ant -f build-server.xml

then modify XXX_registration.xml according to registration.xml

ver dev
 export CATALINA_HOME=/opt/tomcat/tomcat/jakarta-tomcat-5.0.28
 cd /opt/tomcat/workspace/ginkgo
 ant -f build-server.xml

then modify XXX_registration.xml according to registration.xml

restart tomcat on afdev2

ver 1.5
 export CATALINA_HOME=/opt/tomcat/tomcat_g1.5/jakarta-tomcat-5.0.28
 cd /opt/tomcat/workspace_g1.5/ginkgo
 ant -f build-server.xml restart
ver 1.6
 export CATALINA_HOME=/opt/tomcat/tomcat_g1.6/jakarta-tomcat-5.0.28
 cd /opt/tomcat/workspace_g1.6/ginkgo
 ant -f build-server.xml restart
ver dev
 export CATALINA_HOME=/opt/tomcat/tomcat/jakarta-tomcat-5.0.28
 cd /opt/tomcat/workspace/ginkgo
 ant -f build-server.xml restart

problem and solution

On afdev2, there's /etc/ant.conf which will override our settings (ANT_HOME)

The solution is to call ant with "--noconfig" option. For example:

 ant --noconfig -f build-server.xml

cagridnode

settings on cagridnode

 export JAVA_HOME=/opt/java
 export ANT_HOME=/opt/cagrid_root/ant/apache-ant-1.6.5
 export GLOBUS_LOCATION=/opt/cagrid_root/globus/ws-core-4.0.3
 export NETBOOST_ALG_HOME=/opt/cagrid_root/workspace/netboost/algorithm/netboost_v1.3_orig

and also, /opt/cagrid_root point to the same directory as /opt/tomcat

We have two versions of grid services on cagridnode.

ver 1.5

tomcat for geworkbench version 1.5 operated on port 8150 (control port 8155) and also mapped to http://cagridnode.c2b2.columbia.edu:8080/v1.5/, ex: http://cagridnode.c2b2.columbia.edu:8080/v1.5/wsrf/services/DefaultIndexService

ver 1.6

tomcat for geworkbench version 1.6 operated on port 8160 (control port 8165) and also mapped to http://cagridnode.c2b2.columbia.edu:8080/v1.6/, ex: http://cagridnode.c2b2.columbia.edu:8080/v1.6/wsrf/services/DefaultIndexService

usage

deploy services on cagridnode

ver 1.5

we have our workspace for ver 1.5 in /opt/tomcat/workspace on cagridnode, so

 export CATALINA_HOME=/opt/tomcat/tomcat/jakarta-tomcat-5.0.28
 cd /opt/tomcat/workspace/ginkgo
 ant -f build-server.xml

then modify XXX_registration.xml according to registration.xml

ver 1.6

we have our workspace for ver 1.6 in /opt/tomcat/workspace_g1.6 on cagridnode, so

 export CATALINA_HOME=/opt/tomcat/tomcat_g1.6/jakarta-tomcat-5.0.28
 cd /opt/tomcat/workspace_g1.6/ginkgo
 ant -f build-server.xml

then modify XXX_registration.xml according to registration.xml

restart tomcat on cagridnode

ver 1.5
 export CATALINA_HOME=/opt/tomcat/tomcat/jakarta-tomcat-5.0.28
 cd /opt/tomcat/workspace/ginkgo
 ant -f build-server.xml restart
ver 1.6
 export CATALINA_HOME=/opt/tomcat/tomcat_g1.6/jakarta-tomcat-5.0.28
 cd /opt/tomcat/workspace_g1.6/ginkgo
 ant -f build-server.xml restart

Problem Solving

Scenario 1

You got error message about "foreach"

You need to copy ant-contrib.jar into your $ANT_HOME/lib

Scenario 2

You got error message:

 "Could not create task or type of type: runtarget"

You need correct version of ant-contrib.jar

Technical Detail

For checking if the server is started or not in this ant script, it try to detect if the port is opened or not. If opened, it will then check an url specified in the build-server.xml, which is http://localhost:8080/wsrf/services/DefaultIndexService in common case. If it can access the page correctly, it assume the server is up.

To check if server is stopped or not, it try to detect if the port is closed or not.

So, if you run multiple instances of tomcat on different port or URLs, please modify the port and url in this ant script.

Personal tools