[jboss-dev-forums] [JBoss AS 7 Development] - CLI deployment archive
Alexey Loubyansky
do-not-reply at jboss.com
Thu Jul 26 10:36:32 EDT 2012
Alexey Loubyansky [https://community.jboss.org/people/aloubyansky] created the document:
"CLI deployment archive"
To view the document, visit: https://community.jboss.org/docs/DOC-18945
--------------------------------------------------------------
Sometimes installing an application and setting up an environment for it may consist of deploying multiple application archives and modifying server configurations (adding new services, adjusting some settings, etc). Doing all this by hand every time you need to deploy and undeploy the application could be a tedious task. One thing that could help here is https://community.jboss.org/docs/DOC-16728 batches. Another one, which was introduced specifically to make it easier to install/uninstall complex applications, is CLI deployment archive.
A CLI deployment archive is a JAR file with *.cli* extension containing application archives that should be deployed and CLI script files containing commands and operations: one script file contains commands and operations that deploy the application archives and set up the environment and the other one undeploys the application archives and cleans up the environment.
Let's look at a simple example. Suppose, we have a simple CLI archive with three WAR files and two scripts
[xxx at xxx xxx]$ jar -tf test.cli
deployment0.war
deployment1.war
deployment2.war
deploy.scr
undeploy.scr
deploy.scr:
deploy deployment0.war
deploy deployment1.war
deploy deployment2.war
undeploy.scr:
undeploy deployment0.war
undeploy deployment1.war
undeploy deployment2.war
This archive can be deployed with a simple deploy command
[standalone at localhost:9999 /] deploy test.cli
#1 deploy deployment0.war
#2 deploy deployment1.war
#3 deploy deployment2.war
[standalone at localhost:9999 /]
By default, the deploy command handler will look for the +deploy.scr+ script file in the archive, so unless the script is named differently, there is no need to specify the script name.
Undeploying is easy as well
[standalone at localhost:9999 /] undeploy --path=test.cli
#1 undeploy deployment0.war
#2 undeploy deployment1.war
#3 undeploy deployment2.war
[standalone at localhost:9999 /]
Note, that you should specify the path to the archive as a value of the +--path+ argument of the +undeploy+ command. If you try +undeploy test.cli+ it will try looking for +test.cli+ among the registered deployed application archives and will fail. Only +deployment0.war+, +deployment1.war+ and +deployment2.war+ will be registered deployments. Argument-wise, it's a little inconsistent with the +deploy+ command but, although, +deploy test.cli+ is a shortcut for
[standalone at localhost:9999 /] deploy --path=test.cli
#1 deploy deployment0.war
#2 deploy deployment1.war
#3 deploy deployment2.war
[standalone at localhost:9999 /]
In this complete form, this scenario is consistent, i.e. you use +--path+ for both +deploy+ and +undeploy+ commands.
As with the +deploy+, +undeploy+ will look for the +undeploy.scr+ in the CLI arhive to uninstall the application and clean-up the environment. If your scripts are named differently (perhaps, you have different install/uninstall scripts in the same archive) you can use the +--script+ argument to specify which one you want to execute.
Let's add couple of alternative scripts to our archive.
[xxx at xxx xxx]$ jar -tf test.cli
deployment0.war
deployment1.war
deployment2.war
deploy.scr
undeploy.scr
install.scr
uninstall.scr
+install.scr+ deploys only two deployments out of three
deploy deployment0.war
deploy deployment1.war
And +uninstall.scr+ undeploys them
undeploy deployment0.war
undeploy deployment1.war
Now we can choose our non-default script to install
[standalone at localhost:9999 /] deploy --path=test.cli --script=install.scr
#1 deploy deployment0.war
#2 deploy deployment1.war
[standalone at localhost:9999 /]
and uninstall the applications
[standalone at localhost:9999 /] undeploy --path=test.cli --script=uninstall.scr
#1 undeploy deployment0.war
#2 undeploy deployment1.war
[standalone at localhost:9999 /]
--------------------------------------------------------------
Comment by going to Community
[https://community.jboss.org/docs/DOC-18945]
Create a new document in JBoss AS 7 Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=102&containerType=14&container=2225]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20120726/9377702a/attachment.html
More information about the jboss-dev-forums
mailing list