Error with Phusion Passenger while setting up Rails on Ubuntu Server - ruby-on-rails

I need help getting a rails app running on an Ubuntu 11.10 Server.
I have been at it for about 2 days and can't get past the part shown in the screen shot here. I have rvm, rails, ruby, capistrano, fusion passenger all installed correctly as far as I can tell. I think the issue I have has to do with the database (mysql) or getting rails to talk to the database (I'm just making a guess from the error messages below).
Error message:
undefined method `active_record' for #<Rails::Application::Configuration:0x00000002e43fe8>
Exception class:
NoMethodError
Application root:
/var/www/jamesbay/blog/current
My main question is how can I go about debugging this?
I have tried modifying the config.ru file, application.rb, and environment.rb as listed with no resolution. I'm not entirely sure what these errors even imply!
I have capistrano deploying to my directory on the server properly.
I can make updates to a git repo and use the various 'cap' commands to handle the actual deployment from local machine to server.
Any help is appreciated! (I have only been using rails for about 2 weeks and I have already learned a TON about server management due to this project)
Errors
0 /usr/local/rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.8/lib/rails/railtie/configuration.rb 85 in `method_missing'
1 /home/jamesbay/blog/releases/20121026055113/config/application.rb 54 in `'
2 /home/jamesbay/blog/releases/20121026055113/config/application.rb 13 in `'
3 /home/jamesbay/blog/releases/20121026055113/config/application.rb 12 in `'
4 /home/jamesbay/blog/releases/20121026055113/config/environment.rb 2 in `require'
5 /home/jamesbay/blog/releases/20121026055113/config/environment.rb 2 in `'
6 config.ru 3 in `require'
7 config.ru 3 in `block in '
8 /usr/local/rvm/gems/ruby-1.9.3-p286/gems/rack-1.4.1/lib/rack/builder.rb 51 in `instance_eval'
9 /usr/local/rvm/gems/ruby-1.9.3-p286/gems/rack-1.4.1/lib/rack/builder.rb 51 in `initialize'
10 config.ru 1 in `new'
11 config.ru
Setup
Rails 3.2.8
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
rvm 1.16.17 (stable)
Capistrano 2.13.4
Phusion Passenger 3.0.17
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.24
- RUBY VERSION: 1.9.3 (2012-04-20 patchlevel 194) [x86_64-linux]
- INSTALLATION DIRECTORY: /usr/local/rvm/gems/ruby-1.9.3-p194
- RUBY EXECUTABLE: /usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/rvm/gems/ruby-1.9.3-p194/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /usr/local/rvm/gems/ruby-1.9.3-p194
- /usr/local/rvm/gems/ruby-1.9.3-p194#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
Gems used
actionmailer (3.2.8)
actionpack (3.2.8)
activemodel (3.2.8)
activerecord (3.2.8)
activeresource (3.2.8)
activesupport (3.2.8)
arel (3.0.2)
bcrypt-ruby (3.0.1)
builder (3.0.4)
bundler (1.2.1)
capistrano (2.13.4)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.4.0)
erubis (2.7.0)
execjs (1.4.0)
highline (1.6.15)
hike (1.2.1)
i18n (0.6.1)
journey (1.0.4)
jquery-rails (2.1.3)
json (1.7.5)
mail (2.4.4)
mime-types (1.19)
multi_json (1.3.6)
mysql2 (0.3.11)
net-scp (1.0.4)
net-sftp (2.0.5)
net-ssh (2.6.1)
net-ssh-gateway (1.1.0)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
rack-ssl (1.3.2)
rack-test (0.6.2)
rails (3.2.8)
railties (3.2.8)
rake (0.9.2.2)
rdoc (3.12)
rubygems-bundler (1.1.0)
rvm (1.11.3.5)
sass (3.2.1)
sass-rails (3.2.5)
sprockets (2.1.3)
sqlite3 (1.3.6)
thor (0.16.0)
tilt (1.3.3)
treetop (1.4.11)
tzinfo (0.3.33)
uglifier (1.3.0)
--
This is what shows up in the log file after opening the app in a browser just now:
[Fri Oct 26 07:46:15 2012] [notice] Graceful restart requested, doing restart
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626/gd.so' - /usr/lib/php5/20090626/gd.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626/mcrypt.so' - /usr/lib/php5/20090626/mcrypt.so: cannot open shared object file: No such file or directory in Unknown on line 0
[Fri Oct 26 07:46:15 2012] [notice] Apache/2.2.20 (Ubuntu) DAV/2 SVN/1.6.12 PHP/5.3.6-13ubuntu3.7 with Suhosin-Patch Phusion_Passenger/3.0.17 configured -- resuming normal operations
[ pid=30885 thr=4411480 file=utils.rb:176 time=2012-10-26 12:56:40.708 ]: *** Exception NoMethodError in PhusionPassenger::Rack::ApplicationSpawner (undefined method `active_record' for #<Rails::Application::Configuration:0x00000001931f38>) (process 30885, thread #<Thread:0x0000000086a0b0>):
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.8/lib/rails/railtie/configuration.rb:85:in `method_missing'
from /home/jamesbay/blog/releases/20121026055113/config/application.rb:54:in `<class:Application>'
from /home/jamesbay/blog/releases/20121026055113/config/application.rb:13:in `<module:Blog>'
from /home/jamesbay/blog/releases/20121026055113/config/application.rb:12:in `<top (required)>'
from /home/jamesbay/blog/releases/20121026055113/config/environment.rb:2:in `require'
from /home/jamesbay/blog/releases/20121026055113/config/environment.rb:2:in `<top (required)>'
from config.ru:3:in `require'
from config.ru:3:in `block in <main>'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize'
from config.ru:1:in `new'
from config.ru:1:in `<main>'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.17/lib/phusion_passenger/rack/application_spawner.rb:225:in `eval'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.17/lib/phusion_passenger/rack/application_spawner.rb:225:in `load_rack_app'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.17/lib/phusion_passenger/rack/application_spawner.rb:157:in `block in initialize_server'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.17/lib/phusion_passenger/utils.rb:563:in `report_app_init_status'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.17/lib/phusion_passenger/rack/application_spawner.rb:154:in `initialize_server'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:204:in `start_synchronously'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:180:in `start'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.17/lib/phusion_passenger/rack/application_spawner.rb:129:in `start'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.17/lib/phusion_passenger/spawn_manager.rb:253:in `block (2 levels) in spawn_rack_application'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.17/lib/phusion_passenger/spawn_manager.rb:246:in `block in spawn_rack_application'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server_collection.rb:82:in `block in synchronize'
from <internal:prelude>:10:in `synchronize'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.17/lib/phusion_passenger/spawn_manager.rb:244:in `spawn_rack_application'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.17/lib/phusion_passenger/spawn_manager.rb:137:in `spawn_application'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.17/lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.17/helper-scripts/passenger-spawn-server:99:in `<main>'
After switching to rails 1.9.3-p194 (same as my dev machine) and removing p286, I get a message saying "the page you were looking for doesn't exist" in RED when I goto my site.
This is the output of the error.log file:
Rails Error: Unable to access log file. Please ensure that /home/jamesbay/blog/releases/20121026205006/log/production.log exists and is chmod 0666. The log level has been raised to WARN and the output directed to STDERR until the problem is fixed.
ActionController::RoutingError (No route matches [GET] "/jamesbay"):
actionpack (3.2.8) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.8) lib/rails/rack/logger.rb:26:in `call_app'
railties (3.2.8) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.1) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.8) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.1) lib/rack/lock.rb:15:in `call'
rack-cache (1.2) lib/rack/cache/context.rb:136:in `forward'
rack-cache (1.2) lib/rack/cache/context.rb:245:in `fetch'
rack-cache (1.2) lib/rack/cache/context.rb:185:in `lookup'
rack-cache (1.2) lib/rack/cache/context.rb:66:in `call!'
rack-cache (1.2) lib/rack/cache/context.rb:51:in `call'
railties (3.2.8) lib/rails/engine.rb:479:in `call'
railties (3.2.8) lib/rails/application.rb:223:in `call'
railties (3.2.8) lib/rails/railtie/configurable.rb:30:in `method_missing'
passenger (3.0.17) lib/phusion_passenger/rack/request_handler.rb:96:in `process_request'
passenger (3.0.17) lib/phusion_passenger/abstract_request_handler.rb:516:in `accept_and_process_next_request'
passenger (3.0.17) lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'
passenger (3.0.17) lib/phusion_passenger/rack/application_spawner.rb:206:in `start_request_handler'
passenger (3.0.17) lib/phusion_passenger/rack/application_spawner.rb:171:in `block in handle_spawn_application'
passenger (3.0.17) lib/phusion_passenger/utils.rb:470:in `safe_fork'
passenger (3.0.17) lib/phusion_passenger/rack/application_spawner.rb:166:in `handle_spawn_application'
passenger (3.0.17) lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
passenger (3.0.17) lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
passenger (3.0.17) lib/phusion_passenger/abstract_server.rb:180:in `start'
passenger (3.0.17) lib/phusion_passenger/rack/application_spawner.rb:129:in `start'
passenger (3.0.17) lib/phusion_passenger/spawn_manager.rb:253:in `block (2 levels) in spawn_rack_application'
passenger (3.0.17) lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
passenger (3.0.17) lib/phusion_passenger/spawn_manager.rb:246:in `block in spawn_rack_application'
passenger (3.0.17) lib/phusion_passenger/abstract_server_collection.rb:82:in `block in synchronize'
<internal:prelude>:10:in `synchronize'
passenger (3.0.17) lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
passenger (3.0.17) lib/phusion_passenger/spawn_manager.rb:244:in `spawn_rack_application'
passenger (3.0.17) lib/phusion_passenger/spawn_manager.rb:137:in `spawn_application'
passenger (3.0.17) lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
passenger (3.0.17) lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
passenger (3.0.17) lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
passenger (3.0.17) helper-scripts/passenger-spawn-server:99:in `<main>'

I ended up resolving my issue.
The primary issue was due to having multiple versions of ruby installed and managed with rvm.
This coupled with not properly initializing my database AND not setting up my apache paths properly led to the errors.
My default ruby version was set to ruby-1.9.3-p286 but I was using ruby-1.9.3-p194 on my development machine. I had previously installed both versions on the server but didn't pick a default. Make sure you pick a default version before deployment.
I am using sub URI's and I hadn't set up the paths properly with symlinks. For example, I have my application files inside /home/username/appName, with the public directory living at /home/username/appName/current/public. Inside my DocumentRoot, /var/www I created a symlink called 'appName' that points to the public directory path. Where I messed up was in not defining the RackBasedURI path in my /etc/apache2/sites-available/default file.
This process is referenced here:
http://www.modrails.com/documentation/Users%20guide%20Apache.html#deploying_rack_to_sub_uri

Related

Can't start Rails server on 3.2.6 system

I am having a major issue trying to start my Rails project. I am taking a rails 4.0.0 project and trying to run it on a Rails 3.2.6 system. My work environment uses a Rails 3.2.6 environment and my system at home where I was working from home (a mac mini) uses rails 4. I have since started using my Linux laptop which has Rails 3.2.6 like my employer uses.
Here is my error trace:
ironmantis7x#ironscribe5:~/RoR_projects/mock_devices2$ rails server
=> Booting WEBrick
=> Rails 3.2.6 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448#rails_testbed1/gems/actionpack-3.2.6/lib/action_dispatch/routing/mapper.rb:260:in `merge': can't convert String into Hash (TypeError)
from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448#rails_testbed1/gems/actionpack-3.2.6/lib/action_dispatch/routing/mapper.rb:260:in `root'
from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448#rails_testbed1/gems/actionpack-3.2.6/lib/action_dispatch/routing/mapper.rb:1317:in `root'
from /home/ironmantis7x/RoR_projects/mock_devices2/config/routes.rb:10:in `block in <top (required)>'
from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448#rails_testbed1/gems/actionpack-3.2.6/lib/action_dispatch/routing/route_set.rb:282:in `instance_exec'
from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448#rails_testbed1/gems/actionpack-3.2.6/lib/action_dispatch/routing/route_set.rb:282:in `eval_block'
from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448#rails_testbed1/gems/actionpack-3.2.6/lib/action_dispatch/routing/route_set.rb:260:in `draw'
from /home/ironmantis7x/RoR_projects/mock_devices2/config/routes.rb:1:in `<top (required)>'
from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448#rails_testbed1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:245:in `load'
from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448#rails_testbed1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:245:in `block in load'
from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448#rails_testbed1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:236:in `load_dependency'
from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448#rails_testbed1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:245:in `load'
from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448#rails_testbed1/gems/railties-3.2.6/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448#rails_testbed1/gems/railties-3.2.6/lib/rails/application/routes_reloader.rb:40:in `each'
from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448#rails_testbed1/gems/railties-3.2.6/lib/rails/application/routes_reloader.rb:40:in `load_paths'
from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448#rails_testbed1/gems/railties-3.2.6/lib/rails/application/routes_reloader.rb:16:in `reload!'
from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448#rails_testbed1/gems/railties-3.2.6/lib/rails/application/routes_reloader.rb:26:in `block in updater'
from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448#rails_testbed1/gems/activesupport-3.2.6/lib/active_support/file_update_checker.rb:78:in `call'
from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448#rails_testbed1/gems/activesupport-3.2.6/lib/active_support/file_update_checker.rb:78:in `execute'
from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448#rails_testbed1/gems/railties-3.2.6/lib/rails/application/routes_reloader.rb:27:in `updater'
from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448#rails_testbed1/gems/railties-3.2.6/lib/rails/application/routes_reloader.rb:7:in `execute_if_updated'
from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448#rails_testbed1/gems/railties-3.2.6/lib/rails/application/finisher.rb:66:in `block in <module:Finisher>'
from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448#rails_testbed1/gems/railties-3.2.6/lib/rails/initializable.rb:30:in `instance_exec'
from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448#rails_testbed1/gems/railties-3.2.6/lib/rails/initializable.rb:30:in `run'
from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448#rails_testbed1/gems/railties-3.2.6/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448#rails_testbed1/gems/railties-3.2.6/lib/rails/initializable.rb:54:in `each'
from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448#rails_testbed1/gems/railties-3.2.6/lib/rails/initializable.rb:54:in `run_initializers'
from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448#rails_testbed1/gems/railties-3.2.6/lib/rails/application.rb:136:in `initialize!'
from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448#rails_testbed1/gems/railties-3.2.6/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/ironmantis7x/RoR_projects/mock_devices2/config/environment.rb:5:in `<top (required)>'
from /home/ironmantis7x/RoR_projects/mock_devices2/config.ru:4:in `require'
from /home/ironmantis7x/RoR_projects/mock_devices2/config.ru:4:in `block in <main>'
from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448#rails_testbed1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval'
from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448#rails_testbed1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize'
from /home/ironmantis7x/RoR_projects/mock_devices2/config.ru:1:in `new'
from /home/ironmantis7x/RoR_projects/mock_devices2/config.ru:1:in `<main>'
from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448#rails_testbed1/gems/rack-1.4.1/lib/rack/builder.rb:40:in `eval'
from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448#rails_testbed1/gems/rack-1.4.1/lib/rack/builder.rb:40:in `parse_file'
from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448#rails_testbed1/gems/rack-1.4.1/lib/rack/server.rb:200:in `app'
from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448#rails_testbed1/gems/railties-3.2.6/lib/rails/commands/server.rb:46:in `app'
from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448#rails_testbed1/gems/rack-1.4.1/lib/rack/server.rb:301:in `wrapped_app'
from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448#rails_testbed1/gems/rack-1.4.1/lib/rack/server.rb:252:in `start'
from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448#rails_testbed1/gems/railties-3.2.6/lib/rails/commands/server.rb:70:in `start'
from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448#rails_testbed1/gems/railties-3.2.6/lib/rails/commands.rb:55:in `block in <top (required)>'
from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448#rails_testbed1/gems/railties-3.2.6/lib/rails/commands.rb:50:in `tap'
from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448#rails_testbed1/gems/railties-3.2.6/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
ironmantis7x#ironscribe5:~/RoR_projects/mock_devices2$
Here is my environment.rb file:
# Load the Rails application.
require File.expand_path('../application', __FILE__)
# Initialize the Rails application.
MockDevices2::Application.initialize!
And here is my boot.rb file:
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
require 'thread'
my gem list is as follows:
actionmailer (3.2.6)
actionpack (3.2.6)
activemodel (3.2.6)
activerecord (3.2.6)
activeresource (3.2.6)
activesupport (3.2.6)
arel (3.0.2)
builder (3.0.4)
bundler (1.3.5)
bundler-unload (1.0.1)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.6.2)
erubis (2.7.0)
execjs (1.4.0)
hike (1.2.3)
i18n (0.6.4)
jbuilder (1.4.2)
journey (1.0.4)
jquery-rails (3.0.1)
json (1.8.0)
mail (2.4.4)
mime-types (1.23)
mini_portile (0.5.0)
multi_json (1.7.7)
nokogiri (1.6.0)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
rack-ssl (1.3.3)
rack-test (0.6.2)
rails (3.2.6)
railties (3.2.6)
rake (10.1.0)
rdoc (3.12.2)
rubygems-bundler (1.2.0)
rvm (1.11.3.8)
sass (3.2.9)
sass-rails (3.2.6)
sdoc (0.3.20)
sprockets (2.1.3)
sqlite3 (1.3.7)
thor (0.18.1)
tilt (1.4.1)
treetop (1.4.14)
turbolinks (1.2.0)
tzinfo (0.3.37)
uglifier (2.1.1)
Can you post your routes.rb? Seems like the problem is at
from /home/ironmantis7x/RoR_projects/mock_devices2/config/routes.rb:10:in `block in <top (required)>'
This happened to me and the problem was that I used
root 'welcome#index'
instead of
root to: 'welcome#index'
and rails 3 doesn't like that

Deploying rails with capistrano, passenger and apache

I have recently set up a VPS and am trying to deploy a rails app. I watched a screencast: http://railscasts.com/episodes/335-deploying-to-a-vps which explained how to setup capistrano and unicorn with nginx, but also gave examples for apache.
I followed online guide for setting up passenger and adapted the railscasts capistrano recipe. When I run cap deploy:setup some directories are created on my server in the root of the application. Then when I run cap deploy the rails app is put into the releases folder and in a directory named by timestamp. So that part seems to work just fine.
So then for a while when i navigated to http://dev.gregchapple.com/site/index I got some passenger errors saying that certain gems were missing, so I installed them on the server using bundler then the errors went away. Thats when the current problem arose. Now when I go to http://dev.gregchapple.com/site/index all it says is: "We're sorry, but something went wrong."
The apache log contains this:
cache: [GET /site/index] miss
cache: [GET /] miss
Does anyone know what the problem is?
My apache config file has been altered to set the document root to the public directory as specified by the passenger docs. I dont know what the problem is and its driving me insane!
Any help is greatly appreciated :)
UPDATE
This is what appears the production.log file:
Started GET "/site/index" for 109.255.221.170 at 2012-08-06 13:26:13 -0700
Mysql2::Error (Access denied for user 'root'#'localhost' (using password: NO)):
mysql2 (0.3.11) lib/mysql2/client.rb:44:in `connect'
mysql2 (0.3.11) lib/mysql2/client.rb:44:in `initialize'
activerecord (3.2.1) lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `new'
activerecord (3.2.1) lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `mysql2_connection'
activerecord (3.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:277:in `new_connection'
activerecord (3.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:287:in `checkout_new_connection'
activerecord (3.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:235:in `block (2 levels) in checkout'
activerecord (3.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:230:in `loop'
activerecord (3.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:230:in `block in checkout' /home/greg/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
activerecord (3.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:229:in `checkout'
activerecord (3.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:95:in `connection'
activerecord (3.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:374:in `retrieve_connection'
activerecord (3.2.1) lib/active_record/connection_adapters/abstract/connection_specification.rb:168:in `retrieve_connection'
activerecord (3.2.1) lib/active_record/connection_adapters/abstract/connection_specification.rb:142:in `connection'
activerecord (3.2.1) lib/active_record/query_cache.rb:67:in `rescue in call'
activerecord (3.2.1) lib/active_record/query_cache.rb:61:in `call'
activerecord (3.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:443:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.1) lib/active_support/callbacks.rb:405:in `_run__3520547282522082875__call__1971459733125288916__callbacks'
activesupport (3.2.1) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.1) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.1) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.1) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.1) lib/rails/rack/logger.rb:26:in `call_app'
railties (3.2.1) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.1) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.1) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.1) lib/rack/lock.rb:15:in `call'
rack-cache (1.2) lib/rack/cache/context.rb:136:in `forward'
rack-cache (1.2) lib/rack/cache/context.rb:245:in `fetch'
rack-cache (1.2) lib/rack/cache/context.rb:185:in `lookup'
rack-cache (1.2) lib/rack/cache/context.rb:66:in `call!'
rack-cache (1.2) lib/rack/cache/context.rb:51:in `call'
railties (3.2.1) lib/rails/engine.rb:479:in `call'
railties (3.2.1) lib/rails/application.rb:220:in `call'
railties (3.2.1) lib/rails/railtie/configurable.rb:30:in `method_missing'
passenger (3.0.15) lib/phusion_passenger/rack/request_handler.rb:96:in `process_request'
passenger (3.0.15) lib/phusion_passenger/abstract_request_handler.rb:516:in `accept_and_process_next_request'
passenger (3.0.15) lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'
passenger (3.0.15) lib/phusion_passenger/rack/application_spawner.rb:206:in `start_request_handler'
passenger (3.0.15) lib/phusion_passenger/rack/application_spawner.rb:171:in `block in handle_spawn_application'
passenger (3.0.15) lib/phusion_passenger/utils.rb:470:in `safe_fork'
passenger (3.0.15) lib/phusion_passenger/rack/application_spawner.rb:166:in `handle_spawn_application'
passenger (3.0.15) lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
passenger (3.0.15) lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
passenger (3.0.15) lib/phusion_passenger/abstract_server.rb:180:in `start'
passenger (3.0.15) lib/phusion_passenger/rack/application_spawner.rb:129:in `start'
passenger (3.0.15) lib/phusion_passenger/spawn_manager.rb:253:in `block (2 levels) in spawn_rack_application'
passenger (3.0.15) lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
passenger (3.0.15) lib/phusion_passenger/spawn_manager.rb:246:in `block in spawn_rack_application'
passenger (3.0.15) lib/phusion_passenger/abstract_server_collection.rb:82:in `block in synchronize'
<internal:prelude>:10:in `synchronize'
passenger (3.0.15) lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
passenger (3.0.15) lib/phusion_passenger/spawn_manager.rb:244:in `spawn_rack_application'
passenger (3.0.15) lib/phusion_passenger/spawn_manager.rb:137:in `spawn_application'
passenger (3.0.15) lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
passenger (3.0.15) lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
passenger (3.0.15) lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
passenger (3.0.15) helper-scripts/passenger-spawn-server:99:in `<main>'
Update 2
database.yml
development:
adapter: mysql2
encoding: utf8
reconnect: false
database: gregchapple_development
pool: 5
host: localhost
username: root
password: *****
socket: /tmp/mysql.sock
test:
adapter: mysql2
encoding: utf8
reconnect: false
database: gregchapple_test
pool: 5
host: localhost
username: root
password: *****
socket: /tmp/mysql.sock
production:
adapter: mysql2
encoding: utf8
reconnect: false
database: gregchapple_production
pool: 5
host: localhost
username: root
password: *****
socket: /tmp/mysql.sock
I had similar problem like you. I changed these rows in database.yml
add
host: 127.0.0.1
remove
socket: /tmp/mysql.sock
Then:
cap deploy:setup
cap deploy:check
cap deploy:cold
#some updates with custom code
cap deploy:update
You must update everything in code with capistrano, DON'T CHANGE CODE ON VPN (you can create only tmp dir).
You check your sql connection manualy with ssh on vpn. For example
mysql -u gregchapple -p
Your virtual host is ok?
Your app is looking for the mysql2 adapter, so make sure in your Gemfile you have
gem 'mysql2'
and that you bundle install and that in your database.yml file you are using the mysql2 adapter.
production:
adapter: mysql2
...
And don't forget to restart Passenger - touch tmp/restart.txt from the root of the Rails app.
Congrats! You're almost there!
Your Rails app's database.yml's production section is not configured properly.
Configure mysql database on your server.
Configure production section in database.yml in your rails app and provide db username and password for production server.
Deploy again.
Test.

Rails routing error. Application doesn't run

Heyy guys, please help me. I am from 4 days on dreamhost setting up rails. Finally rails has started working but application is not running. I have just deployed a demo app with only one model Products and the page doesn't opens, it says page doesn't exist. There is written routing error in production log file. I am novice in Rails so could'nt figure out what is going wrong. You can try yourself running app http://meropati.com/products and see source code of this app with log files on my git repository *https://github.com/getaasciesh/TestingRailsOnDreamHost*
I will be so thankful to get it's solution.
Started GET "/products" for 208.113.229.116 at 2012-07-26 16:05:55 -0700
ActionController::RoutingError (No route matches [GET] "/products"):
actionpack (3.2.6) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
actionpack (3.2.6) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.6) lib/rails/rack/logger.rb:26:in `call_app'
railties (3.2.6) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.6) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.1) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.6) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.1) lib/rack/lock.rb:15:in `call'
rack-cache (1.2) lib/rack/cache/context.rb:136:in `forward'
rack-cache (1.2) lib/rack/cache/context.rb:245:in `fetch'
rack-cache (1.2) lib/rack/cache/context.rb:185:in `lookup'
rack-cache (1.2) lib/rack/cache/context.rb:66:in `call!'
rack-cache (1.2) lib/rack/cache/context.rb:51:in `call'
railties (3.2.6) lib/rails/engine.rb:479:in `call'
railties (3.2.6) lib/rails/application.rb:220:in `call'
railties (3.2.6) lib/rails/railtie/configurable.rb:30:in `method_missing'
/home/getaasciesh3/.passenger/standalone/3.0.14-x86_64-ruby1.9.3-linux-gcc4.4.5-1002/support/lib/phusion_passenger/rack/request_handler.rb:96:in `process_request'
/home/getaasciesh3/.passenger/standalone/3.0.14-x86_64-ruby1.9.3-linux-gcc4.4.5-1002/support/lib/phusion_passenger/abstract_request_handler.rb:516:in `accept_and_process_next_request'
/home/getaasciesh3/.passenger/standalone/3.0.14-x86_64-ruby1.9.3-linux-gcc4.4.5-1002/support/lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'
/home/getaasciesh3/.passenger/standalone/3.0.14-x86_64-ruby1.9.3-linux-gcc4.4.5-1002/support/lib/phusion_passenger/rack/application_spawner.rb:206:in `start_request_handler'
/home/getaasciesh3/.passenger/standalone/3.0.14-x86_64-ruby1.9.3-linux-gcc4.4.5-1002/support/lib/phusion_passenger/rack/application_spawner.rb:171:in `block in handle_spawn_application'
/home/getaasciesh3/.passenger/standalone/3.0.14-x86_64-ruby1.9.3-linux-gcc4.4.5-1002/support/lib/phusion_passenger/utils.rb:470:in `safe_fork'
/home/getaasciesh3/.passenger/standalone/3.0.14-x86_64-ruby1.9.3-linux-gcc4.4.5-1002/support/lib/phusion_passenger/rack/application_spawner.rb:166:in `handle_spawn_application'
/home/getaasciesh3/.passenger/standalone/3.0.14-x86_64-ruby1.9.3-linux-gcc4.4.5-1002/support/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
/home/getaasciesh3/.passenger/standalone/3.0.14-x86_64-ruby1.9.3-linux-gcc4.4.5-1002/support/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
/home/getaasciesh3/.passenger/standalone/3.0.14-x86_64-ruby1.9.3-linux-gcc4.4.5-1002/support/lib/phusion_passenger/abstract_server.rb:180:in `start'
/home/getaasciesh3/.passenger/standalone/3.0.14-x86_64-ruby1.9.3-linux-gcc4.4.5-1002/support/lib/phusion_passenger/rack/application_spawner.rb:129:in `start'
/home/getaasciesh3/.passenger/standalone/3.0.14-x86_64-ruby1.9.3-linux-gcc4.4.5-1002/support/lib/phusion_passenger/spawn_manager.rb:253:in `block (2 levels) in spawn_rack_application'
/home/getaasciesh3/.passenger/standalone/3.0.14-x86_64-ruby1.9.3-linux-gcc4.4.5-1002/support/lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
/home/getaasciesh3/.passenger/standalone/3.0.14-x86_64-ruby1.9.3-linux-gcc4.4.5-1002/support/lib/phusion_passenger/spawn_manager.rb:246:in `block in spawn_rack_application'
/home/getaasciesh3/.passenger/standalone/3.0.14-x86_64-ruby1.9.3-linux-gcc4.4.5-1002/support/lib/phusion_passenger/abstract_server_collection.rb:82:in `block in synchronize'
<internal:prelude>:10:in `synchronize'
/home/getaasciesh3/.passenger/standalone/3.0.14-x86_64-ruby1.9.3-linux-gcc4.4.5-1002/support/lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
/home/getaasciesh3/.passenger/standalone/3.0.14-x86_64-ruby1.9.3-linux-gcc4.4.5-1002/support/lib/phusion_passenger/spawn_manager.rb:244:in `spawn_rack_application'
/home/getaasciesh3/.passenger/standalone/3.0.14-x86_64-ruby1.9.3-linux-gcc4.4.5-1002/support/lib/phusion_passenger/spawn_manager.rb:137:in `spawn_application'
/home/getaasciesh3/.passenger/standalone/3.0.14-x86_64-ruby1.9.3-linux-gcc4.4.5-1002/support/lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
/home/getaasciesh3/.passenger/standalone/3.0.14-x86_64-ruby1.9.3-linux-gcc4.4.5-1002/support/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
/home/getaasciesh3/.passenger/standalone/3.0.14-x86_64-ruby1.9.3-linux-gcc4.4.5-1002/support/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
/home/getaasciesh3/.passenger/standalone/3.0.14-x86_64-ruby1.9.3-linux-gcc4.4.5-1002/support/helper-scripts/passenger-spawn-server:99:in `<main>'
This might not matter, but you've got:
gem 'sqlite3'
group :development, :test do
gem 'sqlite3'
end
...
gem 'mysql2'
Try removing the first reference to sqlite3 as you don't want it in production.
As I said, it might not make any difference to this particular issue, but it will save you from trouble later on
Update
The dreamhost wiki advise against using passenger and rvm, as they don't play too nicely together. Read the section titled "Troubleshooting". They recommend switching to the system installation of ruby.
If you are going to try that, you will probably need to remove the reference to rvm from environment.rb
Good luck

refinerycms image not loading - dragonfly error

I'm working on developing a refinerycms rails app that was working good locally and now i've moved it to my VPS and I was having issues with images that i uploaded through refinerycms not loading and i've been reading that i needed to upgrade my version of imagemagick. I upgraded from 6.2.8 to 6.7.8. Now the images all load on some pages, but not on the admin side.
What is causing this issue? Here's the stacktrace of the error.
Dragonfly::Shell::CommandFailed (Command failed (convert '/var/www/vhosts/tomstestsite.us/PersonalTrainingKT/public/system/refinery/images/2012/06/03/16_36_48_339_pamLemke_after.jpg' '-resize' '225x255>' '/tmp/dragonfly20120705-7812-1xb3pce') with exit status 127):
dragonfly (0.9.12) lib/dragonfly/shell.rb:29:in `raise_shell_command_failed'
dragonfly (0.9.12) lib/dragonfly/shell.rb:23:in `run'
dragonfly (0.9.12) lib/dragonfly/image_magick/utils.rb:17:in `convert'
dragonfly (0.9.12) lib/dragonfly/image_magick/processor.rb:103:in `convert'
dragonfly (0.9.12) lib/dragonfly/image_magick/processor.rb:27:in `resize'
dragonfly (0.9.12) lib/dragonfly/image_magick/processor.rb:87:in `thumb'
dragonfly (0.9.12) lib/dragonfly/function_manager.rb:39:in `call'
dragonfly (0.9.12) lib/dragonfly/function_manager.rb:39:in `block (2 levels) in call_last'
dragonfly (0.9.12) lib/dragonfly/function_manager.rb:38:in `catch'
dragonfly (0.9.12) lib/dragonfly/function_manager.rb:38:in `block in call_last'
dragonfly (0.9.12) lib/dragonfly/function_manager.rb:37:in `each'
dragonfly (0.9.12) lib/dragonfly/function_manager.rb:37:in `call_last'
dragonfly (0.9.12) lib/dragonfly/processor.rb:5:in `process'
dragonfly (0.9.12) lib/dragonfly/job.rb:79:in `apply'
dragonfly (0.9.12) lib/dragonfly/job.rb:253:in `block in apply'
dragonfly (0.9.12) lib/dragonfly/job.rb:253:in `each'
dragonfly (0.9.12) lib/dragonfly/job.rb:253:in `apply'
dragonfly (0.9.12) lib/dragonfly/response.rb:25:in `to_response'
dragonfly (0.9.12) lib/dragonfly/server.rb:43:in `block in call'
dragonfly (0.9.12) lib/dragonfly/server.rb:39:in `catch'
dragonfly (0.9.12) lib/dragonfly/server.rb:39:in `call'
dragonfly (0.9.12) lib/dragonfly/middleware.rb:11:in `call'
rack-cache (1.2) lib/rack/cache/context.rb:136:in `forward'
rack-cache (1.2) lib/rack/cache/context.rb:245:in `fetch'
rack-cache (1.2) lib/rack/cache/context.rb:185:in `lookup'
rack-cache (1.2) lib/rack/cache/context.rb:66:in `call!'
rack-cache (1.2) lib/rack/cache/context.rb:51:in `call'
rack-cache (1.2) lib/rack/cache/context.rb:136:in `forward'
rack-cache (1.2) lib/rack/cache/context.rb:245:in `fetch'
rack-cache (1.2) lib/rack/cache/context.rb:185:in `lookup'
rack-cache (1.2) lib/rack/cache/context.rb:66:in `call!'
rack-cache (1.2) lib/rack/cache/context.rb:51:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/reloader.rb:65:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.3) lib/rails/rack/logger.rb:26:in `call_app'
railties (3.2.3) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.1) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.3) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.1) lib/rack/lock.rb:15:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/static.rb:62:in `call'
railties (3.2.3) lib/rails/engine.rb:479:in `call'
railties (3.2.3) lib/rails/application.rb:220:in `call'
railties (3.2.3) lib/rails/railtie/configurable.rb:30:in `method_missing'
passenger (3.0.11) lib/phusion_passenger/rack/request_handler.rb:96:in `process_request'
passenger (3.0.11) lib/phusion_passenger/abstract_request_handler.rb:513:in `accept_and_process_next_request'
passenger (3.0.11) lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'
passenger (3.0.11) lib/phusion_passenger/classic_rails/application_spawner.rb:321:in `start_request_handler'
passenger (3.0.11) lib/phusion_passenger/classic_rails/application_spawner.rb:275:in `block in handle_spawn_application'
passenger (3.0.11) lib/phusion_passenger/utils.rb:479:in `safe_fork'
passenger (3.0.11) lib/phusion_passenger/classic_rails/application_spawner.rb:270:in `handle_spawn_application'
passenger (3.0.11) lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
passenger (3.0.11) lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
passenger (3.0.11) lib/phusion_passenger/abstract_server.rb:180:in `start'
passenger (3.0.11) lib/phusion_passenger/classic_rails/application_spawner.rb:149:in `start'
passenger (3.0.11) lib/phusion_passenger/spawn_manager.rb:219:in `block (2 levels) in spawn_rails_application'
passenger (3.0.11) lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
passenger (3.0.11) lib/phusion_passenger/spawn_manager.rb:214:in `block in spawn_rails_application'
passenger (3.0.11) lib/phusion_passenger/abstract_server_collection.rb:82:in `block in synchronize'
<internal:prelude>:10:in `synchronize'
passenger (3.0.11) lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
passenger (3.0.11) lib/phusion_passenger/spawn_manager.rb:213:in `spawn_rails_application'
passenger (3.0.11) lib/phusion_passenger/spawn_manager.rb:132:in `spawn_application'
passenger (3.0.11) lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
passenger (3.0.11) lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
passenger (3.0.11) lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
passenger (3.0.11) helper-scripts/passenger-spawn-server:99:in `<main>'
UPDATE
I've added the code below to my config/application.rb file as suggested here and it helped some of the files show up, and but i'm still unable to upload a file through the app and part of this stacktrace is shown below.
config/application.rb contains this
initializer 'override-image-magick-paths', :after => 'attach-refinery-images-with-
dragonfly' do
app=Dragonfly[:refinery_images]
app.configure_with(:imagemagick)
app.configure do |c|
c.convert_command = "/usr/local/bin/convert" # defaults to "convert"
c.identify_command = "/usr/local/bin/identify" # defaults to "identify"
end
end
stacktrace
Dragonfly::Shell::CommandFailed (Command failed (identify '/tmp/RackMultipart20120708-20096-4m1k9j') with exit status 127):
dragonfly (0.9.12) lib/dragonfly/shell.rb:29:in `raise_shell_command_failed'
dragonfly (0.9.12) lib/dragonfly/shell.rb:23:in `run'
dragonfly (0.9.12) lib/dragonfly/image_magick/utils.rb:34:in `raw_identify'
dragonfly (0.9.12) lib/dragonfly/image_magick/utils.rb:24:in `identify'
dragonfly (0.9.12) lib/dragonfly/image_magick/analyser.rb:44:in `format'
dragonfly (0.9.12) lib/dragonfly/function_manager.rb:39:in `call'
dragonfly (0.9.12) lib/dragonfly/function_manager.rb:39:in `block (2 levels) in call_last'
dragonfly (0.9.12) lib/dragonfly/function_manager.rb:38:in `catch'
dragonfly (0.9.12) lib/dragonfly/function_manager.rb:38:in `block in call_last'
dragonfly (0.9.12) lib/dragonfly/function_manager.rb:37:in `each'
dragonfly (0.9.12) lib/dragonfly/function_manager.rb:37:in `call_last'
dragonfly (0.9.12) lib/dragonfly/analyser.rb:25:in `analyse'
dragonfly (0.9.12) lib/dragonfly/job.rb:247:in `analyse'
I simply reinstalled imagemagick and it worked.
I created a symbolic link from /usr/bin/convert -> /usr/local/bin/convert and from /usr/bin/identify -> /usr/local/bin/identify and that seemed to solve my problems.
$ cd /usr/bin
$ ln -s /usr/local/bin/convert convert
$ ln -s /usr/local/bin/identify identify
I'm assuming that dragonfly is still not picking up my location of convert and identify even though i specified it in my config/application.rb file.
You may have to provide the full path to convert:
config/initializers/dragonfly.rb:
app.configure do |c|
c.convert_command = "/usr/bin/convert"
end
Change /usr/bin/convert to the correct path to convert, which you can find out by running whereis convert on your VPS shell.
More details in the documentation.
Try installing the refinery-images gem:
Gemfile:
gem 'refinerycms-page-images', '~>1.0.3' //refinery v1 compatible (v2 available also)
Then in your model:
belongs_to :imagesizeyouwant, :class_name => 'Image'
If you look at the Image class you'll see a pretty nice set up for handling images. You can add image sizes in Refinery's Settings page in the admin tool. If you have a custom engine, just change :imagesizeyouwant to that size (mine was :thumbnail).
When you post the image, look at the output of the identify command and try to run it on your own. Chances are your system has different parameters it uses for ImageMagick binaries, or that the dimensions being sent to it are not understood. Try posting the output of the actual command Dragonfly is calling in the shell so we can take a better look.

New Rails App Fails loading assets

I'm trying to get a brand new skeleton app running in rails 3.1.0.rc8. However, whenever any asset tag/helper is used in a view(such as image_tag, javascript_include_tag, etc.), I get a asset compile error. Here's a snippet of my logs/development.log when I make a direct request to /assets/rails.png.
Started GET "/assets/rails.png" for 192.168.0.12 at Mon Aug 29 16:16:21 -0600 2011
Error compiling asset rails.png:
ArgumentError: wrong number of arguments (2 for 1)
activesupport (3.1.0.rc8) lib/active_support/cache/file_store.rb:101:in `respond_to?'
activesupport (3.1.0.rc8) lib/active_support/cache/file_store.rb:101:in `dump'
activesupport (3.1.0.rc8) lib/active_support/cache/file_store.rb:101:in `write_entry'
activesupport (3.1.0.rc8) lib/active_support/core_ext/file/atomic.rb:20:in `atomic_write'
activesupport (3.1.0.rc8) lib/active_support/cache/file_store.rb:101:in `write_entry'
activesupport (3.1.0.rc8) lib/active_support/cache/strategy/local_cache.rb:140:in `write_entry'
activesupport (3.1.0.rc8) lib/active_support/cache.rb:364:in `write'
activesupport (3.1.0.rc8) lib/active_support/cache.rb:520:in `instrument'
activesupport (3.1.0.rc8) lib/active_support/cache.rb:362:in `write'
sprockets (2.0.0.beta.15) lib/sprockets/caching.rb:117:in `cache_set'
sprockets (2.0.0.beta.15) lib/sprockets/caching.rb:80:in `cache_set_hash'
sprockets (2.0.0.beta.15) lib/sprockets/caching.rb:51:in `cache_asset'
sprockets (2.0.0.beta.15) lib/sprockets/environment.rb:82:in `build_asset'
sprockets (2.0.0.beta.15) lib/sprockets/trail.rb:102:in `find_asset_in_path'
sprockets (2.0.0.beta.15) lib/sprockets/base.rb:102:in `find_asset'
sprockets (2.0.0.beta.15) lib/sprockets/environment.rb:72:in `find_asset'
sprockets (2.0.0.beta.15) lib/sprockets/server.rb:42:in `call'
rack-mount (0.8.2) lib/rack/mount/prefix.rb:26:in `call'
rack-mount (0.8.2) lib/rack/mount/route_set.rb:152:in `call'
rack-mount (0.8.2) lib/rack/mount/code_generation.rb:96:in `recognize'
rack-mount (0.8.2) lib/rack/mount/code_generation.rb:68:in `optimized_each'
rack-mount (0.8.2) lib/rack/mount/code_generation.rb:95:in `recognize'
rack-mount (0.8.2) lib/rack/mount/route_set.rb:141:in `call'
actionpack (3.1.0.rc8) lib/action_dispatch/routing/route_set.rb:531:in `call'
actionpack (3.1.0.rc8) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.3.2) lib/rack/etag.rb:23:in `call'
rack (1.3.2) lib/rack/conditionalget.rb:25:in `call'
actionpack (3.1.0.rc8) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.1.0.rc8) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.1.0.rc8) lib/action_dispatch/middleware/flash.rb:243:in `call'
rack (1.3.2) lib/rack/session/abstract/id.rb:195:in `context'
rack (1.3.2) lib/rack/session/abstract/id.rb:190:in `call'
actionpack (3.1.0.rc8) lib/action_dispatch/middleware/cookies.rb:326:in `call'
activerecord (3.1.0.rc8) lib/active_record/query_cache.rb:62:in `call'
activerecord (3.1.0.rc8) lib/active_record/connection_adapters/abstract/connection_pool.rb:477:in `call'
actionpack (3.1.0.rc8) lib/action_dispatch/middleware/callbacks.rb:29:in `call'
activesupport (3.1.0.rc8) lib/active_support/callbacks.rb:392:in `_run_call_callbacks'
activesupport (3.1.0.rc8) lib/active_support/callbacks.rb:81:in `send'
activesupport (3.1.0.rc8) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.1.0.rc8) lib/action_dispatch/middleware/callbacks.rb:28:in `call'
actionpack (3.1.0.rc8) lib/action_dispatch/middleware/reloader.rb:68:in `call'
rack (1.3.2) lib/rack/sendfile.rb:101:in `call'
I'm running ruby 1.8.7 and Passenger, if relevant. Anyone else running into this error?
Fixed this by upgrading from sprockets 2.0.0.beta.15 to 2.0.0:
gem install sprockets -v=2.0.0
Kudos to Ryan Bigg for the help.
I met the same problem when compiling assets via rake task:
$ bundle exec rake assets:precompile --trace
...
** Execute assets:precompile:primary
rake aborted!
wrong number of arguments (2 for 1)
/usr/local/lib/ruby/gems/1.8/gems/activesupport-3.2.0/lib/active_support/cache/file_store.rb:91:in `respond_to?'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-3.2.0/lib/active_support/cache/file_store.rb:91:in `dump'
...
after spending 4+ hours and tried many approaches, I found that it may be an issue of Ruby. ( from this link: https://github.com/resolve/refinerycms/issues/538 )
$ ruby -v
ruby 1.8.7 (2008-05-31 patchlevel 0)
Here the patchlevel 0 is the problem. since my ruby was compiled from the source code. (some reason I can't make it installed from package manager or via RVM).
Solution:
Download a new source file from http://ftp.ruby-lang.org/pub/ruby/1.8/, e.g. patch 358 ,
compile it:
unzip ruby-1.8.7-p358.zip -d /tmp && cd /tmp/ruby-1.8.7-p358 && ./configure && make && sudo make install
now ruby has a new version: patch 358
$ ruby -v
ruby 1.8.7 (2012-02-08 patchlevel 358) [i686-linux]
and everything works!

Resources