Skip to content

Instantly share code, notes, and snippets.

@nisaacson
Created March 22, 2013 01:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nisaacson/5218350 to your computer and use it in GitHub Desktop.
Save nisaacson/5218350 to your computer and use it in GitHub Desktop.
Sets up a service to run a persistant fleet hub on SmartOS. On line 26 there is a command to startHub.sh. This is a simple script which runs a fleet drone and is included here See https://github.com/isaacs/joyent-node-on-smart-example for instructions on how to install a configuration xml file like this one on SmartOS
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<service_bundle type="manifest" name="fleet-hub-service">
<service name="site/fleet-hub-service" type="service" version="1">
<create_default_instance enabled="true"/>
<single_instance/>
<dependency name="network" grouping="require_all" restart_on="refresh" type="service">
<service_fmri value="svc:/milestone/network:default"/>
</dependency>
<dependency name="filesystem" grouping="require_all" restart_on="refresh" type="service">
<service_fmri value="svc:/system/filesystem/local"/>
</dependency>
<method_context working_directory="/home/node/fleet/hub">
<method_credential user="node" group="staff" privileges='basic,net_privaddr' />
<method_environment>
<envvar name="PATH" value="/home/node/local/bin:/opt/local/bin:/usr/local/bin:/usr/bin:/usr/sbin:/bin"/>
<envvar name="HOME" value="/home/node"/>
</method_environment>
</method_context>
<exec_method
type="method"
name="start"
exec="/usr/bin/sh /home/node/fleet/hub/startHub.sh"
timeout_seconds="60"/>
<exec_method
type="method"
name="stop"
exec=":kill"
timeout_seconds="60"/>
<property_group name="startd" type="framework">
<propval name="duration" type="astring" value="child"/>
<propval name="ignore_error" type="astring" value="core,signal"/>
</property_group>
<property_group name="application" type="application">
</property_group>
<stability value="Evolving"/>
<template>
<common_name>
<loctext xml:lang="C">fleet hub service</loctext>
</common_name>
</template>
</service>
</service_bundle>
fleet hub --port=8000 --secret=foobar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment