ControlTier Inc. > Open.ControlTier
 
Font size:      

Getting started using ProjectBuilder

Overview

This guide describes how to utilize the base automation library to define an end-to-end build and deployment process. To meet that end goal, this guide will introduce you to essential terms and concepts, a development tool called ProjectBuilder, and later lead you through several examples.

Note
While the goal of this tutorial is to walk you through building your own modules to interface your build and deployment procedures, you should also consider looking at the available modules at ModuleForge. This tutorial chooses Ant and Tomcat as the example tools to integrate. For users looking for a ready solution for Ant and Tomcat and other Java related technologies, please see the Elements Java Server Library.

Setting up

Setup is done in two rough steps:

  1. Choose a project
  2. Define a ProjectBuilder object
Note
Specific user input is shown in bold. The "\" (backslash) character is used for line continution.

Choose a project

In Workbench, create a new project called default:

Workbench -> Admin -> Create Project (enter project name)

From the command line execute the following CTL command to create a project depot (this will also register the node into the workbench project):

ctl-depot -a create -p default

The client is now setup to accept an instance of ProjectBuilder.

Define a ProjectBuilder object

Many of the ProjectBuilder commands work relative to a directory that contains the source files of the project. This directory is referred to as basedir. A second directory must be identified where ProjectBuilder's build artifacts will be written. That directory is referred to as targetdir.

What you name the ProjectBuilder object is not important at this time, nor is the location of basedir and targetdir. For this example though, name the object, tutorial, and put the basedir and targetdir under your home directory in a subdirectory called $HOME/simple.

Note
It is a good idea to establish an object naming convention early on. Typically, objects that manage infrastructure (Updaters, Sites, Services) are named after their environment (dev, qa, staging, production). Other kinds of objects may be named after use patterns (common, default, shared) or in the case of packages, after their file names (simple-123.war, openssl-2.2.tgz). Consistent naming makes the project model more cohesive and faciliates navigation and search.

Via CTL: Run the Register command specifying the following arguments:

ctl -p default -t ProjectBuilder -o tutorial -c Register -- \
	   -basedir $HOME/simple/src -installroot $HOME/simple/target -install
      

The Register command took care of a few actions. First it defined a new object in the project model maintained on the server. Secondly, it created a directory structure in the corresponding local CTL project on the node where the command ran. You can run the Get-Properties command to look at the information about the new object:

ctl -p default -t ProjectBuilder -o tutorial -c Get-Properties -- -print
Instance Properties:
  deployment-basedir: /Users/tutorial/simple/src
  deployment-install-root: /Users/tutorial/simple/target
  deployment-manages: false
  deployment-startup-rank: 
  description: 
  dirlist: bin,logs,var,var/transforms
  revision: 2
Framework info:
  Server URL: http://localhost:8080/itnav/instances/View.do?maprefUri=http%3A%2F%2Fwww.opendepo.org%2Fct%2Fsimple%2FObjects%23obj_1&depot=simple
  Type module: /Users/tutorial/ctl_base/depots/simple/modules/ProjectBuilder
  Object directory: /Users/tutorial/ctl_base/depots/simple/deployments/ProjectBuilder/tutorial
  Object properties file: /Users/tutorial/ctl_base/depots/simple/deployments/ProjectBuilder/tutorial/var/entity.properties
Attributes:
  basedir: /Users/tutorial/simple/src
  buildfile: /Users/tutorial/ctl_base/depots/simple/modules/ProjectBuilder/lib/build.xml
  buildtarget: all
  organizationDescription: Maker of the ControlTier software
  organizationName: ControlTier
  organizationURL: http://www.controltier.com
  projectDescription: The ControlTier base types
  projectName: base
  projectURL: http://open.controltier.org
  stageextension: jar
  stagefilebase: .*
  targetdir: /Users/tutorial/simple/target
     

The ProjectBuilder is now ready to use.

First integrations

With ProjectBuilder configured for use, we can now begin using it to integrate the existing build and deployment process into the framework. The following table describes a series of examples that show how one ties in local build and deployment procedures.

Interfacing your build Shows how to create a Builder subtype that interfaces with Ant.
Managing the deployment Shows how to create a Service subtype that interfaces with Tomcat.
Coordinating build and deploymentAutomates the Ant Builder and Tomcat Service into and end-to-end process.

Further reading