Overview
A fabric application can include any number of files which are packaged up into a fabric application (.fabric file) and deployed to the fabric. The fabric also supports a special "application configuration file" that can be versioned and deployed separately from the fabric application. The fabric will store this file in the root directory of the application (i.e, the current working directory of the application) prior to starting the application.
Use of this file is optional. The content and format of the file is user-defined except for a required version property and a number of optional Java configuration settings. The name of the file must match the user's fabric application name (i.e., the configuration file for the application my-fabric-app is my-fabric-app.cfg).
The user code of the application should read the content of this file to "parameterize" its behavior (configuration information that wouldn't be sent in each request to invoke an application service. This file can be used to (re)configure the behavior of the user's fabric application without changing or redeploying the application. For example, the configuration file could contain information about database connection strings, host addresses, timeouts, etc. And by deploying a new version of the configuration file with new values for these strings, the application's behavior can be updated/changed – all without repackaging the application.
Creating an application configuration file
As stated, the format of the file is user-defined, with the exception of a single version property as shown below. The version property value is a sequence of numeric characters and dots (i.e., [0-9\.]). The version property should be on a line of its own somewhere in the file. An example:
Deploying an application configuration file
The configuration file can be deployed with the application by using the fabric_ctl deploy-app command. The configuration file can also be deployed separately to a fabric that already has the fabric application deployed (whether the configuration file has been previously deployed or not)by using the fabric_ctl deploy command. Versioning rules apply: the configuration file that is being deployed must have a version number larger that the currently deployed version. Note: the version of the application is not considered in determining the version of the configuration file - the configuration file's version can be less than, equal to, or greater than the version of the deployed application. The following example outlines deploying the configuration file with the application, making some changes to the configuration file and redeploying the file.
$ [package application]
$ [create application.cfg]
version=1.0
server=jupitor
connection-caching=enabled
...
$ fabric_ctl deploy-app application.fabric application.cfg
$ [change application.cfg and update version]
version=1.0.1
server=mars
...
$ fabric_ctl deploy application.cfg
Attempting to deploy an application configuration file by itself with no corresponding application already deployed will result in a deployment error. If the application package contains a file by the same name as the application configuration file, it will be overwritten by the current application configuration file before the application is loaded.
Special application configuration properties
The fabric supports some special configuration values in the application configuration file that override values from the fabric-wide fabric.cfg. Refer to Controlling Application ClassLoader in Configuring Java for more details).
Fabric configuration values in an XML file
The fabric configuration properties are in a form similar to Java configuration files. This can be at odds when the application developer would prefer to use XML for the configuration file format. The following example provides a solution for applications that use an XML file for configuring their user code:
<configuration>
<some-app-settings>
...
</some-app-settings>
<fabricConfiguration>
version=3.8.0.9
fabric-additional-user-classpath=/var/opt/utils/utils.jar|/var/tops/utils/common.jar
fabric-additional-user-classpath-separator=|
</fabricConfiguration>
</configuration>