Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

Version 1 Next »

An Installer is a Maven project that runs an Ant script to copy WAR or EAR files into a JBoss or Tomcat application directory and configure Datasources and application parameters. It is typically checked into Subversion under the project that builds the WAR or EAR it deploys.

An Installer separates sensitive parameters from the WAR or EAR artifact created by the developers. These parameters may include database URLs, userids, and passwords, AD service accounts, LDAP URLs, and so on.

Developers create a single version of the application code. That code has to be run on the Development and Test systems before going into production. On the development system it needs to access the development version of the database and the lab version of Active Directory. The Installer project allows the developer to create a single application artifact file, but then have it post-processed as it is deployed to DEV, TEST, and PROD to insert the appropriate parameters for each of the three environments.

Some parameters will be provided by alternate properties files checked into Subversion. The install-DEV.properties provides non-sensitive parameters merged into the DEV environment, while install-TEST.properties has the TEST environment version of the same parameters. However, last minute sensitive parameters are provided by the Jenkins install job from values on the Parameters screen defaulted or entered when the job is started. Typically these parameters include the passwords for database access and service accounts.

There are two templates for the build.xml Ant script run by the Ant-Maven plugin when the installer executes. One version creates a context.xml file that is installed into the

Unknown macro: {tomcat}

/conf/catalina/localhost tree. The other creates Datasource XML files and a special JBoss service to configure JNDI environment variables for the application.

A Datasource is defined in Tomcat context.xml or in JBoss somename-ds.xml in the deploy directory. It contains a Database URL, userid, and password for database connections. A list of other parameters defined in the build.xml source is turned into JNDI name-value pairs managed by the Tomcat or JBoss version of the J2EE standard for container managed parameters. In JBoss the installer created XML file triggers a service that runs before any of the applications starts up and prepopulates the JNDI storage with parameter names and values.

During development on your desktop, you can run the Installer job using Maven under Eclipse. Create an install.properties file with the parameters that would have been entered by the Parameters panel of the Jenkins job that installs the application to DEV. Typically you need the userids and passwords to access the DEV database. The Jenkins panel creates an install.properties file on the fly, but on your desktop you can create it statically and run it to deploy your WAR or EAR artifacts to the local Tomcat or JBoss directories. A typicall install.properties begins with something like:

target.environment=DEV
artifact.version=2.0.6-SNAPSHOT
tomcat.deploy.dir=/appservers/apache-tomcat-7.0.26
db.url=jdbc:oracle:thin:@rick.its.yale.edu:1521:ACS3
db.username=yyyyy
db.password=xxxxxxx

The target.environment tells Ant which additional properties file to merge in (install-DEV.properties when "DEV" is specified as in this case). The artifact.version matches the version number of the WAR or EAR file specified in your application POM. The tomcat.deploy.dir is the location on your machine of the Tomcat into which the application is to be installed (or jboss.deploy.dir for a JBoss).

A good practice is to create two Maven Run Configurations in Eclipse that you can select from the dropdown when you click the Run icon on the toobar. The first corresponds to the Jenkins Trunk Build and runs the application program project POM to create the WAR or EAR artifact and store it in your local Maven

Unknown macro: {home}

/.m2 directory. The second Run Configuration runs the Maven "install" target on the Installers project to generate the configuration files and copy the WAR or EAR from the .m2 directory to the tomcat.deploy.dir configured as shown above. Then in Eclipse you just run the two Maven Run Configurations in the same way that for DEV you would run the Trunk Build and DEV Install Jenkins jobs.

  • No labels