Workbench-less module development

24 views
Skip to first unread message

Anthony Shortland

unread,
Jul 10, 2011, 11:29:32 AM7/10/11
to ControlTier Accounting
If you elect to build a solution based on static "defined" commands (http://doc36.controltier.org/wiki/Defined_commands) you can do all your module development without using Workbench.

In fact, you really only need the ControlTier client installed and properly configured to work this way (i.e. no server installation at all!):

  • Firstly, the quickest way to get going is to start with a default ControlTier client installation:

[root@ip-10-114-169-160 tmp]# rpm -i ctier-client-3.6.1-1.noarch.rpm 
Locking password for user ctier.
passwd: Success

... NOTE that this approach relies on some fixes and features only available in ControlTier 3.6.1!

  • Secondly, setup a CTL_BASE with logging, property updates and Workbench integration disabled as follows:

[ctier@ip-10-114-169-160 ~]$ id
uid=100(ctier) gid=102(ctier) groups=102(ctier)
[ctier@ip-10-114-169-160 ~]$ export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64 
[ctier@ip-10-114-169-160 ~]$ ctl-setup --log4j.logger.com.controltier.log.common=INFO --framework.ctl-project.create.buildfile=$CTL_HOME/lib/ant/controllers/ctl/projectsetupCmd.xml --resource.properties.autoupdate=false --framework.workbench.integration.enabled=false -n localhost
Using nodename as hostname: localhost

upgradeModuleLibdirs:

inquire-properties-regenerate:

generate-etc-properties:
     [copy] Copying 1 file to /opt/ctier/ctl/etc
     [copy] Copying 1 file to /opt/ctier/ctl/etc
     [copy] Copying 1 file to /opt/ctier/ctl/etc
     [copy] Copying 1 file to /opt/ctier/ctl/etc
     [copy] Copying 1 file to /opt/ctier/ctl/etc
     [copy] Copying 1 file to /opt/ctier/ctl/etc
     [copy] Copying 1 file to /opt/ctier/ctl/etc
     [copy] Copying 1 file to /opt/ctier/ctl/etc
     [copy] Copying 1 file to /opt/ctier/ctl/etc
     [copy] Copying 1 file to /opt/ctier/ctl/etc
     [copy] Copying 1 file to /opt/ctier/ctl/etc
     [copy] Copying 1 file to /opt/ctier/ctl/etc

generate-log4j-properties:
     [copy] Copying 1 file to /opt/ctier/ctl/etc
     [copy] Copying 1 file to /opt/ctier/ctl/etc

setup-directories:
    [mkdir] Created dir: /opt/ctier/ctl/src
    [mkdir] Created dir: /opt/ctier/ctl/etc/extensions

installExtensionConfig:

copyExtensionConfig:
     [copy] Copying 4 files to /opt/ctier/ctl/etc/extensions/commander
     [echo] Updated extension configuration: commander

modules.fromDir:

modules.fromJar:

modules.install:

framework:

-load-defaults:

check-props:

ctl-config:

modules-install:

post-setup:
     [echo] Commander extension post-setup completed.

Setup build successful.

  • Thirdly,  create a project to work in:

[ctier@ip-10-114-169-160 ~]$ ctl-project -p development -a create
Project structure created: /opt/ctier/ctl/projects/development
Trying to override old definition of task document-property
Invoking external setup script: /opt/ctier/pkgs/ctl-3.6.1/lib/ant/controllers/ctl/projectsetupCmd.xml

  • Lastly, with Workbench integration enables, the core module extension must be separately installed:

[ctier@ip-10-114-169-160 ~]$ ctl-extension -S -f /tmp/core-extension-3.6.1.jar

With this done (and from a fresh login) module development proceeds as follows (using the AWS extension as an example):

  • Checkout your module source:

A    aws/jars
A    aws/jars/jets3t-0.6.0.jar
A    aws/jars/awstasks-3-6-support.jar
A    aws/src
.
.
.
A    aws/modules/AwsS3Util/lib
A    aws/modules/AwsS3Util/lib/command.xml
A    aws/bins
A    aws/bins/post-setup.xml
A    aws/properties
A    aws/properties/antproject.properties
Checked out revision 2290.

  • All the type module-related ProjectBuilder commands can be invoked statically, e.g you can build an installable extension as follows:

[ctier@ip-10-114-169-160 aws]$ ctl -p development -m ProjectBuilder -c build-library  -- -archive extension -basedir /opt/ctier/src/aws -targetdir /opt/ctier/target -name aws
Created dir: /opt/ctier/target
Building library from modules in opts.basedir: /opt/ctier/src/aws/modules
setting property seed.build.name to aws-seed
Created dir: /opt/ctier/target/modules
processing modules in directory: /opt/ctier/src/aws/modules
converting type.xml for module: AwsEc2ApiToolsZip
generating handlers...
packaging module: AwsEc2ApiToolsZip
Copying 1 file to /opt/ctier/src/aws/modules/AwsEc2ApiToolsZip
Copying 1 file to /opt/ctier/src/aws/modules/AwsEc2ApiToolsZip
Deleting: /opt/ctier/src/aws/modules/AwsEc2ApiToolsZip/module.properties.temp
Building jar: /opt/ctier/target/modules/AwsEc2ApiToolsZip-1.jar
converting type.xml for module: AwsEc2InstanceManager
generating handlers...
packaging module: AwsEc2InstanceManager
Copying 1 file to /opt/ctier/src/aws/modules/AwsEc2InstanceManager
Copying 1 file to /opt/ctier/src/aws/modules/AwsEc2InstanceManager
Deleting: /opt/ctier/src/aws/modules/AwsEc2InstanceManager/module.properties.temp
Building jar: /opt/ctier/target/modules/AwsEc2InstanceManager-1.jar
converting type.xml for module: AwsS3Util
generating handlers...
packaging module: AwsS3Util
Copying 1 file to /opt/ctier/src/aws/modules/AwsS3Util
Copying 1 file to /opt/ctier/src/aws/modules/AwsS3Util
Deleting: /opt/ctier/src/aws/modules/AwsS3Util/module.properties.temp
Building jar: /opt/ctier/target/modules/AwsS3Util-1.jar
 seed.build.name=aws-seed
 generating aws-seed.jar
Building jar: /opt/ctier/target/aws-seed.jar
Creating extension archive ...
processing modules in directory: /opt/ctier/src/aws
Created dir: /opt/ctier/target/extension/aws
Created dir: /opt/ctier/target/extension/aws/bins
Created dir: /opt/ctier/target/extension/aws/jars
Created dir: /opt/ctier/target/extension/aws/modules
Created dir: /opt/ctier/target/extension/aws/properties
Copying 3 files to /opt/ctier/target/extension/aws/modules
Copying 1 file to /opt/ctier/target/extension/aws/properties
Copying 1 file to /opt/ctier/target/extension/aws/bins
Copying 2 files to /opt/ctier/target/extension/aws/jars
Building jar: /opt/ctier/target/aws-extension-1.jar
Extension archive created. You can install the new extension like so: ctl-extension -f aws-extension-1.jar

... note the use of options values to provide the execution context for the command (replacing values that would otherwise have been provided by the resource model).

  • Individual modules can be built and tested in-situ as follows:

[ctier@ip-10-114-169-160 AwsS3Util]$ ctl -p development -m ProjectBuilder -c build-type  -- -basedir /opt/ctier/src/aws -targetdir /opt/ctier/target -type AwsS3Util -deploy
Building type using the buildmodule.xml via classloader
converting type.xml for module: AwsS3Util
generating handlers...
packaging module: AwsS3Util
Copying 1 file to /opt/ctier/src/aws/modules/AwsS3Util
Copying 1 file to /opt/ctier/src/aws/modules/AwsS3Util
Deleting: /opt/ctier/src/aws/modules/AwsS3Util/module.properties.temp
Building jar: /opt/ctier/target/modules/AwsS3Util-1.jar
Installing new build of "AwsS3Util" module ...
Created dir: /opt/ctier/ctl/modules/AwsS3Util
Expanding: /opt/ctier/target/modules/AwsS3Util-1.jar into /opt/ctier/ctl/modules/AwsS3Util

... note that the "-deploy" option installs a copy of the built module in $CTL_BASE/modules ready for local execution:

[ctier@ip-10-114-169-160 AwsS3Util]$ ctl -p development -m AwsS3Util -c 
Install-Module    get               resource-install  

Simple as that!

After this module development proceeds as the usual cycle of editing type.xml files, using the ProjectBuilder build-type command to build each module, testing through local execution, and packaging for broader deployment using the ProjectBuilder build-library command to create an extension format archive.

Thanks,

Anthony.

Dan Nemec

unread,
Aug 2, 2011, 4:10:54 PM8/2/11
to contr...@googlegroups.com
Just curious, Anthony, what do I gain by not installing and running Workbench? Is this for people trying to run a Control Tier server inside S3 and they want to keep their costs down? I'm running on my own hardware so disk and memory are cheap. The only thing I need is more speed.

Dan

Costin Caraivan

unread,
Aug 3, 2011, 4:09:46 AM8/3/11
to contr...@googlegroups.com
Thank you for the article. I have a question though.

Why not post these articles on the Wiki? Benefits:
1. Everyone can edit them (including the original author), so that the fixes/updates are not lost in a long discussion following the initial mail
2. The documentation can be structured, unlike here.

Regards,
Costin.

Anthony Shortland

unread,
Aug 3, 2011, 10:53:56 AM8/3/11
to contr...@googlegroups.com
Good point, Costin. I've always held the general approach that its quicker and easier to post an idea like this to the Google group. This gets it out there for discussion and feedback ahead of polishing it up and adding it to the Wiki.

Anthony.

--
You received this message because you are subscribed to the Google Groups "ControlTier" group.
To post to this group, send email to contr...@googlegroups.com
To unsubscribe from this group, send email to controltier...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/controltier?hl=en
http://wiki.controltier.org


Reply all
Reply to author
Forward
0 new messages