JBoss EAP - Override Deployment Content
A deployment overlay can be used to overlay content into an existing deployment without physically modifying the contents of the deployment archive. This can override deployment descriptors, JAR files, classes, JSP pages, and other files at runtime.When defining a deployment overlay, you specify the file on a file system that will replace the file in the deployment archive. You must also specify which deployments should be affected by the deployment overlay. Any affected deployments must be redeployed in order for the changes to take effect.
JBoss CLI
Start the JBoss application server and run the jboss-cli command tool in the bin folder of your JBoss EAP install directoryjboss-cli.sh --controller=: -c
Example:
jboss-cli.sh --controller=localhost:9999 -c
Find name of deployments
[standalone@localhost:9999 /] /deployment=*:read-attribute(name=name) { "outcome" => "success", "result" => [{ "address" => [("deployment" => "my-app.war")], "outcome" => "success", "result" => "my-app.war" }] }
Deployment overlay help
Display all the help for the deployment-overlay commanddeployment-overlay --help
List links
Lists deployments the overlay is linked to:- deployment-overlay list-links --name=overlay_name [-l] [--server-groups=server_group_name(,server_group_name)*]
Example:
deployment-overlay list-links --name=my-app-deployment-overlay
Add action
Use the deployment-overlay add management CLI command to add a deployment overlay. Once created, you can add content to an existing overlay, link the overlay to a deployment, or remove the overlay.- always creates a new overlay with content;
- optionally links it to the specified existing deployments;
- also optionally re-deploys the affected (linked) deployments.
Options
- name
- overlay_name
- content
- archive_path=fs_path(,archive_path=fs_path)*. Comma-separated list that maps the file on the file system to the file in the archive that it will replace.
- server-groups/all-server-groups
- server_group_name(,server-group-name)*. In a managed domain, specify the applicable server groups by using --server-groups or specify all server groups with --all-server-groups.
- deployments
- deployment_name(,deployment_name)*. Comma-separated list of deployments to which this overlay will be linked.
- wildcards
- wildcard_name(,wildcard_name)*
- redeploy-affected
- Redeploys all affected deployments.
- headers
- {operation_header (;operation_header)*}
Examples
deployment-overlay add --name=my-app-deployment-overlay --content=WEB-INF/jboss-web.xml=/app/jboss-eap-6.4/standalone/deployment-overlay/jboss-web.xml --deployments=my-app.war --redeploy-affected
Nested deployments
If you have an zipped deployment with multiple zipped JAR's, WARs, etc. containing artifacts you want overlaying, then you need to include the name of the nested archive in the --content option. For example, if the EAR archive contains a war module in the root folder with the name my-app.war, then the following command overlays the WEB-INF/jboss-web.xml inside the sub-deployment my-app.war.
deployment-overlay add --name=myOverlay --content=/my-app.war/WEB-INF/jboss-web.xml=/app/jboss-eap-6.4/standalone/deployment-overlay/jboss-web.xml --deployments=test.ear --redeploy-affectedOverlay Classes
deployment-overlay add --name=classOverlay --content=/WEB-INF/classes/com/mydomain/MyClass.class=/app/jboss-eap-6.4/standalone/deployment-overlay/bin/com/mydomain/MyClass.class --deployments=my-app.war --redeploy-affected
Remove action
Depending on the arguments the action may:- unlink deployments (if --deployments or --wildcards argument is specified);
- remove content (if --content argument is specified);
- remove the overlay altogether with its content and links;
- re-deploy affected deployments.
Options
- name
- overlay_name
- content
- archive_path=(,archive_path)*
- server-groups/all-relevant-server-groups
- server_group_name(,server_group_name)*
- deployments
- deployment_name(,deployment_name)*
- wildcards
- wildcard_name(,wildcard_name)*
- redeploy-affected
- headers
- {operation_header (;operation_header)*}
Unlink deployments
deployment-overlay remove --name=my-app-deployment-overlay --deployments=my-app.war
1 comment:
Very creattive post
Post a Comment