Skip to content

Instantly share code, notes, and snippets.

@harrylove
Created May 5, 2011 20:46
Show Gist options
  • Save harrylove/957888 to your computer and use it in GitHub Desktop.
Save harrylove/957888 to your computer and use it in GitHub Desktop.
Solaris SMF manifest file for Resque-web Sinatra app
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<service_bundle type="manifest" name="resque-web">
<service name="application/resque-web" type="service" version="1">
<create_default_instance enabled="false" />
<single_instance />
<dependency name="network" grouping="require_all" restart_on="error" type="service">
<service_fmri value="svc:/milestone/network:default" />
</dependency>
<dependency name="filesystem" grouping="require_all" restart_on="error" type="service">
<service_fmri value="svc:/system/filesystem/local" />
</dependency>
<method_context working_directory='/PATH/TO/YOUR/RAILS/APP'>
<method_credential user="YOUR_USER" group="YOUR_GROUP" />
</method_context>
<exec_method type="method" name="start" exec="/FULL/PATH/TO/resque-web -p YOUR_PORT -o 127.0.0.1 -e YOUR_RAILS_ENV" timeout_seconds="60">
<method_context>
<method_environment>
<envvar name="HOME" value="/PATH/TO/YOUR_USER/HOME/DIRECTORY" />
</method_environment>
</method_context>
</exec_method>
<exec_method type="method" name="stop" exec=":kill" timeout_seconds="60" />
<property_group name="startd" type="framework">
<propval name="duration" type="astring" value="contract" />
<propval name="ignore_error" type="astring" value="core,signal" />
</property_group>
<stability value="Evolving" />
<template>
<common_name>
<loctext xml:lang="C">Resque-web Sinatra app</loctext>
</common_name>
</template>
</service>
</service_bundle>
@harrylove
Copy link
Author

This is for launching Resque-web on Solaris and keeping it running with SMF. Replace the strings in all caps with your info as needed.

Note: the app is bound to localhost and run separately from your Rails app. This keeps them decoupled and secure. To connect, you create an ssh tunnel to the box and open localhost:PORT in your browser. This way you don't have to mess with creating another auth scheme in Rack just for Resque. It also means Resque-web is run as a separate process that you can monitor apart from your Rails app.

I'm not a Solaris expert. If you see something in the SMF that can be improved, please say so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment