rails 3.1 sphinx search hosting *thinking sphinx* - ruby-on-rails

Firstly, Im a big fan of sphinx search. Thanks to sphinx.
Now my question is,
We are ready with a rails 3.1 app which uses sphinx search for full text searching.
Now, I know heroku is the best when it comes to rails hosting. It does not have support
for sphinxsearch, I hear.
If any of you know the right place to host a rails 3.1 app with sphinx search please
guide me.
I will mention the other things that Im using in my rails 3.1 app as listed in my gem
file.
#############################################################
source ' http://rubygems.org '
gem 'rails', '3.1.1'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'mysql2'
gem 'execjs'
gem 'therubyracer'
gem 'thinking-sphinx', '2.0.10'
gem "gritter", "1.0.1"
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.1.4'
gem 'coffee-rails', '~> 3.1.1'
gem 'uglifier', '>= 1.0.3'
end
gem 'will_paginate', '3.0.pre2'
gem 'jquery-rails'
gem 'client_side_validations'
gem "bcrypt-ruby", :require => "bcrypt"
#############################################################
Thank you so much.

Actually, Heroku does support Sphinx through the Flying Sphinx add-on. Otherwise, any decent VPS should work for you. Linode, in particular, has a pretty good reputation.

Related

Application Missing Features after Deploying to Heroku ( Forem Gem)

When deploying my application to Heroku, I'm missing my user forum, as created by gem/engine Forem. I've had to do some db resetting both on locally and heroku, but locally I've found that running rails g install:forem restores the forem in my development environment. I've been unsuccessful replicating that success with heroku. I'm looking for either A) specific information about deploying with this gem, or B) general information about how to troubleshoot the issue. I'm happy to post code, but I'm sure sure what's relevant.
Gemfile:
gem 'rails', '4.1.4'
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'spring', group: :development
gem 'devise'
gem 'bootstrap-sass', '~> 3.2.0'
gem 'autoprefixer-rails'
gem 'simple_form'
gem 'pg'
gem 'newrelic_rpm'
gem 'forem', github: "radar/forem", branch: "rails4"
gem 'forem-bootstrap', github: "radar/forem-bootstrap"
gem 'forem-theme-base', :github => 'radar/forem-theme-base'
gem 'forem-redcarpet', github: "radar/forem-redcarpet"
gem 'will_paginate', '3.0.5'
gem 'unicorn'
gem 'rails_12factor', group: :production
I was facing the same issue when deploying my Rails 4 application to Heroku.
I am using both Devise for authentication and Forem for generating the forums.
In my dev environment, I installed Devise and Forem based on this tutorial:
http://www.sitepoint.com/forem-rails-forum-engine/
When deploying, as all was already present in the dev environment (i.e. models), the only thing was to install Devise and Forem (with no need for other steps):
heroku run rails generate devise:install
heroku run rails generate forem:install
For each, I replied to overwrite files that could be present, but actually if you configured Devise or Forem, keeping the files (initializers) you just uploaded would be a good idea !
Et voilà !

Ruby on Rails - Installing Gemfiles

I am trying to learn Ruby on Rails through this online tutorial
http://ruby.railstutorial.org/ruby-on-rails-tutorial-book
I'm creating an app demo_app for their second chapter.
This is what my gemfile currently looks like
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.4'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.2'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
this is what it's supposed to look like
source 'https://rubygems.org'
ruby '2.0.0'
#ruby-gemset=railstutorial_rails_4_0
gem 'rails', '4.0.4'
group :development do
gem 'sqlite3', '1.3.8'
end
gem 'sass-rails', '4.0.1'
gem 'uglifier', '2.1.1'
gem 'coffee-rails', '4.0.1'
gem 'jquery-rails', '3.0.4'
gem 'turbolinks', '1.1.1'
gem 'jbuilder', '1.0.2'
group :doc do
gem 'sdoc', '0.3.20', require: false
end
group :production do
gem 'pg', '0.15.1'
gem 'rails_12factor', '0.0.2'
end
I don't understand why my gemfile looks so different.
I have the updated versions of rails, ruby and gemfile.
I even ran the commands
bundle install --without production
bundle update
bundle install
and my gemfile still looks like my first snippet of code.
I've been reading through chapters 1 and 2 of this tutorial but can't figure this out. Am I supposed to edit Gemfile in the text editor? I've already tried that and I got a hundred error messages.
How do I install the gemfile so it looks like the code in the second snippet?
Please help
Let's look through the gemfile item by item (Note that any of the numbers after gems are versions and it isn't necessary that your versions match his. You can specify them if you'd feel more comfortable but unless you come to some bug that needs it, you should be fine without.)
source 'https://rubygems.org' - You both have this and this is where the gem, bundle, etc. commands in the console get your gems from for installation.
ruby '2.0.0' - He has this and you don't. What is this doing? It's specifying the version of ruby that he's using in his rails app. You can do this if you want but it won't be necessary unless you've got multiple versions of ruby installed. Perhaps you're using RVM (Ruby Version Manager) in which case this will probably be necessary. Make sure it's the version you have by using ruby -v in the console to check your version. (Output will look something like this: ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin13.0] where in the gemfile you can leave everything off besides the 2.1.1
#ruby-gemset=railstutorial_rails_4_0 - This is a comment in his gemfile for his own use. Likely he has multiple gem files and this helps him know which one to use when making the tutorial.
gem 'rails', '4.0.4' - You both have that which is just the version of rails you're using.
Next we have
group :development do
gem 'sqlite3', '1.3.8'
end
This is somewhat different than yours but how come? First of all the group :development do means that we only want to "do" (read: use) the gems in this block when we're in the development group. This one can be more clearly called an environment and can be configured/found in the config/environments/ folder. This is useful for having different gems and settings when running the rails server in development or test or production mode. He has the sqlite3 gem in the development group because he wants to use rails's default database gem for the tutorial. You will notice that you have the sqlite3 gem as well which means you can follow his tutorial successfully.
gem 'sass-rails', '4.0.1'
gem 'uglifier', '2.1.1'
gem 'coffee-rails', '4.0.1'
gem 'jquery-rails', '3.0.4'
gem 'turbolinks', '1.1.1'
gem 'jbuilder', '1.0.2'
You have all these gems in your gemfile as well so no problems there. (They may be with different versions and with comments above them so that you know why each gem is there which is good. Rails puts the comments in by default for clarity in coding.)
group :doc do
gem 'sdoc', '0.3.20', require: false
end
Same as yours and likewise used for the docs group. It means that it won't be used unless you're specifically looking for it.
group :production do
gem 'pg', '0.15.1'
gem 'rails_12factor', '0.0.2'
end
From person experience, I know that these are two gems that are required to deploy an app in production to heroku (a free hosting site) which you'll cover in chapter 1.4. You do not have them because you don't need them until you deploy to heroku. The production group again specifies that you want these gems for when the server runs in production (as it will on heroku). The pg gem is for postgres which is a database alternative to sqlite3 and the rails_12factor is something that enhances 12factor app handling. More can be learned here but it is only necessary to know that heroku requires it to host a rails app.
All the gems in yours that aren't in his and are commented out in yours are old rails standards that are left in because plenty of people still use them and they aren't truly phased out yet. They will not be necessary for the tutorial and you can delete them if you'd like.
Sorry it was long. Hope this helps your understanding.
It looks like your going through Hartl's tutorial, it's a great tutorial, however, if this is your first time coding and or using an MVC framework, everything is going to look like gibberish. Although this is bad practice moving forward, I suggest copying the entire gemfile that Hartl provides into your gemfile and then do a bundle install.
The point of this tutorial for beginners is to get through it with a BASIC understanding of how everything works. It's going to go over a lot of concepts that your not necessarily going to understand or use right away. The best thing to do is power through the best you can and try to finish the app. I finished it in 3 weeks and was more confused than ever, things only started to sync in once I started experimenting on my own and using the tutorial and other ruby/rails docs as a reference.
Programming is hard, and if this is your first foray into application development, I suggest having a basic understanding of Ruby first (http://www.codecademy.com/tracks/ruby) or even learning a scripting language like python (http://www.learnpython.org/). Learning python basics for some odd reason helped me understand ruby better, which made it easier to navigate and understand all the components of rails.
Anyway good luck and stick with it, there are tons of online resources to get you where you need to go. You just have to keep digging.

Upgrade from Rails 3.2 to Rails 4

I have an application in Rails 3.2 which is ready to deploy. I am wondering should I upgrade it to Rails 4 or not. I also not sure about which of the gems might give issues with while upgrading.
Below is my Gemfile with several common gems.
Gemfile.rb
source 'https://rubygems.org'
gem 'rails', '3.2.8'
gem 'pg', '0.12.2'
gem 'bcrypt-ruby', '3.0.1'
gem 'will_paginate', '3.0.3'
gem 'bootstrap-will_paginate', '0.0.6'
gem 'simple_form', '2.0'
gem 'rails3-jquery-autocomplete', '1.0.10'
gem 'show_for', '0.1'
gem 'paperclip', '3.3.1'
gem 'cocoon', '1.1.1'
gem 'google_visualr', '2.1.0'
gem 'axlsx', '1.3.4'
gem 'acts_as_xlsx', '1.0.6'
gem 'devise' ,'2.1.2'
gem 'cancan', '1.6.8'
gem 'bootstrap-datepicker-rails', "0.6.32"
gem 'country_select', '1.1.3'
gem 'jquery-rails', '2.1.4'
gem 'annotate', '2.5.0', group: :development
gem 'ransack', '0.7.2'
gem "audited-activerecord", "3.0.0"
gem 'prawn', '1.0.0.rc2'
gem 'exception_notification', '3.0.1'
gem 'daemons', '1.1.9'
gem 'delayed_job_active_record', '0.4.3'
gem "delayed_job_web", '1.1.2'
gem "less-rails"
gem "therubyracer"
gem 'twitter-bootstrap-rails', '~>2.1.9'
gem "spreadsheet", "~> 0.8.8"
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '3.2.5'
gem 'coffee-rails', '3.2.2'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '1.2.3'
end
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the app server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'debugger'
group :development, :test do
gem 'rspec-rails', '2.11.0'
end
group :test do
gem 'capybara', '1.1.2'
gem 'factory_girl_rails', '4.1.0'
gem 'faker', '1.0.1'
end
I started working on this application last year (Nov 2012) after reading this great book at
http://ruby.railstutorial.org/. I have also checked out what's new in Rails 4 like strong parameters and it's all very tempting to try an upgrade.
But I am concerned about compatibility of these gems and effort it may take.
I need some advice from experienced guys in the community or someone who has tried upgrading before I move ahead.
I uploaded your gemfile to Ready for Rails 4, and it appears that you only have a couple gems that are not ready and one gem that is unknown. For some of the gems listed that do not have notes, I would suggest checking out their GitHub page (if they have one), and see if the gem has been updated recently on rubygems, just to confirm whether or not the gem works.
This brief handbook was worth every cent in our recent 3.2 to 4 migration.
https://leanpub.com/upgradetorails4
https://github.com/alindeman/upgradingtorails4
It lists in details how to handle gem upgrades, as well as individual details (with clear examples) of what's changed and how to manage your current Rails app through the upgrade.
To address your gem-specific concerns: Almost all our 40+ gems, except perhaps 5, had active either Rails 4 releases (or Github branches for Rails 4), or worked just fine with Rails 4 when left intact.
Having a healthy unit/functional test suite in your codebase would be vital for your confidence in the upgrade being successful.
The asset pipeline has changed a bit, so you'll need to upgrade those gems. I had to use a fork of ransack in the context of active_admin, but you might be fine.
I'd recommend that you create a branch, bump to Rails 4, and see what happens. It took me a day or two to upgrade from 3.2 to 4 a couple weeks ago on a fairly small (but production-with-customers) application. The upgrade guide is pretty solid.

downgrading rails project from 3.2.1 to 2.3.3

My first Rails project deploy, and I've run into an issue.
The project is Rails 3.2.1, Ruby 1.9.3
Yesterday, I was given the hosting access, and they're having Rails 2.3.3, Ruby 1.8.7
If I'll decide to still deploy the app there, what changes do I need to make to it?
Specifically, I'm interested in Gemfile changes.
Here's my current gemfile:
source 'https://rubygems.org'
gem 'rails', '2.3.3'#'3.2.1'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
gem 'haml-rails'
gem 'haml'
gem 'omniauth-twitter'
What do I need to change? How do I look-up all the required dependencies and gems versions for old Rails versions?
Downgrading from 3.x to 2.3 is the dumbest thing you can do in your case.
Install gems locally, or ask your hosting company support department — they have to help.
If you can't, save your time — use Heroku, OpenShift or any other hosting company.

running rails 3.2 / mongoid app on heroku fails

I'd like to now if anybody could help me with my heroku deployement.
I've set up my Rails 3.2 app with the following Gemfile
source 'https://rubygems.org'
gem 'rails', '3.2.0'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3-ruby', :require => 'sqlite3'
gem 'mongoid'
gem 'bson_ext'
gem 'mongoid_slug'
gem 'heroku'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem "compass", ">= 0.12.alpha"
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
And I have run the rails g mongoid:config command
From the heroku support, I've added the mongolab extension and changed the mongoid.yml evironnement variables to MONGOLAB_URI
When I then deploy the app, it doesn't run on heroku.
I'm not sure what is going on, but i get this error message in the Heroku logs:
WARNING: Invalid .gemspec format in '/app/.bundle/gems/ruby/1.9.1/specifications/actionmailer-3.2.0.gemspec'
2012-01-29T19:13:46+00:00 app[web.1]: Could not find activemodel-3.2.0 in any of the sources
here is the full log file:
https://gist.github.com/1700231
has anybody experienced the same issue? I'm not sure if the problem comes from my set up or if I need to add something to rails to work with mongoid?
Cheers.
It's been a bit of pain int the b*tt, but I'm finally there.
http://railsapps.github.com/rails-heroku-tutorial.html
is the right place to go to deplay rails 3.2 on heroku.
This said my head hurt, not too much fun to get so many hurdles when one wants to learn.
Octopress looks fine at the moment I tell you :)
Alright let's keep going

Resources