Some popular services have applications that are easy to configure.
Windows
Deploying an application for a Windows service is a relatively simple process. Create a Fabric Archive (FAR) Definition XML file that will direct the installation and operation of the application:
<?xml version="1.0" encoding="utf-8"?>
<far xmlns="http://www.appistry.com/ns/far"
name="win-service-application"
version="1.00"
display-name="Generic Application for Generic Service"
description="This application runs under a generic Windows service.">
<support-files>
<file name="service-application_1.0-win32-x86.msi"/>
<file name="service-app-settings.cfg"/>
<file name="install.bat"/>
<file name="uninstall.bat"/>
</support-files>
<service-app service="win-service">
<install>
<exec executable="install.bat"
output="instout.txt"
error="insterr.txt"
timeout="3 minutes"/>
</install>
<uninstall>
<exec executable="uninstall.bat"
output="uninout.txt"
error="uninerr.txt"
timeout="3 minutes"/>
</uninstall>
</service-app>
</far>
Service Attribute (required)
The '<service-app>' element's 'service' attribute is required and will allow the fabric to associate the application with a particular service. Control of the application is intended to be managed by the parent service...no 'start' or 'stop' controls will be deployed by the fabric.
Support Files (optional)
Miscellaneous files to be added to the package. From within the fabric, these files can be found by fabric applications by prepending '$FABRIC_HOME/fars/far-name' to the path of the file, where 'far-name' is the FAR's name (for example, win-service), as written in the 'far' element's attribute. If required, include a configuration file (for example, 'service-app-settings.cfg').
Install Element (required)
Any executable program or script for installing the application. An 'arg' sub-element is optional. The 'install' element will be executed one time, when the application is deployed. The application must be able to be installed quietly (i.e., no user prompts). For example:
@echo off
service-application_1.0-win32-x86.msi /q
copy settings.cfg "C:\Program Files\Windows Service Company\win-service-application1.0\config"
 | No Script Required If no configuration files are needed, the service-application-installer could be referenced directly from the 'install' element, without an 'install.bat'. |
Uninstall Element (required)
Any executable program or script for uninstalling the application. An 'arg' sub-element is optional. Create an 'uninstall.bat', which will be invoked one time, if the service is deleted or if a newer version is deployed. For example:
@echo off
msiexec /uninstall service-application_1.0-win32-x86.msi /quiet
rd /q /s "C:\Program Files\Windows Service Company\win-service-application1.0"
Package and Deploy
Use the fabric_pkg command to package the FAR:
fabric_pkg create win-service-application.xml -verbose
Deploy the newly created 'win-service-application.far' using the fabric_ctl deploy command:
fabric_ctl deploy win-service-application.far
Linux
Deploying an application for a Linux service is a relatively simple process. Create a Fabric Archive (FAR) Definition XML file that will direct the installation and operation of the application:
<?xml version="1.0" encoding="utf-8"?>
<far xmlns="http://www.appistry.com/ns/far"
name="linunx-service-application"
version="1.00"
display-name="Generic Application for Generic Service"
description="This application runs under a generic Linux service.">
<support-files>
<file name="service-application_1.0.tar.gz"/>
<file name="service-app-settings.cfg"/>
<file name="install.sh"/>
<file name="uninstall.sh"/>
</support-files>
<service-app service="linux-service" rights="elevated">
<install>
<exec executable="sh"
output="instout.txt"
error="insterr.txt"
timeout="3 minutes">
<arg value="install.sh"/>
</exec>
</install>
<uninstall>
<exec executable="sh"
output="uninout.txt"
error="uninerr.txt"
timeout="3 minutes">
<arg value="install.sh"/>
</exec>
</uninstall>
</service-app>
</far>
Service Attribute (required)
The '<service-app>' element's 'service' attribute is required and will allow the fabric to associate the application with a particular service. Control of the application is intended to be managed by the parent service...no 'start' or 'stop' controls will be deployed by the fabric.
Rights Attribute (optional)
Depending on the rights required for installation of the application, the application can be installed with elevated rights. The above XML uses '<service-app ... rights="elevated">' to install and run the service with the same permission given to 'fabric_system_service' during installation ('root').
Support Files (optional)
Miscellaneous files to be added to the package. From within the fabric, these files can be found by fabric applications by prepending '$FABRIC_HOME/fars/far-name' to the path of the file, where 'far-name' is the FAR's name (for example, linux-service), as written in the 'far' element's attribute. If required, include a configuration file (for example, 'service-app-settings.cfg').
Install Element (required)
Any executable program or script for installing the application. An 'arg' sub-element is optional. The 'install' element will be executed one time, when the application is deployed. The application must be able to be installed quietly (i.e., no user prompts). For example:
#!/bin/sh
/bin/tar zxf service-application_1.0.tar.gz /usr/local/service-application_1.0.tar.gz
/bin/cp service-app-settings.cfg /usr/local/linux-service/service-application_1.0/.
./setup
 | No Script Required The service-application-installer could be referenced directly from the 'install' element as an executable with arguments. |
Uninstall Element (required)
Any executable program or script for uninstalling the application. An 'arg' sub-element is optional. Create an 'uninstall.sh', which will be invoked one time, if the service is deleted or if a newer version is deployed. For example:
#!/bin/sh
/bin/rm -rf /usr/local/linux-service/service-application_1.0/
Package and Deploy
Use the fabric_pkg command to package the FAR:
fabric_pkg create linux-service-application.xml -verbose
Deploy the newly created 'linux-service-application.far' using the fabric_ctl deploy command:
fabric_ctl deploy linux-service-application.far