| | deployment with ant/maven
With remote deployment, you can use an ant or maven task to deploy
a .war file to a running Resin instance. This will require some configuration
of the resin.xml to enable deployment. For security reasons, remote
deployment and administration is disabled by default, so you will need
to enable the features to use them.
- Enable remote administration (the HMTP service).
- Add at least one admin user in AdminAuthenticator.
- Enable the remote deploy service.
The first step is enabling remote administration, so you can manage
the server remotely, either with eclipse, or ant, or maven.
If disabled, Resin will ignore all remote administration requests.
The disabled error message will be something like "Failed to connect
to HMTP because HMTP service has not been enabled." In
the resin.xml, the <resin:RemoteAdminService> tag enables remote
administration:
Example: resin.xml enable remote administration
<resin xmlns="http://caucho.com/ns/resin"
xmlns:resin="urn:java:com.caucho.resin">
...
<resin:AdminAuthenticator>
<resin:user name="harry" password="..."/>
</resin:AdminAuthenticator>
<cluster id="">
<resin:RemoteAdminService/>
<resin:DeployService/>
...
</cluster>
</resin>
The second step is adding at least one administration user, so only
authorized administrators can update the server. The <resin:AdminAuthenticator> tag configures
administrators. If no administrators are added, Resin will reject any
remote administration requests.
The third step is enabling the deploy service itself with the
<resin:DeployService> tag. The deploy service is responsible for
managing uploads of new applications and distributing them to the
servers in the cluster.
When troubleshooting, it's helpful to know that Resin uses BAM/HMTP
to connect the deployment client with the deployment server. The
<resin:RemoteAdminService> enables BAM/HMTP. If the server is down
or the remote admin service isn't enabled, the error messages will
complain that the BAM/HMTP connection is not allowed.
Configuring the Maven Plugin in a pom.xml file
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.test</groupId>
<artifactId>test</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>test Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
...
</dependencies>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>ignore</checksumPolicy>
</snapshots>
<id>caucho</id>
<name>Caucho</name>
<url>http://caucho.com/m2-snapshot</url>
</pluginRepository>
</pluginRepositories>
<build>
<finalName>foo</finalName>
<plugins>
<plugin>
<groupId>com.caucho</groupId>
<artifactId>resin-maven-plugin</artifactId>
<version>4.0-SNAPSHOT</version>
<configuration>
<server>127.0.0.1</server>
<port>8086</port>
<user>foo</user>
<password>test</password>
</configuration>
</plugin>
</plugins>
</build>
</project>
Maven Mojo Reference| MOJO | PARAMETER NAME | SYSTEM PROPERTY | REQUIRED? | DEFAULT | DESCRIPTION |
|---|
| COMMON PROPERTIES FOR ALL MOJOS | server | resin.server | Yes | N/A | The IP or address of the Resin server |
|---|
| port | resin.port | Yes | N/A | The port of the Resin server's HTTP port | | user | resin.user | Yes | N/A | The user to use when logging into the Resin server | | password | resin.password | Yes | N/A | The password to use when logging into the Resin server | | commitMessage | resin.commitMessage | No | N/A | The commit message to log for any changes to the application repository | | RESIN:UPLOAD-WAR | warFile | resin.warFile | Yes | ${project.build.directory}/ ${project.build.finalName}.war (the war file produced for the project) | The war file to upload to the Resin server |
|---|
| stage | resin.stage | No | "default" | The stage to use for the deployed application | | virtualHost | resin.virtualHost | No | "default" | The virtual host to use for the deployed application | | contextRoot | resin.contextRoot | Yes | /${project.build.finalName} (the "final name" of the project) | The context root of the deployed application | | version | resin.version | No | N/A | The version to use for the deployed application | | archive | resin.archive | No | false | When set to true, an archive tag is set in addition to the main tag. Can also be an explicit tag. | | writeHead | resin.writeHead | No | true | When set to true and using versioning, a "head" tag is also set. | | RESIN:COPY-TAG | stage | resin.stage | No | "default" | The stage of the target tag |
|---|
| virtualHost | resin.virtualHost | No | "default" | The virtual host of the target tag | | contextRoot | resin.contextRoot | Yes (if tag not given) | /${project.build.finalName} (the "final name" of the project) | The context root of the target tag | | version | resin.version | No | N/A | The version of the target tag | | sourceStage | resin.sourceStage | No | "default" | The stage of the source tag | | sourceVirtualHost | resin.sourceVirtualHost | No | "default" | The virtual host of the source tag | | sourceContextRoot | resin.sourceContextRoot | Yes (if sourceTag not given) | N/A | The context root of the source tag | | sourceVersion | resin.sourceVersion | No | N/A | The version of the source tag | | tag | resin.tag | Yes (if contextRoot not given) | N/A | An explicit target tag | | sourceTag | resin.sourceTag | Yes (if sourceContextRoot not given) | N/A | An explicit source tag | | RESIN:DELETE-TAG | stage | resin.stage | No | "default" | The stage of the tag to be deleted |
|---|
| virtualHost | resin.virtualHost | No | "default" | The virtual host of the tag to be deleted | | contextRoot | resin.contextRoot | Yes (if tag not given) | /${project.build.finalName} (the "final name" of the project) | The context root of the tag to be deleted | | version | resin.version | No | N/A | The version of the tag to be deleted | | tag | resin.tag | Yes (if contextRoot not given) | N/A | An explicit tag to be deleted | | RESIN:QUERY-TAGS
| stage | resin.stage | Yes (At least one pattern (either stage, virtualHost, contextRoot, version, or pattern) must be given | "default" | The query pattern for the stage portion of tags in the repository
|
|---|
| virtualHost | resin.virtualHost | Yes (At least one pattern (either stage, virtualHost, contextRoot, version, or pattern) must be given | "default" | The query pattern for the virtual host portion of tags in the repository | | contextRoot | resin.contextRoot | Yes (At least one pattern (either stage, virtualHost, contextRoot, version, or pattern) must be given | /${project.build.finalName} (the "final name" of the project) | The query pattern for the context root portion of tags in the repository | | version | resin.version | Yes (At least one pattern (either stage, virtualHost, contextRoot, version, or pattern) must be given | N/A | The query pattern for the version portion of tags in the repository | | pattern | resin.pattern | Yes (At least one pattern (either stage, virtualHost, contextRoot, version, or pattern) must be given | N/A | An explicit query pattern for entire tags in the repository |
Using the Ant tasks
<project xmlns:resin="antlib:com.caucho.ant">
<-- if resin-ant.jar is not installed locally -->
<taskdef uri="antlib:com.caucho.ant"
resource="com/caucho/ant/antlib.xml"
classpath="path/to/resin-ant.jar"/>
<resin:upload-war
resinHome="${resin.home}"
server="localhost"
port="8086"
user="foo"
password="test"
warFile="/tmp/caucho/qa/foo.war"
context="bar"
logLevel="finer"/>
Ant Task Reference| TASK NAME | PARAMETER NAME | REQUIRED? | DEFAULT | DESCRIPTION |
|---|
| COMMON PROPERTIES FOR ALL TASKS | server | Yes | N/A | The IP or address of the Resin server |
|---|
| resinHome | Yes | N/A | Path to Resin Installation | | resinConf | No | ${resin.home}/resin.xml | Path to Resin Configuration | | port | Yes | N/A | The port of the Resin server's HTTP port | | user | Yes | N/A | The user to use when logging into the Resin server | | password | Yes | N/A | The password to use when logging into the Resin server | | message | No | N/A | The commit message to log for any changes to the application repository | | RESIN-UPLOAD-WAR (COM.CAUCHO.ANT.RESINUPLOADWAR) | warFile | Yes | N/A | The war file to upload to the Resin server |
|---|
| context | No | /[war file prefix] | The context root of the deployed application | | host | No | "default" | The virtual host to use for the deployed application | | stage | No | "default" | The stage to use for the deployed application | | version | No | N/A | The version to use for the deployed application | | RESIN-COPY-TAG (COM.CAUCHO.ANT.RESINCOPYTAG) | sourceContext | Yes | N/A | The context root of the source tag |
|---|
| sourceHost | No | "default" | The virtual host of the source tag | | sourceStage | No | "default" | The stage of the source tag | | source-version | No | N/A | The version of the source tag | | targetContext | Yes | N/A | The context of the target tag | | targetHost | No | "default" | The virtual host of the target tag | | targetStage | No | "default" | The stage of the target tag | | targetVersion | No | N/A | The version of the target tag | | RESIN-DELETE-TAG (COM.CAUCHO.ANT.RESINDELETETAG) | context | Yes (if tag not given) | N/A | The context root of the tag to be deleted |
|---|
| host | No | "default" | The virtual host of the tag to be deleted | | stage | No | "default" | The stage of the tag to be deleted | | version | No | N/A | The version of the tag to be deleted | | tag | Yes (if context not given) | N/A | An explicit tag to be deleted | | RESIN-QUERY-TAGS (COM.CAUCHO.ANT.RESINQUERYTAGS) | context | Yes (At least one pattern (either stage, host, context, version, or pattern) must be given | ".*" | The query pattern for the context root portion of tags in the repository |
|---|
| host | Yes (At least one pattern (either stage, virtualHost, contextRoot, version, or pattern) must be given | "default" | The query pattern for the virtual host portion of tags in the repository | | stage | Yes (At least one pattern (either stage, virtualHost, contextRoot, version, or pattern) must be given | "default" | The query pattern for the stage portion of tags in the repository | | version | Yes (At least one pattern (either stage, virtualHost, contextRoot, version, or pattern) must be given | N/A | The query pattern for the version portion of tags in the repository | | pattern | Yes (At least one pattern (either stage, virtualHost, contextRoot, version, or pattern) must be given | N/A | An explicit query pattern for entire tags in the repository |
| Copyright © 1998-2012 Caucho Technology, Inc. All rights reserved. Resin ® is a registered trademark. Quercustm, and Hessiantm are trademarks of Caucho Technology. |
|