Sinatra help
Hi,
I would like some help getting FS to run with my Sinatra app on Heroku. I'm very confused. So far I bundle-installed the TS and FS gems, included 'require 'flying_sphinx/tasks'' in my Rakefile, pushed to Heroku and tried to run 'heroku rake fs:index' which gives me:
Don't know how to build task 'environment'
/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:1720:in []'
/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:603:in
block in
invoke_prerequisites' /usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:602:in
each'
/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:602:in
invoke_prerequisites'
/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:594:in block in
invoke_with_call_chain'
/usr/ruby1.9.2/lib/ruby/1.9.1/monitor.rb:201:in
mon_synchronize'
/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:588:in
invoke_with_call_chain'
/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:581:in
invoke'
/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2041:in invoke_task'
/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2019:in
block (2
levels) in top_level' /usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2019:in
each'
/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2019:in
block in
top_level' /usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2058:in
standard_exception_handling'
/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2013:in
top_level'
/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:1992:in `run'
It looks like I'm missing a config step.
Also, the pricing for Wooden on Heroku shows 20mb of indexed data, but heroku config -s shows my same shared database URL. Is the index size limit independent of how big your shared or dedicated database is?
Thanks,
Yuki
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by Pat Allan on 19 Jul, 2011 03:13 PM
Hi Yuki
This isn't really documented (I need to work on that), but in your Gemfile, you'll want to add :require options to both
thinking-sphinx
andflying-sphinx
:Give that a spin, let me know how it goes (although I probably won't reply for 10 hours - it's 1:00AM here).
2 Posted by Yuki on 20 Jul, 2011 02:52 AM
Thanks Pat.
I tried the above but still gives me the same error.
My Gemfile:
source 'http://rubygems.org'
gem 'sinatra'
gem 'redis'
gem 'ohm'
gem 'ohm-contrib'
gem 'shield'
gem 'i18n'
gem 'yajl-ruby'
gem 'thinking-sphinx', :require => 'thinking_sphinx/sinatra'
gem 'flying-sphinx', :require => 'flying_sphinx/sinatra'
Rakefile:
require 'flying_sphinx/tasks'
Support Staff 3 Posted by Pat Allan on 20 Jul, 2011 02:57 AM
Ah, I should have looked at my Rakefile in my test app...
Add the following to your Rakefile - this makes sure Sinatra's paying attention to the environment and that Thinking Sphinx has the context of that environment:
4 Posted by Yuki on 20 Jul, 2011 03:18 AM
The above got rid of the environment error, and I was able to run the rake fs:index command, which seems to stall forever. Is this because I need a spare worker Dyno?
Also, I had to add a bunch of dependencies in my Rakefile because I was getting uninitialized constants (Sinatra, Flying-Sphinx, Riddle). is this normal?
require 'rubygems'
require 'sinatra'
require 'riddle'
require 'thinking-sphinx'
require 'flying-sphinx'
require 'flying_sphinx/tasks'
task :environment do
Sinatra::Application.environment = ENV['RACK_ENV'] end
Support Staff 5 Posted by Pat Allan on 20 Jul, 2011 03:21 AM
You'll want to load your bundle environment in your Rakefile - here's an example:
This will make sure all the required constants will be defined. It may also fix up the stalling issue too (as it'll make sure you've got the Flying Sphinx settings set).
6 Posted by Yuki on 20 Jul, 2011 03:40 AM
That did it, thank you.
I have some ActiveRecord setup to do, but I'll let you know if I have any other FS problems.
Support Staff 7 Posted by Pat Allan on 20 Jul, 2011 03:43 AM
Great :)
Pat Allan closed this discussion on 20 Jul, 2011 03:43 AM.
Pat Allan re-opened this discussion on 20 Jul, 2011 10:24 AM
Support Staff 8 Posted by Pat Allan on 20 Jul, 2011 10:24 AM
Oh, I forgot to answer the second question from this ticket - the Sphinx indices are separate from your Heroku database.
In your Flying Sphinx dashboard (accessible through the add-ons menu of your app page within Heroku's interface) you can see how much disk space your indices are taking up. Most sites on Flying Sphinx are under the 20MB limit of the Wooden plan, but the more data that gets indexed, the larger the indices will get.
Pat Allan closed this discussion on 20 Jul, 2011 10:24 AM.
Yuki re-opened this discussion on 20 Jul, 2011 10:36 AM
9 Posted by Yuki on 20 Jul, 2011 10:36 AM
Oh, thanks. So FS is self contained. Is there a page on the site where I can find information about the database/version you use? I would like to use the same version for my local install.
Support Staff 10 Posted by Pat Allan on 20 Jul, 2011 10:39 AM
The database is managed by Heroku - they use PostgreSQL, but I'm not sure which version.
As mentioned in the docs, Flying Sphinx uses Sphinx 1.10-beta, with a custom patch for extra security (but that patch isn't really relevant on a local machine - so just Sphinx 1.10-beta or even 2.0.x-beta will be fine).
Pat Allan closed this discussion on 23 Aug, 2011 11:21 PM.