Having deployed a very basic Rails 3.2.3 trial site to a “production” server (not really in production, thankfully!) with RVM Ruby 1.9.3-p194, I find the following to be true, of the commands listed here:
╔══════════════════════════════════════╤═══╗
║ command issued │OK?║
╟──────────────────────────────────────┼───╢
║ bundle exec rails console │ N ║
║ bundle exec rails console production │ Y ║
║ bundle exec rails server │ Y ║
║ bundle exec rails server production │ N ║
╚══════════════════════════════════════╧═══╝
My first question: is this expected? (I would have thought the pattern in the right column should be N-Y-N-Y.)
More info: bundle exec rails console fails for the understandable reason that the sqlite3 gem is not installed on the server. However, bundle exec rails server production fails with a much less understandable trace:
$ bundle exec rails server production
Exiting
/home/spkspike/www/spike.sampablokuper.com/releases/20120530134819/vendor/ruby/1.9.1/gems/rack-1.4.1/lib/rack/handler.rb:63:in `require': cannot load such file -- rack/handler/production (LoadError)
from /home/spkspike/www/spike.sampablokuper.com/releases/20120530134819/vendor/ruby/1.9.1/gems/rack-1.4.1/lib/rack/handler.rb:63:in `try_require'
from /home/spkspike/www/spike.sampablokuper.com/releases/20120530134819/vendor/ruby/1.9.1/gems/rack-1.4.1/lib/rack/handler.rb:16:in `get'
from /home/spkspike/www/spike.sampablokuper.com/releases/20120530134819/vendor/ruby/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:269:in `server'
from /home/spkspike/www/spike.sampablokuper.com/releases/20120530134819/vendor/ruby/1.9.1/gems/railties-3.2.3/lib/rails/commands/server.rb:59:in `start'
from /home/spkspike/www/spike.sampablokuper.com/releases/20120530134819/vendor/ruby/1.9.1/gems/railties-3.2.3/lib/rails/commands.rb:55:in `block in <top (required)>'
from /home/spkspike/www/spike.sampablokuper.com/releases/20120530134819/vendor/ruby/1.9.1/gems/railties-3.2.3/lib/rails/commands.rb:50:in `tap'
from /home/spkspike/www/spike.sampablokuper.com/releases/20120530134819/vendor/ruby/1.9.1/gems/railties-3.2.3/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
My second question: how best to troubleshoot this error?
Don’t you want to be starting the server in production mode using the production environment?
The syntax difference between rails console environment and rails server -e environment is a bit of a PITA