Question

Throughout multiple tutorials on how to install Solr so I can start using sunspot_rails in my app, I've become very confused as to actually how to get a singular Solr application to be utilized by my Rails app in multiple environments (dev, test, prod). I'll try and lay out my attempt at understanding the entire setup as far as I've gotten it.


Rails Application

  • makes requests to http://samedomain.com:8981/solr* through the sunspot_rails gem
  • where :8981 is set by sunspot_rails in sunspot.yml (so 8981 can be production, 8982 is development, 8983 is test).
  • why does sunspot.yml specify a data directory? Is that not handled by the Tomcat/Solr installation config files? I think the major disconnect for me is that you can A) Set up Solr on its own as a standalone installation or B) Run Solr via rake sunspot:solr:start and it runs the app from within the gem. When I have a working standalone installation of Solr through Tomcat, do I not need to execute the rake task? What then is the point of specifying path: /solr/./production in sunspot.yml?

Tomcat

  • Handles running the Solr instance(s) on boot (Tomcat is in init.d startup script), and runs on port 8080 (currently, this port is the only way to access the Solr interface)
  • How do I map ports 8981-8983 to this running instance of Solr, and map each to its respective data directory?
  • Should I be storing the Solr data directory under my rails app directory, or keep it in a completely separate location?

Solr

  • It just seems like there's a config for all of these applications but I don't know where the precedence lies.

I'm using CentOS (web host), Ubuntu VM (local dev machine), tomcat7 and latest version of Solr.

Was it helpful?

Solution

Whelp, I figured it out. I set up a multicore environment following this article (definitely don't use spaces in the core name), and using the sunspot_rails configuration found here. For clarification, the path: reference in sunspot.yml is essentially what gets tacked on to the URL when referencing a 'core': i.e., http://mydomain.com:8080/solr/production (emphasis to indicate my point).

So now I don't have to care about running the rake task to start Solr because it's always running all 3 cores on boot through a single instance of Solr via Tomcat.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top