Thinking Sphinx as Windows service
If you use Windows (as I do) and Rails plugin thinking_sphinx you may find it annoying to open the console and type “rake ts:start” every time you restart your system (and this happens a lot :)). That’s why I’d like to run it as Windows service.
Sphinx has the ability to install itself as Windows service:
searchd --install --config c:\sphinx\sphinx.conf
Unfortunately thinking_sphinx plugin does not support it, so here’s Thinking Sphinx for Windows - a batch of simple rake tasks dedicated for Windows users. Now you can:
rake thinking_sphinx:service:install
It basically does two things - installs Windows service using thinking_sphinx configuration file and starts the service (NET START searchd). Other tasks are (obviously):
rake thinking_sphinx:service:delete
rake thinking_sphinx:service:start
rake thinking_sphinx:service:stop
rake thinking_sphinx:service:restart
Like in thinking_sphinx, there are shortcuts with rake thinking_sphinx:service: becoming just tsw: (so it takes short and sweet rake tsw:install to install & start the service).
Installation: just download the file and unpack it into vendor/plugins directory of your Rails project. You still have to have thinking_sphinx installed! Have fun.
listopad 20th, 2008 o godzinie 5:35 po południu
Very useful. But I got the following error:
rake thinking_sphinx:service:start
NET START searchd
The searchd service is starting.
The searchd service could not be started.
A system error has occurred.
System error 1067 has occurred.
The process terminated unexpectedly.
grudzień 10th, 2008 o godzinie 10:18 przed południem
C:\usr\src\newflyers>rake thinking_sphinx:service:install –trace
(in C:/usr/src/newflyers)
** Invoke thinking_sphinx:service:install (first_time)
** Invoke thinking_sphinx:app_env (first_time)
** Execute thinking_sphinx:app_env
** Invoke environment (first_time)
** Execute environment
** Execute thinking_sphinx:service:install
rake aborted!
private method `new’ called for ThinkingSphinx::Configuration:Class
C:/usr/src/newflyers/lib/tasks/thinking_sphinx_windows/tasks/thinking_sphinx_windows_tasks.rake:21
c:/util/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:617:in `call’
c:/util/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:617:in `execute’
c:/util/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:612:in `each’
c:/util/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:612:in `execute’
c:/util/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:578:in `invoke_with_call_chain’
c:/util/ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize’
c:/util/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:571:in `invoke_with_call_chain’
c:/util/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:564:in `invoke’
c:/util/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2019:in `invoke_task’
c:/util/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in `top_level’
c:/util/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in `each’
c:/util/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in `top_level’
c:/util/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2036:in `standard_exception_handling’
c:/util/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1991:in `top_level’
c:/util/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1970:in `run’
c:/util/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2036:in `standard_exception_handling’
c:/util/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1967:in `run’
c:/util/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/bin/rake:31
c:/util/ruby/bin/rake:19:in `load’
c:/util/ruby/bin/rake:19
C:\usr\src\newflyers>
luty 21st, 2009 o godzinie 7:11 po południu
I get the same issue as eh:
private method `new? called for ThinkingSphinx::Configuration:Class
maj 27th, 2009 o godzinie 9:42 po południu
Edit
lib\thinking_sphinx_windows_tasks.rake…
#config = ThinkingSphinx::Configuration.new
config = ThinkingSphinx::Configuration.instance