Caucho maker of Resin Server | Application Server (Java EE Certified) and Web Server


 

Resin Documentation

home company blog docs 
app server 
 Resin Server | Application Server (Java EE Certified) and Web Server
 

deployment from the command-line


.war files can be deployed to a cluster using the Resin command-line. The uploaded file will be distributed to all Resin servers.

resin.xml requirements

For security reasons, Resin's deployment must be enabled in the resin.xml. The default behavior is to disable deployment.

The configuration has four requirements:

  • Start the RemoteAdminService to enable remote administration.
  • Add an AdminAuthenticator to protect deployment with a password.
  • Start the DeployService itself to enable remote deployment.
  • A web-app-deploy to provide a location for the deployed .war files.
Example: minimal resin.xml for deployment
<resin xmlns="http://caucho.com/ns/resin"
       xmlns:resin="urn:java:com.caucho.resin">

  <cluster id="app-tier">
    <resin:AdminAuthenticator password-digest="none">
      <user name="foo" password="test"/>
    </resin:AdminAuthenticator>

    <resin:RemoteAdminService/>
    <resin:DeployService/>

    <server id="" port="6800">
       <http port="8080"/>
    </server>

    <host id="">
      <web-app-deploy path="webapps"
           expand-preserve-fileset="WEB-INF/work/**"/>
    </host>
  </cluster>
</resin>

command-line deployment

deploy for default host

The "deploy" command deploys a .war file to the default virtual host. Since the AdminAuthenticator requires a user and password, you'll need to pass those arguments as well.

Example: deploy hello.war
unix> resinctl deploy hello.war

undeploy for default host

The "undeploy" command removes a .war from the default virtual host. Since the AdminAuthenticator requires a user and password, you'll need to pass those arguments as well.

Example: undeploy hello
unix> resinctl undeploy hello

deploy with specified host

The "deploy" command allows a "-host" argument to specify a virtual host.

Example: deploy www.example.com hello.war
unix> resinctl deploy -host www.example.com hello.war

undeploy for www.example.com

The "undeploy" command removes a .war from the virtual host.

Example: undeploy www.example.com hello
unix> resinctl undeploy -host www.example.com hello

command-line deployment

Command line deployment capabilities were introduced in Resin 4.0.14. The set of commands allows deploying, undeploying, listing applications deployed on the server and controlling application lifecycle.

Synopsis of the provided commands and options

commands
COMMANDDESCRIPTION
deploydeploys an application archive
undeployun-deploys an application specified by a context
deploy-listlists all applications deployed on a server
deploy-copycopies an application from one context to another
webapp-startstarts web application context
webapp-stopstops web application context
webapp-restartrestarts web application context
common options
ARGUMENTMEANINGDEFAULT
-confconfiguration fileconf/resin.xml
-addressip or host name of the servertaken from conf/resin.xml
-portserver http porttaken from conf/resin.xml
-useruser name used for authentication to the servernone, required
-passwordpassword used for authentication to the servernone, required
-mcommit messagenone, optional

deploying application

Deploying an application is done with a deploy command

resinctl deploy [options] <war-file>
deploying an application from a hello-world.war archive
unix> resinctl deploy /projects/hello-world/hello-world.war

Deployed production/webapp/default/hello-world as hello-world.war to http://127.0.0.1:8080/hmtp
deploy options
ARGUMENTMEANINGDEFAULT
-hostvirtual host to make application available ondefault
-namename of the context to deploy to, defaults to war-file name[/foo].war
-stagespecifies stage for staging an applicationproduction
-versionversion of application formatted as <major.minor.micro.qualifier>none

listing deployed applications

Listing deployed applications is done with a deploy-list command

resinctl deploy-list [options]
unix> resinctl deploy-list

production/webapp/default/hello-world

copy application from context '/hello-world' to context '/foo'

Copying an applicaiton is done with a deploy-copy command

resinctl deploy-copy [options]
resinctl deploy-copy -source hello-world -target foo

copied production/webapp/default/hello-world to production/webapp/default/foo
deploy-copy options
ARGUMENTMEANINGDEFAULT
-sourcecontext to copy application fromnone
-source hosthost to copy application fromdefault
-source-stagesource stageproduction
-source-versionversion of the source application formatted as <major.minor.micro.qualifier>none
-targetcontext to copy application tonone
-target-hosthost to copy an application todefault
-target-stagetarget stageproduction
-target-versionversion application to use for a target, formatted as <major.minor.micro.qualifier>none

undeploying application

Undeploying an application is done with an undeploy command

resinctl undeploy [options] <name>
unix> resinctl undeploy undeploy foo

Undeployed foo from http://127.0.0.1:8080/hmtp
undeploy options
ARGUMENTMEANINGDEFAULT
-hostvirtual host to make application available ondefault
-stagespecifies stage for staging an applicationproduction
-versionversion of application formatted as <major.minor.micro.qualifier>none

starting application

Starting an application is done with a start-webapp command

unix> resinctl webapp-start [options] <name>
start web application deployed at context '/foo'
unix> resinctl webapp-start foo

'production/webapp/default/foo' is started
webapp-start options
ARGUMENTMEANINGDEFAULT
-hostvirtual host to make application available ondefault
-stagespecifies stage for staging an applicationproduction
-versionversion of application formatted as <major.minor.micro.qualifier>none

stopping application

Stopping an application is done with an stop-webapp command

resinctl webapp-stop [options] <name>
stop web application deployed at context '/foo'
unix> resinctl webapp-stop foo
 
'production/webapp/default/foo' is stopped
stop-webapp options
ARGUMENTMEANINGDEFAULT
-hostvirtual host to make application available ondefault
-stagespecifies stage for staging an applicationproduction
-versionversion of application formatted as <major.minor.micro.qualifier>none

restarting application

Restarting an application is done with an restart-webapp command

resinctl webapp-restart [options] <name>
stop web application deployed at context '/foo'
unix> resinctl webapp-restart foo

'production/webapp/default/foo' is restarted
restart-webapp options
ARGUMENTMEANINGDEFAULT
-hostvirtual host to make application available ondefault
-stagespecifies stage for staging an applicationproduction
-versionversion of application formatted as <major.minor.micro.qualifier>none

Copyright © 1998-2015 Caucho Technology, Inc. All rights reserved. Resin ® is a registered trademark. Quercustm, and Hessiantm are trademarks of Caucho Technology.