main website home
  • About this blog

    This blog features updates, opinions, and technical notes from Caucho engineers about Caucho products, the enterprise Java industry, and PHP. Caucho Technology is the creator of the Resin Application Server and the Quercus PHP in Java engine. A leader in Java performance since 1998, Caucho is a Sun JavaEE licensee with over 9000 customers worldwide.
  • Tags

    ajaxworld bam candi cdi cloud cluster comet configuration deploy devoxx eclipse ejb embedded flash flex google app engine hessian hmtp ioc java ee 6 javaone javazone jms messaging newsletter nyjug osgi php pomegranate quercus resin resin 4.0 REST servlet sfjug silicon valley code camp spring testing training tssjs watchdog webbeans web profile websockets wordpress
  • Meta

    • Register
    • Log in
    • Entries RSS
    • Comments RSS
    • WordPress.org
« HMTP/WebSocket - actor messaging for Hessian
Updating the Eclipse Plugin »

Extending Resin’s command set

As I was working on the Resin’s NetBeans plug-in I started to realize that we needed to change the model we use for plugins. Previously, we packaged Resin’s classes with the plugins. That presented us with number of challenges ranging from keeping the plugins in sync with the Resin’s code to having to release the plugins every time we release a new version of Resin.

The solution was in introducing a level of indirection that came in the form an updated Resin CLI interface. Initially, the interface is extended with the commands required for the plugin to work. That included the deployment commands and web-application administration commands.

Deployment commands allow use of CLI to deploy, undeploy, copy and list applications deployed on Resin server. Although we may still change a thing or two in options, the basic syntax will be maintained and will allow us to have Ant, Maven, Eclipse and NetBeans plugins go into a more stable state, with less frequent releases. That means developers who use the plugins will see them break very seldom.

To show some of the new deployment commands I’ll start with a deploy, list commands.

The complete syntax of the commands may be a bit involved, so I’ll use the set of options that is likely to be useful to everyone. A complete description is available with bin/resin.sh help e.g. bin/resin.sh help deploy.

Provided that there is a /tmp/test.war file, deploying it to Resin is done with ‘deploy’ command from Resin’s home directory.

# java -jar lib/resin.jar -conf conf/resin.xml deploy -user admin -password secret /tmp/test.war
Deployed production/webapp/default/test as /tmp/test.war to http://127.0.0.1:8087/hmtp

In the absence of a -name attribute the application will be deployed to a /test context. Deploying application to a specific context can be specified with a ‘-name’ option.

# java -jar lib/resin.jar -conf conf/resin.xml deploy -user admin -password secret -name foo test.war
Deployed production/webapp/default/foo as /tmp/test.war to http://127.0.0.1:8087/hmtp

Parameter ‘-conf’ in the commands above is optional and is only used as an alternative to specifying ‘-address’ and ‘-port’ options. Options ‘-address’ and ‘-port’ can be specified when deploying to a remote server. The ip/hostname and http port of the server should be specified with an ‘-address’ and ‘-port’ options respectively.

Command ‘list’ lists all applications deployed on Resin.

# java -jar lib/resin.jar -conf conf/resin.xml deploy-list -user admin -password secret
production/webapp/default/foo

Output ‘production/webapp/default/foo’ breaks down as following

production – stage
webapp – type of an application
default - host
foo - context

Before we look at the undeploy command let’s look at web-app administration commands ’start-webapp’, ’stop-webapp’ and ‘restart-webapp’.

Once deployed, an application is started automatically. Stopping an application can be done with ’stop-webapp’ command. A context to stop is specified as the last argument to the command: ‘foo’.

# java -jar lib/resin.jar -conf conf/resin.xml stop-webapp -user admin -password secret foo
production/webapp/default/foo’ is stopped

A stopped application can be started again using either of the ’start-webapp’ or ‘restart-webapp’ commands.

# java -jar lib/resin.jar -conf conf/resin.xml restart-webapp -user admin -password secret foo
‘production/webapp/default/foo’ is restarted

Finally, let’s look at an example of using an ‘undeploy’ command:

# java -jar lib/resin.jar -conf conf/resin.xml undeploy -user admin -password secret foo
Undeployed foo from http://127.0.0.1:8087/hmtp

Resin configuration for deployment.

For resin to respond to deploy and web app management commands resin.xml needs to register deploy-service and an administrator account.

Configuring Deploy Service

<management> <deploy-service> </management>

Configuring an administrator account

<sec:AdminAuthenticator password-digest="none" xmlns:sec="urn:java:com.caucho.security"> <sec:user name="foo" password="test"/> </sec:AdminAuthenticator>

Sample configuration

<resin xmlns="http://caucho.com/ns/resin" xmlns:admin="urn:java:com.caucho.admin" xmlns:sec="urn:java:com.caucho.security"> <management> <deploy-service/> </management> <cluster id="app-tier"> <sec:AdminAuthenticator password-digest="none"> <sec:user name="admin" password="secret"/> </sec:AdminAuthenticator> <admin:RemoteAdminService/> <server id="" port="8086"> <http port="8087"/> </server> <host id=""> <web-app-deploy path="webapps"/> </host> </cluster> </resin>

Tags: deploy, resin cli, starting web-app, stoping web-app, undeploy

This entry was posted on Tuesday, December 21st, 2010 at 2:47 pm and is filed under Uncategorized. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

3 Responses to “Extending Resin’s command set”

  1. mros2stf Says:
    January 6th, 2011 at 6:23 am

    Will these “new commands” be available in Resin 4.0.14? Also, when will the “new” NetBeans plugin be available.

    Thanks,
    Steve

  2. alex Says:
    January 11th, 2011 at 3:30 pm

    Hi Steve,

    Yes, 4.0.14 supports the described commands. NetBeans plugin can be downloaded from http://www.caucho.com/netbeans/

  3. mros2stf Says:
    January 20th, 2011 at 3:06 pm

    Thanks, but the above link doesn’t work.

Leave a Reply

You must be logged in to post a comment.


Caucho Technology is proudly powered by WordPress and Quercus®
Entries (RSS) and Comments (RSS).

  • HOME |
  • CONTACT US |
  • DOCUMENTATION |
  • BLOG |
  • WIKI 4 |
  • WIKI 3 |
  • Resin: Java Application Server
Copyright (c) 1998-2012 Caucho Technology, Inc. All rights reserved.
caucho® , resin® and quercus® are registered trademarks of Caucho Technology, Inc.
resin® is a cloud optimized, java® application server that supports the java ee webprofile ®