Forum: Ruby on Rails Rails production version not accessible from other machines

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
738429ce64c60f95e64f8f393976a29f?d=identicon&s=25 amrita (Guest)
on 2008-10-07 02:07
(Received via mailing list)
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!
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2008-10-07 03:00
(Received via mailing list)
On Oct 7, 1:06 am, amrita <amrita.p...@gmail.com> 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
738429ce64c60f95e64f8f393976a29f?d=identicon&s=25 amrita (Guest)
on 2008-10-07 03:18
(Received via mailing list)
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!
Bee69cfed999cd13e3bff73d472a39ee?d=identicon&s=25 Hassan Schroeder (Guest)
on 2008-10-07 03:27
(Received via mailing list)
On Mon, Oct 6, 2008 at 6:17 PM, amrita <amrita.pati@gmail.com> 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? :-)

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 Schroeder ------------------------ hassan.schroeder@gmail.com
738429ce64c60f95e64f8f393976a29f?d=identicon&s=25 amrita (Guest)
on 2008-10-07 03:29
(Received via mailing list)
Yes :-) already doing it. Installed Apache and now configuring
httpd.conf. Will post an update soon, either ways. Thanks a ton guys!
738429ce64c60f95e64f8f393976a29f?d=identicon&s=25 amrita (Guest)
on 2008-10-07 05:43
(Received via mailing list)
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
D3fc5887a2f39f2e0c8989d39ce5e6f9?d=identicon&s=25 Bharat Ruparel (bruparel)
on 2008-10-07 14:53
(Received via mailing list)
Can you post your /etc/hosts files from both development and
production?
Bharat
738429ce64c60f95e64f8f393976a29f?d=identicon&s=25 amrita (Guest)
on 2008-10-07 20:11
(Received via mailing list)
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
This topic is locked and can not be replied to.