Rails production version not accessible from other machines

Hi,

I just deployed my first rails application in production mode using
Capistrano and mongrel clusters. Here are the lines in my
mongrel_cluster.yml file.

cwd: /myrailsdeploymath/current
log_file: log/mongrel.log
port: “8000”
environment: production
address: myserver.mydomain.org
id_file: tmp/pids/mongrel.pid
servers: 3

My development and production machine are the same.
When I run cap deploy, I can view my application perfectly well at:

http://myserver.mydomain.org:8000/app

from my own machine “myserver”.

However, I am unable to access the application from other computers on
the intranet. The ports are open. I tested the development version on
ports 8000, 8001, and 8002, using both WeBrick and Mongrel and I can
access the application from other machines in the development mode.

But this doesn’t happen in the production mode. I get a “This URL is
valid, but the connection was refused” error.

Does anyone know why this is happening? I have already spent a lot of
time trying to get at the cause of this problem.

Many thanks in advance!

On Oct 7, 1:06 am, amrita [email protected] wrote:

address: myserver.mydomain.org
However, I am unable to access the application from other computers on
the intranet. The ports are open. I tested the development version on
ports 8000, 8001, and 8002, using both WeBrick and Mongrel and I can
access the application from other machines in the development mode.

Almost certainly mongrel cluster is binding the app to localhost (ie
is only accessible at the address 127.0.0.1).

You shouldn’t be accessing the mongrels directly - typicall an
instance of apache, nginx etc… sits between browsers and the
mongrels, load balancing across them.

Fred

Actually, I checked that by changing the address in
mongrel_cluster.yml. When I set the address to myserver.mydomain.com,
I can only access it at that address and not at 127.0.0.1 and vice-
versa from my computer. In either case, the site is not accessible
from other computers.

Ultimately, I plan to use Apache for load balancing the mongrels. When
I do that, will the binding of the app to localhost create a problem?

For now, is there some way of making the app available from other
computers?

Thanks!

On Mon, Oct 6, 2008 at 6:17 PM, amrita [email protected] wrote:

Ultimately, I plan to use Apache for load balancing the mongrels. When
I do that, will the binding of the app to localhost create a problem?

No, so why wait? :slight_smile:

Installing Apache httpd is about a 5-minute job. For that matter, you
could also install mod_rails – so now it’s, maybe, 8-10 minutes –
and dump the mongrels…

FWIW,

Hassan S. ------------------------ [email protected]

Yes :slight_smile: already doing it. Installed Apache and now configuring
httpd.conf. Will post an update soon, either ways. Thanks a ton guys!

OK, I loaded the Mongrels onto Apache and got it working.

But one thing still beats me. Why is it that when Mongrel is running
in a development environment, the pages are accessible from all
computers on the intranet, whereas in production mode, mongrel-served
pages are only visible from localhost?

Amrita

Can you post your /etc/hosts files from both development and
production?
Bharat

Here is the /etc/hosts file. Both production and dev are on the same
machine. OK, so I get why 127.0.0.1 and myserver.mydomain.org are not
mapped to one another. For that I will need to have a line
“127.0.0.1 myserver.mydomain.org myserver” in /etc/hosts.
But the dev/prod accessibility problem is still unresolved.

127.0.0.1 localhost
127.0.1.1 myserver.mydomain.org myserver

The following lines are desirable for IPv6 capable hosts

::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts