Is this an easy way to make Sunspot Solr run or is it bad?

I had a lot of problems starting Sunspot Solr, especially after rebooting the server initiated by Host.

Now I'm sure there are ways to create a startup script that will be launched by my server, or maybe monit is the way to go. But I think that all I really need is to start the Solr server when my application starts, so now I put this in the initializer:

begin
  Sunspot::Rails::Server.new.start
rescue
  # solr is already running
end

Tried it locally and it seemed to work.

It's horrible? Is there a quick and easy way that is better?

+3
source share
1 answer

Sunspot -, .

Sunspot:: Rails README:

Solr, :

rake sunspot:solr:start

, Solr Sunspot , . . .

. ( ): https://github.com/sunspot/sunspot/wiki/Configuring-solr-for-use-with-sunspot-in-development%2C-testing%2C-and-production

+8

Source: https://habr.com/ru/post/1779783/


All Articles