views:

44

answers:

2

hi,

I have a Ruby on Rails application that I'm developing on my computer, which runs Ubuntu 10.04 LTS. I'd like to be able to access it from a remote computer for testing purposes. I've no idea how to proceed. Do I need to set up port forwarding? Virtual hosts? Can anyone point me to an article/tutorial/whatever that has information about how to do this?

Thanks!

A: 

If you want to run it using the server script, you can have it listen to a specific IP address like:

script/server -b 192.168.1.5

Substitute your machine's IP address that is accessible over your network. Then other hosts can get to the Rails app via e.g. http://192.168.1.5:3000.

If you mean you're behind a firewall or NAT gateway, then the question of how people outside of your firewall/NAT can get to your machine is another question entirely... something that probably belongs on superuser.com.

Jeff
That fails with `/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/tcphack.rb:12:in `initialize_without_backlog': Cannot assign requested address - bind(2) (Errno::EADDRNOTAVAIL)`But netstat says nothing is listening on port 3000.
Johnny
Are you using mongrel_rails?
Jeff
Yep. Mongrel and rails 2.3.5.
Johnny
For mongrel, the command line parameter to listen on a specific IP address is -a (e.g., 'mongrel_rails -a 192.168.1.5'). If it still complains about the address not being available, try another port using the -p parameter even if netstat says nothing is on 3000 (e.g., 'mongrel_rails -a 192.168.1.5 -p 3003')
Jeff
`mongrel_rails start -a *.*.*.* -p 3003` yields:`** Starting Mongrel listening at *.*.*.*:3003/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/tcphack.rb:12:in `initialize_without_backlog': Cannot assign requested address - bind(2) (Errno::EADDRNOTAVAIL)`On the other hand `ruby script/server -b *.*.*.* -p 3003` yields:`=> Rails 2.3.5 application starting on http://*.*.*.*:3003Exiting/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/tcphack.rb:12:in `initialize_without_backlog': Cannot assign requested address - bind(2) (Errno::EADDRNOTAVAIL)`
Johnny
Hmm... If the IP address is valid and associated with an active network interface, and you're trying different ports, yet it still gives that error, then I'm at a loss. I've only seen that error when the port is in use or maybe if the IP address isn't in use by the system. Could it be some sort of security software preventing you from listening on a network interface?
Jeff
No idea. I think Ubuntu's firewall is off, but I can't be sure since I'm not that familiar with Ubuntu's security features. Thanks for trying to help:-)
Johnny
A: 

The best way I've found is to use http://www.tunnlr.com.

Johnny