Skip to content

Instantly share code, notes, and snippets.

@cobracmder
Created October 9, 2012 18:51
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cobracmder/3860677 to your computer and use it in GitHub Desktop.
Save cobracmder/3860677 to your computer and use it in GitHub Desktop.
Sample Unicorn SMF Manifest
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<!--
Change:
TESTapp => your App Name
MYCOMPANY => your Company
UNICORN_PATH => where unicorn is located
APP_PATH => where your application is located
PATH_LISTING => what your PATH should be
USER => the user that should perform these actions
GROUP => the group that should perform these actions
-->
<service_bundle type="manifest" name="TESTapp">
<service name="network/MYCOMPANY/application/TEST" type="service" version="0">
<create_default_instance enabled="true"/>
<single_instance/>
<dependency name="fs" grouping="require_all" restart_on="none" type="service">
<service_fmri value="svc:/system/filesystem/local"/>
</dependency>
<dependency name="net" grouping="require_all" restart_on="none" type="service">
<service_fmri value="svc:/network/loopback"/>
</dependency>
<exec_method name="start" type="method" exec="UNICORN_PATH/unicorn -c APP_PATH/config/unicorn.conf APP_PATH/config/config.ru -E production -D" timeout_seconds="60">
<method_context working_directory="APP_PATH">
<method_credential user="USER" group="GROUP"/>
<method_environment>
<envvar name="PATH" value="PATH_LISTING"/>
<envvar name="HOME" value="/export/home/USER"/>
</method_environment>
</method_context>
</exec_method>
<exec_method name="stop" type="method" exec="/usr/bin/kill -quit `cat /tmp/unicorn-TEST-master.pid`" timeout_seconds="60">
<method_context working_directory="APP_PATH">
<method_credential user="USER" group="GROUP"/>
<method_environment>
<envvar name="PATH" value="PATH_LISTING"/>
<envvar name="HOME" value="/export/home/USER"/>
</method_environment>
</method_context>
</exec_method>
<exec_method name="restart" type="method" exec="/usr/bin/kill -hup `cat /tmp/unicorn-TEST-master.pid`" timeout_seconds="60">
<method_context working_directory="APP_PATH">
<method_credential user="USER" group="GROUP"/>
<method_environment>
<envvar name="PATH" value="PATH_LISTING"/>
<envvar name="HOME" value="/export/home/USER"/>
</method_environment>
</method_context>
</exec_method>
</service>
</service_bundle>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment