Chapter 5. Provisioning Applications

Provisioning is a more advanced form of configuration management. Provisioning takes uploaded packages and deploys them on targeted resources with instance-specific configuration. This makes it easier to deploy applications like JBoss, as well as patches and updates, consistently.

5.1. About Provisioning

Most types of applications can be deployed from a simple archive file. JBoss ON provides a way to upload or access those archive files and deploy them all at once, to all the platforms in a group.
The provisioning system in JBoss ON has basically two elements:
  • An entity that is made of the files and specs of the application — the bundle
  • The place where the application is installed (deployed) — the destination
Each version of a bundle and each destination where the bundle is deployed is collected into the bundle definition. From the top level, viewing a bundle shows all of the different versions of the bundle and all of the deployment destinations. Looking at a destination folder shows all of the versions that are deployed there, while looking at a version entry shows all of the files and recipes in that version and a list of all of the destinations where it is deployed.
Bundles, Versions, and Destinations

Figure 5.1. Bundles, Versions, and Destinations


A bundle is composed of file that defines the metadata and processing rules for the bundle and then all of the files required for the application. These elements can be combined into a single bundle distribution file, which is an archive file.
Naturally, the first part of provisioning an application is actually writing the application. From there, the application files are gathered together into some kind of archive. To complete the bundle, write the recipe and any configuration files or scripts that are used by the application.
When a bundle is deployed, all of the files defined in that bundle are first copied over to the destination servers. Then, any templatized configuration files are realized by having the real values written in for the tokens. The recipe can also contain scripts which are invoked during provisioning to complete setting up the application.

IMPORTANT

Provisioning requires both the JBoss ON server and agent to use JDK 6.0. The agent cannot use a JRE for Java libraries.

5.1.1. About Bundles

The application that is deployed is defined in a bundle package. The bundle contains a recipe which sets the metadata, tokens that represent user- or system-defined values, and list of files that are covered in the application. The bundle also contains the files referenced in the recipe.
The recipe sets a version number for the bundle, so that the same application can have multiple versions available through the same bundle definition. Ultimately, versioning bundles simplifies application maintenance by providing an audit trail of changes and a path to rollback changes and apply updates smoothly. The recipe must follow a format that the server recognizes for it to be validated and loaded. JBoss ON; recognizes Ant recipes by default. Additional bundle types can be added by creating the requisite agent plug-ins.

NOTE

The ability to process an Ant bundle is given in a special JBoss ON server service, Ant Bundle Handler.
The Ant bundle handler is added automatically to platforms as a service resource to enable Ant-based provisioning. Without that Ant bundle handler in the inventory, JBoss ON cannot perform provisioning on that platform.
Administrators do not have to interact directly with the Ant bundle handler resource, but that child resource must be present in the platform's inventory for Ant provisioning to work.
The application bundle files can be both archive files that contain the application and configuration files. The provisioning process doesn't have any kind of file requirements; there can be multiple archive files, multiple configuration files, or only one file associate with the bundle.
The bundle files can be uploaded to JBoss ON itself, similar to the content management and repository systems in JBoss ON, or can be accessed through a given URL. This allows packages to be downloaded directly from GIT or SVN repositories, FTP sites, or other centralized locations. Either way, the provisioning system copies and unpacks a bundle archive file on the destination platform. The provisioning process has default commands that it uses to unpack each type of archive and deploy the bundle archive, depending on what is detected when the bundle is deployed. The Ant provisioning system can process both JAR and ZIP archive files.

5.1.2. About Destinations

A bundle is copied over, unzipped, and any templatized values are filled in on a specified platform. The place where a bundle is deployed is a destination. A destination has two parts: a group and a defined directory location.
JBoss ON groups are automatically linked to the bundles system as long as those groups only contain platforms. A bundle can only be deployed to a platform. The second part of the destination gives the specific directory where the application is deployed, and that provides some flexibility. A bundle can be deployed in a general directory like /opt or can be deployed in a JBoss AS container.