Gyepi Sam
2013-06-21
Post installation instructions for solr and rails

The setup

You are a Rails developer. You installed sunspot-solr in development and it worked great. So you deploy to production and decide to install a production tomcat with

sudo apt-get install solr-tomcat

Assuming, of course, that you are running an Ubuntu server.

And it seems to work and starts up fine, but indexing fails. You try a few things. Nothing works. You google for answers and you land on this page.

The solution

No worries, just do this (as root).

cp RAILSDIR/solr/conf/schema.xml /usr/share/solr/conf/
cp RAILSDIR/solr/conf/solrconfig.xml /usr/share/solr/conf/
install -d -o tomcat6 -g tomcat6 /var/lib/tomcat6/solr/data/index

Why do you need this?

Sunspot has a prepackaged instance of Solr. When you say:

sunspot:solr:start

you are running that prepackaged instance and it stores the index data somewhere off the rails directory.

When you run the ubuntu solr-tomcat, it needs to be configured similarly to the prepackaged instance, thus the copying of the files and needs to know where to store the indexed data, thus the directory creation.