I'm posting this mostly to future-me, and any others who have the same problem
and can't remember the solution. tl;dr: to start Sphinx as a particular user
when the server restarts, you need a combination of a cron, shell script, and
sphinx.yml.
1. Shell into the server as the user you wish to start the searchd, or su to
them from root. Ask the following questions:
which bundle
#-> /usr/local/rvm/gems/ruby-1.9.3-p194@global/bin/bundle
which ruby
#-> /usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby
2. Create a shell script somewhere, with the following contents:
#! /usr/bin/env bash
# note the substitutions from the `which ruby` above:
source /usr/local/rvm/environments/ruby-1.9.3-p194
# move into your site root
cd /data/www
# explicitly call rake through your actual bundle command
/usr/local/rvm/gems/ruby-1.9.3-p194@global/bin/bundle exec rake
ts:start RAILS_ENV=production
2a. Be sure to chmod 755 this shell script.
3. Edit/create a crontab as the user you wish to start from:
crontab -e
...
@reboot /path/to/start_sphinx.sh
4. If you don't have a /config/sphinx.yml, make one, and add (at least) the
following lines:
production:
bin_path: /usr/local/bin
(with your actual bin path, naturally)
5. Profit!
This was a long road, helped along the way by the following:
* http://pat.github.io/thinking-sphinx/advanced_config.html
*
http://blog.scoutapp.com/articles/2013/06/07/rvm-bundler-and-cron-in-production-round-2
* http://www.cyberciti.biz/faq/linux-execute-cron-job-after-system-reboot/
* http://jasonseifer.com/2010/04/06/rake-tutorial
Standing on the shoulders of giants,
Walter
--
You received this message because you are subscribed to the Google Groups
"Thinking Sphinx" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/thinking-sphinx.
For more options, visit https://groups.google.com/groups/opt_out.