Starting Thinking Sphinx on Joyent SmartOS with svcadm

I followed this tutorial:
Neo and the
RailsCast about configuring Nginx and Unicorn, and successfully set up
my first non-Passenger/Apache Rails app last weekend.

Buoyed by this success, I next set about trying to get ThinkingSphinx to
restart when the server starts, and managed to get my server to run away
with 115% server usage. (Oddly, while that was going on, TS was working
just fine.)

As you know, starting TS requires one to cd into the Rails directory,
then issue a rake command: rake ts:start

Using these commands to start and stop, then:

/usr/local/rvm/gems/ruby-1.9.3-p547@global/bin/bundle exec rake ts:start
RAILS_ENV=production
/usr/local/rvm/gems/ruby-1.9.3-p547@global/bin/bundle exec rake ts:stop
RAILS_ENV=production

and these environment variables to set the necessary paths:

svccfg -s sphinx setenv PATH
/usr/local/rvm/gems/ruby-1.9.3-p547/bin:$PATH
svccfg -s sphinx setenv GEM_PATH
/usr/local/rvm/gems/ruby-1.9.3-p547:/usr/local/rvm/gems/ruby-1.9.3-p547@global

What resulted was a death by a thousand errors; this repeated over and
over:

[ Jun 3 01:10:02 Stopping because service exited with an error. ]
[ Jun 3 01:10:02 Executing start method
(“/usr/local/rvm/gems/ruby-1.9.3-p547@global/bin/bundle exec
/usr/local/rvm/gems/ruby-1.9.3-p547/bin/rake ts:start
RAILS_ENV=production”). ]
rake aborted!
ArgumentError: couldn’t find HOME environment – expanding ~' /usr/local/rvm/gems/ruby-1.9.3-p547/bin/ruby_executable_hooks193:15:in eval’
/usr/local/rvm/gems/ruby-1.9.3-p547/bin/ruby_executable_hooks193:15:in
`’
(See full trace by running task with --trace)

Can anyone point me to a recipe for using svcadm to start a Rails helper
like this? Anyone see a glaring error in my approach?

Thanks in advance,

Walter