packaging/deployment
Resin provides a wide variety of custom packaging and deployment options. In this scenario, you want to configure a web-app with a specific root-directory and specify the location of the .war file. As usual, when Resin sees any changes in the .war file, it will expand the new data into the root-directory and restart the web-app. This capability, gives sites more flexibility where their directories and archive files should be placed, beyond the standard webapps directory. The optional
<resin xmlns="http://caucho.com/ns/resin"> <cluster id=""> <host id=""> <web-app id="/foo" root-directory="/var/www/foo" archive-path="/usr/local/stage/foo.war"/> </host> </cluster> </resin> The startup-mode is used in a number of places to determine the behaviour of a resource when the server starts. The startup-mode has three values: "automatic", "lazy", and "manual".
The redeploy-mode is used in a number of places to determine the behaviour of a resource when it is replaced or modified while the server is running. The redeploy-mode has two values: "automatic", and "manual".
Resin can deploy multiple versions of a web-app simultaneously, simplifying any application upgrades. The old version of the web-app will continue to receive old sessions, while the new version will get the new requests. So any user will see a consistent version as the web site update occurs with no downtime required. The versioning requires <web-app-deploy>, i.e. it works with the webapps directory. The versioning is numerically-based, allowing dotted notation, to determine the most recent version. A simple deployment process might use to upgrade from . A more complicated one might use to upgrade from .The attribute of the <web-app-deploy> enables versioning:<resin xmlns="http://caucho.com/ns/resin"> <cluster id=""> <host id=""> <web-app-deploy path="webapps" versioning="true"/> </host> </cluster> </resin> It may be possible to deploy a web application to a live server without interruption to service if certain conditions are met.
Resin allows you to have a backup instance running. The idea is that this backup instance of Resin takes over if your primary Resin instance goes down. If you are using a load balancer to distribute your load to multiple primary servers, each primary server has a backup server. You can use this feature to deploy to a live server without interruption of service.
As of Resin 4.0.0, it is now possible to deploy web applications remotely to a shared repository that is distributed across the cluster. This feature allows you to deploy once to any triad server and have the application be updated automatically across the entire cluster. When a new dynamic server joins the cluster, the triad will populate it with these applications as well. To deploy an application remotely:
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
deploying applicationDeploying an application is done with a
java -jar lib/resin.jar deploy -user admin -password secret /projects/hello-world/hello-world.war Deployed production/webapp/default/hello-world as hello-world.war to http://127.0.0.1:8080/hmtp
listing deployed applicationsListing deployed applications is done with a
java -jar lib/resin.jar deploy-list -user admin -password secret production/webapp/default/hello-world copy application from context '/hello-world' to context '/foo'Copying an applicaiton is done with a
java -jar lib/resin.jar deploy-copy -user admin -password secret -source hello-world -target foo copied production/webapp/default/hello-world to production/webapp/default/foo
undeploying applicationUndeploying an application is done with an
java -jar lib/resin.jar undeploy -user admin -password secret undeploy foo Undeployed foo from http://127.0.0.1:8080/hmtp
starting applicationStarting an application is done with an
java -jar lib/resin.jar start-webapp -user admin -password secret foo 'production/webapp/default/foo' is started
stopping applicationStopping an application is done with an
java -jar lib/resin.jar stop-webapp -user admin -password secret foo 'production/webapp/default/foo' is stopped
restarting applicationRestarting an application is done with an
java -jar lib/resin.jar restart-webapp -user admin -password secret foo 'production/webapp/default/foo' is restarted
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.
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: <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.
|