27.2. Extended Example: Common Provisioning Use Cases (and How They Handle Files)
- Deploying a full application server
- Deploying a web application to an application server
- Deploying configuration files
Important
27.2.1. Deploying A Full Application Server
This is the core use for the provisioning system, deploying an entire application server. This bundle contains the complete configuration stack for a server like JBoss EAP (or Tomcat or Apache). The bundle contains all of the files used by the application — the JAR and configuration files and scripts for the EAP server, and all EAR or WAR web applications that are to be deployed on that EPA instance. All of the application server and web app files and directories are zipped into an archive, with the deploy.xml
which defines the Ant recipe.
Because this is a complete application server, it will be deployed into its own, new (or empty) directory, such as /opt/my-application
. That directory will be dedicated to the application server, so it will be entirely managed by the bundle.
compliance
is set to full. This means:
- Only files and subdirectories in the bundle distribution file will be in the root directory.
- Any existing files or subdirectories will be deleted.
- If files or subdirectories are added to the root directory, then they will be deleted when the bundle is updated or redeployed, unless those files are explicitly ignored (a setting in the recipe).
27.2.2. Deploying A Web Application
/opt/my-application/deploy
myApp1.war
to the deploy/
directory.
/opt/my-application/deploy/myapp1.war/
In this case, the bundle file contains only the WAR file itself and the deploy.xml
recipe.
Unlike the application server, when deploying the web app, there are or could be other web apps also in the deploy/
directory. The bundle system, then, should not manage the root directory, meaning existing or new files should be allowed within the root directory even if they are not included in the bundle.
compliance=fileAndDirectories
, which tells the provisioning system to leave alone any existing files in the directory that are outside the bundle.
Note
compliance=filesAndDirectories
only preserves files outside the bundle deployment. If the bundle directory is deploy/myApp/
, then any files in deploy/myApp/
or subdirectories like deploy/myApp/WEB-INF/
will be overwritten or removed when the bundle is deployed. The subdirectories defined in the bundle distribution are still entirely managed by the bundle system.
- Include all of the web applications in the same bundle distribution. For example, to deploy
myApp1.war
andmyApp2.war
to thedeploy/
directory, both WAR files can be included in the same bundle and deployed todeploy/myApp1.war/
anddeploy/myApp2.war/
simultaneously. - It may not be possible to roll all of the web apps into the same bundle. Instead of using
deploy/
as the root directory, there could be two different bundle distributions that use a subdirectory as the root directory. For example, the first web app could usedeploy/myApp1/
so that the final deployment isdeploy/myApp1/myApp1.war/
, while the second app usesdeploy/myApp2/
, resulting indeploy/myApp2/myApp2.war/
.This allows the two web applications to be deployed, updated, and reverted independently of each other.
27.2.3. Deploying Configuration Files
- New login configuration, in
server/default/conf/login-config/xml
- New JMX console users, in
server/default/conf/props/jmx-console.properties
conf/
directory for the application server.
The bundle must contain all of the files that are expected to be in the conf/login-config/
and conf/props/
subdirectories, not just the two new files that the administrator wants to use. Additionally, the compliance
parameter in the recipe must be set to filesAndDirectories so that all of the existing configuration files in the root directory, conf/
, are preserved.
As with deploying a web app, the intent is to add new content, not to replace existing content. Setting compliance=filesAndDirectories
only preserves files outside the bundle deployment. However, because there are two subdirectories defined in the bundle, JBoss ON will manage all of the content in those subdirectories. This means:
- The recipe has to have
compliance=filesAndDirectories
set for the bundle to preserve the other files in theconf/
root directory. - Any files in the subdirectories of the bundle —
conf/log-config/
andconf/props/
— will be overwritten when the bundle is deployed. The provisioning process can ignore files in the root directory, but it always manages (meaning, updates, adds, or deletes) files in any subdirectories identified in the bundle so that they match the content of the bundle. - Existing files in the
conf/log-config/
andconf/props/
subdirectories must be included in the bundle distribution.
Note
/opt/bundle/
. Then, an Ant post-install task can be defined in the recipe that copies the configuration files from the root directory into the application server's conf/
directory.