madpato

Well-Known Member
May 30, 2008
51
1
58
Hello

I have a customer who wants to install a rails app on my cpanel vps server he is making some tests but when he tries to start the server (or even i as root do it) i got some errors, im pasting the output:

Thu Jan 20 15:17:34 -0300 2011: Error calling Dispatcher.dispatch #<NoMethodError: undefined method `[]' for nil:NilClass>
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/cgi.rb:108:in `send_cookies'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/cgi.rb:136:in `out'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/http_response.rb:65:in `start'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/cgi.rb:135:in `out'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:81:in `process'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:159:in `process_client'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:158:in `each'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:158:in `process_client'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:285:in `run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:285:in `initialize'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:285:in `new'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:285:in `run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:268:in `initialize'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:268:in `new'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:268:in `run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:282:in `run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:281:in `each'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:281:in `run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:128:in `run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/command.rb:212:in `run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281
/usr/bin/mongrel_rails:19:in `load'
/usr/bin/mongrel_rails:19
Well thats on the mongrel log, my versions of RoR are:

ruby 1.8.7 (2009-06-08 patchlevel 173) [x86_64-linux]
Rails 2.3.8

Installed via the script cpanel provides. I am not a RoR expert and since this is the cpanel installer i tho that the first thing to do was ask here.

Hope you can help me, thanks in advance.
 

cPanelDon

cPanel Quality Assurance Analyst
Staff member
Nov 5, 2008
2,545
12
268
Houston, Texas, U.S.A.
cPanel Access Level
DataCenter Provider
Twitter
Hello

I have a customer who wants to install a rails app on my cpanel vps server he is making some tests but when he tries to start the server (or even i as root do it) i got some errors, im pasting the output:



Well thats on the mongrel log, my versions of RoR are:

ruby 1.8.7 (2009-06-08 patchlevel 173) [x86_64-linux]
Rails 2.3.8

Installed via the script cpanel provides. I am not a RoR expert and since this is the cpanel installer i tho that the first thing to do was ask here.

Hope you can help me, thanks in advance.
I think the issue described appears similar to the following bug report: #4690 Mongrel doesn't work with rails 2.3.8 - Ruby on Rails - rails
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
Hello,

Is the application actually loading at the mongrel url with the port? If it is starting up there but only logging this error and outputting text to the redirection url (the port 80 one), then it would be the same mongrel cookies header bug, which can be fixed by doing the following:

Edit /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/cgi.rb file. On line 81, you will find this line:

Code:
REMOVED_KEYS.each {|k| options.delete(k) }
Immediately before it, place the following lines:

Code:
@head['cookie'] = options['cookie'] if options['cookie']
options.delete('cookie')
Then save the file. Of note, there is an internal case (#45774) opened about the mongrel cookies header bug for us to modify that file automatically on ruby installs for /scripts/installruby so that this doesn't happen for future ruby and rails installations.

If the application really is not starting at all, then try starting it without mongrel by doing the following:

Code:
cd /home/username/rails_apps/appname
ps aux|grep mongrel
kill -9 pid# (kill the PID# of the mongrel process for that user)
ruby script/server -p port# -d
Here, you would replace username with the cPanel username, appname with the application name, the pid# with the pid number of the mongrel process for that user, and port# with the mongrel port number the application should be running on.

You should get errors on the startup without mongrel telling you why the application won't start. It is likely a Rails version mismatch if it isn't the mongrel cookie header bug mentioned earlier.
 

madpato

Well-Known Member
May 30, 2008
51
1
58
Hello

Thank you for your responses, after doing the cookie thing, now my mongrel.log says this:

** Starting Mongrel listening at 0.0.0.0:12003
** Starting Rails with production environment...
** Rails loaded.
** Loading any Rails specific GemPlugins
** Signals ready. TERM => stop. USR2 => restart. INT => stop (no restart).
** Rails signals registered. HUP => reload (without restart). It might not work well.
** Mongrel 1.1.5 available at 0.0.0.0:12003
** Writing PID file to log/mongrel.pid
Ok so if i go to http://mydomain.com:12003 i still see nothing and in the cpanel of the domain, the app has a "not running" status.
I'm missing something?

Thanks in advance.
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
Did you try the steps indicated for stopping the Mongrel process and then starting it using command line to see the results? It is likely a rails gem version mismatch if it isn't working still. Again, you'd do these steps to start it outside of mongrel:

Code:
cd /home/username/rails_apps/appname
ps aux|grep mongrel
kill -9 pid# (kill the PID# of the mongrel process for that user)
ruby script/server -p port# -d
Here, you would replace username with the cPanel username, appname with the application name, the pid# with the pid number of the mongrel process for that user, and port# with the mongrel port number the application should be running on (based on your last reply, probably 12003 would be the port number).

Otherwise, if you are still unable to troubleshoot the issue, please feel free to open a ticket using WHM > Support Center > Contact cPanel or using the link in my signature. Please post the ticket number here if you end up submitting one.

Thanks!
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
Thank you for opening a ticket, madpato. I've replied to the ticket. I believe that your host is blocking the port in question from access, since CSF didn't appear to be the issue for it not working. Mongrel itself is running and the application, so that isn't the issue. There were not errors in the logs on starting it up either. It simply will not connect from outside the server on port 12003.