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.
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.
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.
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?
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...
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?
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.