Thursday, December 12, 2013

DTGov release workflow using 'Domain Deployment'


DTGov ships with workflows which can help you with deploying releases to runtime environments. At the moment the deployment service supports 4 ways to deploy an application:
  • copy, file copy to a directory
  • rhq, using the RHQ REST API to deploy an application to a resource managed by RHQ.
  • as_cli, using the JBoss AS Client to deploy to a JBoss Domain.
  • mvn, deploy the application to a maven repository.
In this blog post we demonstrate how to deploy an application using the JBoss AS Client.

DTGov configuration

To use the JBoss AS Client we need to configure a target in the file referencing the as_cli protocol. For example to deploy to a domain on server we'd use

governance.targets=   qa||as_cli|admin::admin123!::

Where admin/admin123! are the credentials to log into the remote domain.

JBoss Domain Setup

The DTGov deployment service can deploy to a JBoss Domain. Look here if you need more information on how set one up.

1. Open the domain/configuration/domain.xml file for editing, and make sure you have a 'qa' group, which is name of the target mentioned above. You should end up with something like
        <server-group name="qa" profile="full">
2. Open the domain/configuration/host.xml file for editing, and assign servers to this group. In this example we add 'server-one' to the 'qa' domain group. You want to add more then one server.
        <server name="server-one" group="qa">


3. Now you can start your domain using something like
   bin/ -b -bmanagement=

You can test your credentials (admin/admin123!) by logging into the management console, which in this case would run on, and/or using the client: bin/ You may have to add an admin user using the bin/ script. Also verify that you see the 'qa' domain group in the management console.

Deployment of your application

At this point the release workflow is ready to deploy an application to the 'qa' domain group. Once you've approved the 'dev' task, you should see the dtgov deployment REST API logging on the dtgov server:

Calling POST TO: http://localhost:8080/dtgov/rest/deploy/qa/0e7a209c-f298-433c-b9a6-3d40d4ac2f5c

This means that the dtgov is invoked the jboss client on the 'qa' domain to deploy the application, where '0e7a209c-f298-433c-b9a6-3d40d4ac2f5c' is the UUID of the application artifact that will get deployed. If something is wrong at this point you can use your favorite REST client tool and perform POST's to this url until things work. 

 Figure 1. Screenshot of the management console after the requirements jar was deployed (probably a bad choice to deploy the requirements!!)

 I hope this worked for you too, and that you picked a better artifact then I did as deploying the requirements from the dtgov-demos-project doesn't really make a whole lot of sense! Well other then demonstrating that it works :).