Forum: Ruby on Rails Starting Thinking Sphinx on Joyent SmartOS with svcadm

A47e0a6beeb9d048ff054fc1c3a97418?d=identicon&s=25 Walter Davis (walterdavis)
on 2014-06-03 13:14
(Received via mailing list)
I followed this tutorial:
http://www.neo.com/2013/10/09/unicorn-on-joyent-smartos 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
`<main>'
(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
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.