Red5 is the open source answer to Adobe’s Flash Streaming Server. I use it not for streaming, but for recording audio and video from a user’s web browser. Yeah, that is a really cool feature if you have the need for it.
It turns out that the Red5 team actually created an SMF configuration. However, you have to download the source to get to it. I was half way through my own before I saw the change entry on the Red5 commit mailing list. However, it used some funky paths. I took this and fixed it for my Joyent specific installation.
First, download the tar of red5 from red5.org. Extract the contents to /opt/local/share/red5-VERSION. Create a symlink from /opt/local/share/red5 to red5-VERSION.
Here is the SMF config:
<?xml version='1.0'?> <!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'> <!-- Solaris Service Management Facility for Red5 The idea for this file came from a post by Paul Oswald URL: http://pauloswald.com/article/29/hudson-solaris-smf-manifest Modified for use with Red5 by Paul Gregoire (email@example.com) Modified for Red5 on Joyent accelerators by The Dude More info: http://www.sun.com/bigadmin/content/selfheal/smf-quickstart.jsp http://www.sun.com/bigadmin/content/selfheal/sdev_intro.html --> <service_bundle type="manifest" name="Red5"> <service name="application/red5" type="service" version="1"> <create_default_instance enabled="false" /> <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> <dependent name='solr_multi-user' grouping='optional_all' restart_on='none'> <service_fmri value='svc:/milestone/multi-user'/> </dependent> <method_context working_directory='/opt/local/share/red5'> <method_credential user='red5' group='red5' /> </method_context> <exec_method type="method" name="start" exec="/opt/local/share/red5/red5.sh" timeout_seconds="0"> </exec_method> <exec_method type="method" name="stop" exec=":kill -TERM" timeout_seconds="30"/> <!-- Red5 runs as a single child process so we want Wait mode--> <property_group name='startd' type='framework'> <propval name='duration' type='astring' value='child' /> </property_group> <stability value="Unstable" /> <template> <common_name> <loctext xml:lang='C'> red5 </loctext> </common_name> <documentation> <doc_link name='red5.org' uri='http://red5.org/' /> </documentation> </template> </service> </service_bundle>
This guy is a bit simpler as it doesn’t require a script to handle starting or stopping. It assumes red5 is installed under /opt/local/share/red5. The same applies as before for installing it:
sudo mv red5.xml /var/svc/manifest/network/
Then run the following (likely with sudo):
chown root:sys /var/svc/manifest/network/red5.xml chmod 444 /var/svc/manifest/network/red5.xml svccfg import /var/svc/manifest/network/red5.xml
You’ll need to have a user and group added named red5.
Now, time to go watch Avatar for the 5th time. Who am I kidding? I have to go burp Alec.