Sunspor Solr in production - ruby-on-rails

I saw this question Setup sunspot solr with rails in production environment.
But I see my output:
bundle exec sunspot-solr start
...sunspot_solr is not part of the bundle. Add it to Gemfile.
I have sunspot_solr under development group, and I suppose I should not change that.
Bundler output
Using rsolr (1.0.8)
...
Using sunspot (1.3.3)
Using sunspot_rails (1.3.3)
Rake output
rake sunspot:solr:start RAILS_ENV=production
Note: This task has been moved to the sunspot_solr gem. To install, start and
stop a local Solr instance, please add sunspot_solr to your Gemfile:
group :development do
gem 'sunspot_solr'
end
Any advice, thanks.

Can you try putting the gems outside the development group?
I have the following gems outside the development group:
gem 'sunspot_rails'
gem 'sunspot_solr'

Related

Could not find diff-lcs when running generate rspec:install

I am a Django guy new to Rails. I'm trying to get rspec-rails working for me but when I run
$ bundle exec rails generate rspec:install
I get..
Could not find diff-lcs-1.2.5 in any of the sources
Run `bundle install` to install missing gems.
Which is bothersome because
diff-lcs (1.2.5)
is alive and well in Gemfile.lock
I have deleted Gemfile.lock and rerun bundle to no avail. I added gem 'diff-lcs' into my Gemfile too.
This is the way I have rspec rails in my gemfile
group :development, :test do
gem 'rspec-rails'
end
Any tips?
Killing the spring processes took care of it for me, as described at https://jasonplayne.com/web-dev/rails-generate-could-not-find-in-any-of-the-sources. I see that use of the spring loader was added in Rails 4.1, but I'm curious about the interaction here and what can be done to address this problem without having to kill spring.
You need to update your bundler:
$ gem update bundler
$ bundle install

Cannot start SOLR on EC2 machine - does not detect gem

I recently installed SOLR on my Amazon EC2 machine and when I try to start SOLR using RAILS_ENV=production bundle exec rake sunspot:solr:start --trace, I get the following message:
** Invoke sunspot:solr:run (first_time)
** Invoke sunspot:solr:moved_to_sunspot_solr (first_time)
** Execute sunspot:solr:moved_to_sunspot_solr
Note: This task has been moved to the sunspot_solr gem.
To install, start and stop a local Solr instance, please add sunspot_solr to your Gemfile:
group :development do
gem 'sunspot_solr'
end
However, I've already included sunspot_solr in my Gemfile and my RAILS_ENV is production (I've also tried export RAILS_ENV=production. Any tip as to why SOLR won't start and keeps trying to run in development? I followed this link to install it - http://tanin.nanakorn.com/b/96/tomcat_and_solr_on_ec2
Here is part of my Gemfile:
group :development, :test do
gem 'factory_girl_rails'
gem "rspec-rails"
gem 'faker'
gem 'fuubar'
gem 'pry'
gem 'foreman'
gem 'guard-spork'
gem 'sunspot_solr'
end
I've ran bundle install already and see that the gem is being used:
Using rsolr (1.0.8)
Using sunspot (1.3.0)
Using sunspot_rails (1.3.0)
The sunspot_solr gem is in your Gemfile's :development group, which Rails will ignore when you specify RAILS_ENV=production. The sunspot_solr gem is intended mostly as a convenience for development and testing, and is not particularly tuned for production, which is why the documentation suggests including it in the :development group.
If you have followed the steps described in the blog article that you linked, you actually don't need to use Sunspot's bundled Solr instance. By the end of that article, you should have a Solr server running on your server. (You'd have to double check the Tomcat configs to see which port it is running on.)
If I may be so bold, you might also benefit from considering a cloud hosted Solr search such as my own websolr.com. You should be able to have an index up and running there within a few minutes.

ruby 1.9.2 does not support pg gem? cant heroku rake db:migrate (

i am using ruby 1.9.2 and rails 3.1.0
please help, cause i very need it to work for studying. It's my university project(
i have installed this gems
gem 'thin'
gem 'pg'
but when i use heroku rake db:migrate is tells me to instal postgreadapter. But i have it.
I did all that i read about this problem, also did
group :production do
gem 'pg'
end
group :development, :test do
gem 'sqlite3'
end
in rubymine it writes gem "pg" is not available in SDK 'ruby-1.9.2-p290'
same with thin and heroku gems
It seems you have not installed those gems in rubymine (locally). run "bundle install" or if you need to do something specific in rubymine to install gems.

Rails 3 bundler updating

I have an application running on thin 1.2.11 behind nginx. I was trying to update my application to the latest version of it's gems using bundle update on a development machine, commiting to git, then running cap deploy. However, thin is giving me the following error:
/usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.14/lib/bundler/runtime.rb:31:in `block in setup': You have already activated rack 1.3.0, but your Gemfile requires rack 1.2.3. Consider using bundle exec. (Gem::LoadError)
On the server I have the following gems installed system wide:
bundler (1.0.14)
daemons (1.1.3)
eventmachine (0.12.10)
rack (1.3.0)
rake (0.9.2)
thin (1.2.11)
My Gemfile for my aplication:
source 'http://rubygems.org'
gem 'rails', '3.0.7'
gem 'sqlite3'
gem 'capistrano'
gem 'thin'
gem 'RedCloth'
gem 'will_paginate', '3.0.pre2'
gem 'jquery-rails'
I believe thin is requiring rack 1.3, while something in my Gemfile is requiring rack 1.2.3. Am I managing my gems the wrong way? What is the proper way to manage deployment and proper gem control?
I found using bundle exec thin start works, but I prefer a solution to allow me to use /etc/init.d/thin start.
Please read this: http://yehudakatz.com/2011/05/30/gem-versioning-and-bundler-doing-it-right/ before you tell us what you prefer.
Problem is you prefer to run command from gem installed into system to run application which has it's own dependencies (i.e. rack) specified in Gemfile. You can't have two version of same library loaded at the same time, so it's causing your problem with needing 'bundle exec' in from on every command.
Just do bundle exec at start of your cap scripts and he will pickup gems from bundler.
Often I have same problem if i have in system / currently used gemset newer versions of some gems.
i even have alias called be in shell for bundle exec. New versions of rvm do bundle exec automagicly also :).

rails sunspot nokogiri dependency

I am trying to follow the wiki instructions for getting sunspot on rails
https://github.com/outoftime/sunspot/wiki/Adding-Sunspot-search-to-Rails-in-5-minutes-or-less
Everything works fine until when I do:
$ rake sunspot:solr:start
rake aborted!
no such file to load -- nokogiri
However, it looks like I DO have nokogiri installed:
$ gem list
....
nokogiri (1.4.4)
....
Anyone have any thoughts? I'm on a mac if that makes a difference.
Are you including nokogiri in your Gemfile or environment.rb?
For rails 3 add this line to your Gemfile
gem 'nokogiri'
For rails 2 add config.gem to your environment.rb
config.gem "nokogiri"
It's also quite possible if you're using Rails 3 that your gem list command doesn't reflect the directory where bundler has installed the gems for your app.

Resources