Configuring solr for use with sunspot in development, testing, and production

Joost Hietbrink edited this page Feb 18, 2014 · 7 revisions

Configuring Solr in Production

Recommended Guideline for configuring Solr with a Tomcat server: http://wiki.apache.org/solr/SolrTomcat

OS Specific Setup Guides

Chef Recipes

  • For installing Solr with Jetty on Ubuntu use these:
  • For installing Solr with Tomcat (supporting multi core config) on Ubuntu see:

sunspot.yml

production:
  solr:
    hostname: solrserver
    port: 8080 #tomcat defaults to port 8080
    path: '/solr-example'
    log_level: WARNING
    pid_dir: '/var/run'

development:
  solr:
    hostname: localhost
    port: 8982
    log_level: INFO
    # pid_dir: defaults to 'app/solr/pids/development'
    # bind_address: defaults to '0.0.0.0' which binds to every interface
  disabled: false # note that this is not indented within `solr`

test:
  solr:
    hostname: localhost
    port: 8981
    log_level: WARNING

Rake Tasks Respond to Environment

Notice that the above configuration details that the server run on a different port for each environment. Provide the rake tasks with the correct rails environment on start/stop/run. E.g.:


RAILS_ENV=test rake sunspot:solr:start

Testing with Rails

You may want to look at the sunspot-rails-tester gem