mongrel not starting to port 80

Hello,

I'm a newbie to this, so I appreciate you patience and help. I'm trying to start mongrel running and not getting anywhere real fast.

I type the command to start:

mongrel_rails start -a IPAddress -e production -c /home/path -l log/mongrel.log -p 80 -d

The log shows it started fine:

from /home/path/config/../vendor/rails/railties/lib/initializer.rb:49:in `

send'

from /home/path/config/../vendor/rails/railties/lib/initializer.rb:49:in `

run'

from /home/path/config/environment.rb:64

from /usr/lib/ruby/siteruby/1.8/rubygems/customrequire.rb:31:in `gemoriginalrequire'

from /usr/lib/ruby/siteruby/1.8/rubygems/customrequire.rb:31:in `require'

… 9 levels…

from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/command.rb:212:in `run'

from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281

from /usr/bin/mongrel_rails:19:in `load'

from /usr/bin/mongrel_rails:19

However, netstat doesn't show it running:

Active Internet connections (only servers)

Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name

tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 4362/mysqld

tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 4182/sshd

tcp6 0 0 :::11211 :::* LISTEN 4389/memcached

tcp6 0 0 :::22 :::* LISTEN 4182/sshd

But if I type ps aux | grep mongrel it does show it running, but I don't think on port 80:

root 4611 0.0 0.0 1848 236 hvc0 S+ 21:10 0:00 grep --colour=auto mongrel

Of course the website isn't reachable. I sure would appreciate some detailed pointers to figuring this out! Thanks

15 Replies

@FatCat:

But if I type ps aux | grep mongrel it does show it running, but I don't think on port 80:

root 4611 0.0 0.0 1848 236 hvc0 S+ 21:10 0:00 grep –colour=auto mongrel
No, this only shows that the grep mongrel process (which you started as part of the ps command pipeline) is running. Either your mongrel server has exited or something has killed it off. Does it produce any log files? Those might have useful details.

Are you running mongrel as root? (You must be root to bind port numbers below 1024.)

Do you have anything else running on port 80, like Apache or nginx?

@Vance:

@FatCat:

But if I type ps aux | grep mongrel it does show it running, but I don't think on port 80:

root 4611 0.0 0.0 1848 236 hvc0 S+ 21:10 0:00 grep –colour=auto mongrel
No, this only shows that the grep mongrel process (which you started as part of the ps command pipeline) is running. Either your mongrel server has exited or something has killed it off. Does it produce any log files? Those might have useful details.

This is all the mongrel logs show:

from /home/path/config/../vendor/rails/railties/lib/initializer.rb:49:in `

send'

from /home/path/config/../vendor/rails/railties/lib/initializer.rb:49:in `

run'

from /home/path/config/environment.rb:64

from /usr/lib/ruby/siteruby/1.8/rubygems/customrequire.rb:31:in `gemoriginalrequire'

from /usr/lib/ruby/siteruby/1.8/rubygems/customrequire.rb:31:in `require'

… 9 levels…

from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/command.rb:212:in `run'

from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281

from /usr/bin/mongrel_rails:19:in `load'

from /usr/bin/mongrel_rails:19

Is there a different log file I should look at?

@hybinet:

Are you running mongrel as root? (You must be root to bind port numbers below 1024.)

Do you have anything else running on port 80, like Apache or nginx?

It is running as root, or at least I'm logged in as root when I type the command to start it.

I'm not sure how to tell what else might be running on port 80. Is there a command I can type that will show everything running on port 80?

netstat -lpntu will show you what's listening on your server, it'll output something like

netstat -lpntu
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      20394/nginx: worker

It's the local address you want to look at

@FatCat:

This is all the mongrel logs show:

from /home/path/config/../vendor/rails/railties/lib/initializer.rb:49:in `

send'

from /home/path/config/../vendor/rails/railties/lib/initializer.rb:49:in `

run'

from /home/path/config/environment.rb:64

from /usr/lib/ruby/siteruby/1.8/rubygems/customrequire.rb:31:in `gemoriginalrequire'

from /usr/lib/ruby/siteruby/1.8/rubygems/customrequire.rb:31:in `require'

… 9 levels…

from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/command.rb:212:in `run'

from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281

from /usr/bin/mongrel_rails:19:in `load'

from /usr/bin/mongrel_rails:19

Is there a different log file I should look at?

That's a ruby traceback. That means it did not start successfully; rather, it crashed on line 19 of /usr/bin/mongrel_rails.

@hoopycat:

@FatCat:

This is all the mongrel logs show:

from /home/path/config/../vendor/rails/railties/lib/initializer.rb:49:in `

send'

from /home/path/config/../vendor/rails/railties/lib/initializer.rb:49:in `

run'

from /home/path/config/environment.rb:64

from /usr/lib/ruby/siteruby/1.8/rubygems/customrequire.rb:31:in `gemoriginalrequire'

from /usr/lib/ruby/siteruby/1.8/rubygems/customrequire.rb:31:in `require'

… 9 levels…

from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/command.rb:212:in `run'

from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281

from /usr/bin/mongrel_rails:19:in `load'

from /usr/bin/mongrel_rails:19

Is there a different log file I should look at?

That's a ruby traceback. That means it did not start successfully; rather, it crashed on line 19 of /usr/bin/mongrel_rails.

Here is the contents of mongrel_rails, but it doesn't have 19 lines:

li86-249 bin # tail mongrel_rails

version = ">= 0"

if ARGV.first =~ /^(.*)$/ and Gem::Version.correct? $1 then

version = $1

ARGV.shift

end

gem 'mongrel', version

load 'mongrel_rails'

@obs:

netstat -lpntu

will show you what's listening on your server, it'll output something like

netstat -lpntu
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      20394/nginx: worker

It's the local address you want to look at

mongrel certainly isn't listed here.

li86-249 bin # netstat -lpntu

Active Internet connections (only servers)

Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name

tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 4362/mysqld

tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 4182/sshd

tcp6 0 0 :::11211 :::* LISTEN 4389/memcached

tcp6 0 0 :::22 :::* LISTEN 4182/sshd

udp 0 0 0.0.0.0:11211 0.0.0.0:* 4389/memcached

@FatCat:

Here is the contents of mongrel_rails, but it doesn't have 19 lines:

li86-249 bin # tail mongrel_rails

How many lines does it have? Which line number is that "load 'mongrel_rails'" on? Something tells me that's probably the culprit.

@hoopycat:

@FatCat:

Here is the contents of mongrel_rails, but it doesn't have 19 lines:

li86-249 bin # tail mongrel_rails

How many lines does it have? Which line number is that "load 'mongrel_rails'" on? Something tells me that's probably the culprit.

Assuming that the initial blank line should be counted as line 1, then the load mongrel_rails command is line 10.

li86-249 bin # tail mongrel_rails

1)

2) version = ">= 0"

3)

4) if ARGV.first =~ /^(.*)$/ and Gem::Version.correct? $1 then

5) version = $1

6) ARGV.shift

7)end

8)

9)gem 'mongrel', version

10) load 'mongrel_rails'

'tail' only shows the last 10 lines of the file… try 'cat' or (for longer files) 'less'.

@hoopycat:

'tail' only shows the last 10 lines of the file… try 'cat' or (for longer files) 'less'.

Sorry about that:

li84-37 bin # cat mongrel_rails

!/usr/bin/ruby18

#

This file was generated by RubyGems.

#

The application 'mongrel' is installed as part of a gem, and

this file is here to facilitate running it.

#

require 'rubygems'

version = ">= 0"

if ARGV.first =~ /^(.*)$/ and Gem::Version.correct? $1 then

version = $1

ARGV.shift

end

gem 'mongrel', version

load 'mongrel_rails'

Ah, so it is the load command that's failing. Based on the name of the file, is it trying to load itself? (I know almost nothing about Ruby.)

BTW, you can use cat -n file or nl -ba file to number lines on a printout, or less -N file for interactive viewing.

I've started mongrel_rails in the foreground and am able to see different messages than from reviewing the log:

** Starting Rails with production environment…

/home/cbws/relaystrategycbw/vendor/rails/activerecord/lib/activerecord/connection_adapters/abstrac

t/connectionspecification.rb:217:in `establishconnection': production database is not configured (

ActiveRecord::AdapterNotSpecified)

from /home/cbws/relaystrategycbw/vendor/rails/activerecord/lib/activerecord/connection_ada

pters/abstract/connectionspecification.rb:208:in `establishconnection'

from /home/cbws/relaystrategy_cbw/config/../vendor/rails/railties/lib/initializer.rb:234:in

`initialize_database'

from /home/cbws/relaystrategy_cbw/config/../vendor/rails/railties/lib/initializer.rb:94:in `

process'

from /home/cbws/relaystrategy_cbw/config/../vendor/rails/railties/lib/initializer.rb:49:in `

send'

from /home/cbws/relaystrategy_cbw/config/../vendor/rails/railties/lib/initializer.rb:49:in `

run'

from /home/cbws/relaystrategy_cbw/config/environment.rb:64

from /usr/lib/ruby/siteruby/1.8/rubygems/customrequire.rb:31:in `gemoriginalrequire'

from /usr/lib/ruby/siteruby/1.8/rubygems/customrequire.rb:31:in `require'

… 9 levels…

from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/command.rb:212:in `run'

from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281

from /usr/bin/mongrel_rails:19:in `load'

from /usr/bin/mongrel_rails:19

Does this help anybody?

Here is the info from connection_specification.rb lines 217 & 208 that are referenced in the start up output:

205 case spec

206 when nil

207 raise AdapterNotSpecified unless defined? RAILS_ENV

208 establishconnection(RAILSENV)

209 when ConnectionSpecification

210 clearactiveconnection_name

211 @activeconnectionname = name

212 @@defined_connections[name] = spec

213 when Symbol, String

214 if configuration = configurations[spec.to_s]

215 establish_connection(configuration)

216 else

217 raise AdapterNotSpecified, "#{spec} database is not configur 217 ed"

218 end

219 else

220 spec = spec.symbolize_keys

221 unless spec.key?(:adapter) then raise AdapterNotSpecified, "da 221 tabase confi

guration does not specify adapter" end

222

223 begin

224 require 'rubygems'

225 gem "activerecord-#{spec[:adapter]}-adapter"

226 require "activerecord/connectionadapters/#{spec[:adapter]} 226 _adapter"

227 rescue LoadError

228 begin

229 require "activerecord/connectionadapters/#{spec[:adapter 229 ]}_adapter"

230 rescue LoadError

231 raise "Please install the #{spec[:adapter]} adapter: `gem 231 install acti

verecord-#{spec[:adapter]}-adapter` (#{$!})"

232 end

233 end

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct