**Automated Build and Deployment - Developer\
NCICB Build and Deployment**

+----------------------------------------+-----------------------------+
| Last Revised:                          | 11/6/07                     |
+----------------------------------------+-----------------------------+
| Produced By:                           | Levent Gurses               |
|                                        |                             |
|                                        | Paul Duvall                 |
+----------------------------------------+-----------------------------+
| Version:                               | 0.3                         |
+----------------------------------------+-----------------------------+

Document Approvals

The list contains the name and contact information for the core project
team and any key stakeholders who have an interest in the success of the
project. An "S" identifies persons responsible for approval from the
stakeholder groups. Sign off of the document would be required when a
decision is made not to take action for defined gaps.

  --- ---------------- ---------------- --- ----------------- ----------------
  S   Name             Role             S   Name              Role

  S   Anand Basu       CBIIT                Doug Kanoza       SCM Initiative
                       Engineering                            Leader
                       Manager                                

      Juli Klemm,      caArray Product      George            CBIIT Director
      Ph.D.            Manager              Komatsoulis       of QA

      Eric Tavela      Development          Brent Gendleman   Development
                       Architect                              Project Manager

      Vanessa Caldwell Database Manager     Sriram            Application
                                            Kalyanasundaram   Manager

      Don Swan         NCICB                                  
                       Application                            
                       Support                                
  --- ---------------- ---------------- --- ----------------- ----------------

Revision History

When you make a change to a document, you must add an entry to this
Revision History table and you must manually type the Last Revised Date
on the front cover.

  ----------- --------- -------------------------------------- ---------------
  Date        Version   Description                            Revised by

  8/24/2007   0.1       Initial draft                          Levent Gurses

  9/20        0.2       AntHillPro info                        Paul Duvall

  11/6        0.3       GLOBUS Info                            Levent Gurses
  ----------- --------- -------------------------------------- ---------------

Copyrights and Trademarks

© Copyright 2007 by NCICB, caBIG^TM^. All rights reserved.

Table of Contents

[1. Introduction 1](#introduction)

[2. Goal 1](#goal)

[3. Running a Local Build - Linux 1](#running-a-local-build---linux)

[4. Running a Remote Build: Command Line
3](#running-a-remote-build-command-line)

[4.1. Dynamic build properties 4](#dynamic-build-properties)

[4.2. Property Validation 4](#property-validation)

# Introduction

This guide is designed to help teams automate manual builds,
configuration and deployment. The guide derives from lessons learned
from the successful parallel efforts of the CaArray2 and SCM initiative
multi-environment automated build and deployment pilot project and
industry best practices and it aims to help simplify the creation of a
new automated build project.

# Goal

The goal of this guide is to provide a quick start-up reference for
setting up a new project for an automated multi-environment build and
deploy process.

# Running a Local Build - Linux

The following steps describe how to run a caArray 2 build on a Linux
workstation.

![](media/image2.jpeg){width="4.520833333333333in"
height="3.9895833333333335in"}

1)  Install **Java** SDK 1.5.0_10

    a.  Download from
        <http://java.sun.com/javase/downloads/index_jdk5.jsp>

    b.  After installing the JDK, create a JAVA_HOME environment
        variable (which points to the location of your JDK installation)
        and add %JAVA_HOME/bin% to the front of the System PATH
        environment variable.

    c.  To test proper installation, open a new command prompt and type
        **java --version**.

2)  Install Apache **Ant** 1.7.0

    a.  Download from <http://ant.apache.org/>

    b.  After installing Ant, create an ANT_HOME environment variable
        (which points to the location of your Ant installation) and add
        %ANT_HOME/bin% to the front of the System PATH environment
        variable.

    c.  To test proper installation, open a new command prompt and type
        **ant --version**. Apache Ant version 1.7.0 compiled on December
        13 2006 should be displayed.

3)  Install the **Subversion** command line client

    a.  Download from
        <http://subversion.tigris.org/project_packages.html>

    b.  After installing Subversion, create an SVN_HOME environment
        variable (which points to location of your Subversion
        installation) and add %SVN_HOME% to the front of the System PATH
        environment variable.

    c.  To test Subversion, open a command prompt and type **svn help**.
        A list of SVN commands should be displayed.

4)  Perform a **check-out** the project from the NCI GForge repository,
    e.g. from <https://gforge.nci.nih.gov/svnroot/caarray2/trunk> to a
    local working directory

5)  Download **JBoss 4.0.4 -- GA** distribution from
    <http://labs.jboss.com/jbossas/downloads/>

    a.  Start the JBoss server by opening a command prompt at the
        location of the JBoss installation. Go the \$JBOSS_HOME/bin
        directory and type **run.sh**

    b.  Open <http://localhost:8080/> and verify JBoss is running
        properly

6)  Download **JBoss 4.0.5 -- GA** distribution from
    <http://labs.jboss.com/jbossas/downloads/>

    a.  Start the JBoss server by opening a command prompt at the
        location of the JBoss installation. Go the \$JBOSS_HOME/bin
        directory and type **run.sh**

    b.  Open <http://localhost:8080/> and verify JBoss is running
        properly

7)  Download **JBoss 1.2.0 -- GA JEMS** installer from
    <http://labs.jboss.com/jemsinstaller/downloads/> (version 1.2.0.GA)

    a.  Click on the "Run Installer" link and follow the instructions.
        When prompted for the type of install, select "ejb3". Accept the
        defaults for the rest of the install.

    b.  Note: If you are unable to run the installer download the jar
        file and from the directory where jems-installer-1.2.0.GA.jar
        has been downloaded; open a command prompt and type **java -jar
        jems-installer-1.2.0.GA.jar**

8)  From your Linux machine, install **MySQL**[^1]

    a.  Type **sudo yum install mysql-server\*** from the command line

        i.  Install MySQL

    b.  Increase the MySQL page size to 64M. Edit /etc/my.cnf and add
        the following:

\[mysqldump\]

max_allowed_packet=64M

9)  From your local working directory (in step 4), open the command
    prompt and type **ant deploy**.

# Running a Remote Build: Command Line

The following steps describe how to run a caArray 2 build remotely from
another machine.

![](media/image3.jpeg){width="5.416666666666667in" height="3.71875in"}

1.  Run steps 1-4 and then step 9 of [Running a Local
    Build](#running-a-local-build---linux) section from above.

2.  Obtain the environment properties files (from a private Subversion
    repository at NCICB) and the SSH key files (id_dsa, id_dsa_qa, etc.)
    and modify each environment property file to point to the right key
    locations. For example, modify DEV.properties file to point to the
    location of the SSA private key, id_dsa.

3.  Run the build

    a.  Build from tag:

> ant -f remote-build.xml
> -Denvpropertyfile=C:\\tools\\eclipse\\workspace\\caarray2-trunk\\software\\build\\DEV.properties
> -Dnotest=true -Duse.tag=true -Dsvn.tag= CAARRAY_R2_0_0_QA8

b.  Build and create a new tag:

ant -f remote-build.xml
-Denvpropertyfile=C:\\tools\\eclipse\\workspace\\caarray2-trunk\\software\\build\\DEV.properties
-Dnotest=true -Dcreate.tag=true -Dsvn.tag=CAARRAY_R2_0_0_QA8

> To run in different environments (such as QA), just obtain the
> .properties file from the private SVN repository.

## Dynamic build properties

The standard way to pass properties to an Ant script is through a
property file. You can also pass runtime properties on the command
prompt using the --D option. The following are the --D properties one
can pass to the automated build and deployment script:

-   **envpropertyfile (required)** -- sets the environment property
    file. Has to be a fully qualified file name, e.g.
    c:\\temp\\nci\\DEV.properties

-   **notest** -- when present, all tests will be skipped (**required**,
    temporary)

-   **nodbintegration** -- when present, skips database integration

-   **nodeploy** -- when present, skips JBoss deployment

-   **noglobus** -- when present, skips Globus deployment and tests
    (temporary)

-   **nocheck** -- Turn off static analysis source code checks

-   **use.tag** -- use the provided tag to build. Mostly needed by QA to
    deploy a specific tag. Needs **svn.tag** to work properly.

-   **create.tag** -- tells the script that a new SVN tag will be
    created. Needs **svn.tag** to work properly.

-   **svn.tag** -- specifies the tag to be used or created

## Property Validation

Before each build the automated Ant script validates that the key
property file stored in the public GForge repository matches the
individual environment property file. The task is performed by a custom
Ant task which checks two property files and looks for an exact key
match. The task does not look into the values of each property. It only
validates that the set of properties used by the team matches the
template set supplied by the Systems team. In addition, the build master
can execute the following command to validate the properties: **ant
-Denvpropertyfile=\[Fully qualified path to environment property file,
e.g. c:\\temp\\nci\\DEV.properties\] validate-properties**. This command
will validate the DEV environment properties against the key properties
file and will fail the build if there are any discrepancies.

[^1]: It\'s recommended that MySQL is installed on a machine that is
    separate from the machine where Jboss is installed.