# Rails development without an open port?

**URL:** <https://www.ruby-forum.com/t/rails-development-without-an-open-port/127258>\
**Category:** Rails\
**Created:** [January 27, 2008, 7:13am UTC](https://www.ruby-forum.com/t/rails-development-without-an-open-port/127258 "2008-01-27T07:13:36Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![csci\_student](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/47e85d/32.png) [@csci\_student](https://www.ruby-forum.com/u/csci_student)\
**Post date:** [January 27, 2008, 7:13am UTC](https://www.ruby-forum.com/t/rails-development-without-an-open-port/127258/1 "2008-01-27T07:13:36Z")

</div>

I wish to port an old web app over to Rails but I’m running into  
“political” issues. The host of the server I have access to refuses to  
open a port for me claiming that an error in a Rails application could  
bring down the server. Is there any way to do Rails development without  
having an open port?

Please let me know if clarification is needed here.

Thanks!

---

<div class="post-metadata">

**Author:** ![csci\_student](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/47e85d/32.png) [@csci\_student](https://www.ruby-forum.com/u/csci_student)\
**Post date:** [January 27, 2008, 10:54am UTC](https://www.ruby-forum.com/t/rails-development-without-an-open-port/127258/2 "2008-01-27T10:54:33Z")

</div>

Theoretically, of course, with sufficient test coverage you should  
never actually need to fire up the development server - all the  
behavior your application is required to show is defined in tests,  
which pass and so you know it works… ^\_~

Perhaps more usefully, the most obvious answer is “Don’t develop on  
that server.”

You can download all the components you need, often in nice easy to  
install packages for just about any OS you use. Try googling for  
‘Instant Rails’ or ‘bitnami rails’ if you’re on windows for example.  
On linux use yum/aptitude etc. Then only push things up to the server  
when they’re fully developed and/or ready for ‘real-world’ testing.

Your second alternative is to use something like ssh port forwarding  
(check your ssh help/man page to find out how to do that) to see the  
rails application on your local PC without requiring the port to be  
opened up to the wider web, with the development mongrel bound to the  
localhost or external access to the port firewalled off.

Finally, what is their policy on developing, say, php scripts on the  
server? An error in a php script is just as likely to bring down the  
server, if not more so. The php script is probably running with  
whatever privilege apache has. The rails application, in development  
mode, is likely running with just your privileges and in production  
can be given it’s own unprivileged user. Which isn’t perfect  
security, but it helps.

Hope this helps,  
Jon

---

<div class="post-metadata">

**Author:** ![csci\_student](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/47e85d/32.png) [@csci\_student](https://www.ruby-forum.com/u/csci_student)\
**Post date:** [December 16, 2009, 4:10pm UTC](https://www.ruby-forum.com/t/rails-development-without-an-open-port/127258/3 "2009-12-16T16:10:37Z")

</div>

Hi,  
I am using the postgres database.If both the database and project are  
in the server(slicehost) then the project is working fine.But the  
project is not working when the postgres database is in  
server(slicehost).I need to access the server(slicehost) database from  
the localhost without opening the postgres database’s port in server.Is  
there any possible solution to access?.If not from this way then tell me  
the alternate way to do this.Please help me.

---

<div class="post-metadata">

**Author:** ![csci\_student](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/47e85d/32.png) [@csci\_student](https://www.ruby-forum.com/u/csci_student)\
**Post date:** [December 16, 2009, 3:37pm UTC](https://www.ruby-forum.com/t/rails-development-without-an-open-port/127258/4 "2009-12-16T15:37:25Z")

</div>

Hi,  
I have to access the multiple database without port in  
database.yml.For example,If one database is having 5432 and another one  
is 5442.Then how to connect two databases and access the tables  
without using port.Is there any solution for this?.Please help me.

---

<div class="post-metadata">

**Author:** ![csci\_student](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/47e85d/32.png) [@csci\_student](https://www.ruby-forum.com/u/csci_student)\
**Post date:** [December 16, 2009, 4:57pm UTC](https://www.ruby-forum.com/t/rails-development-without-an-open-port/127258/5 "2009-12-16T16:57:21Z")

</div>

William Ss wrote:

> Hi,  
> I have to access the multiple database without port in  
> database.yml.

What do you mean?

> For example,If one database is having 5432 and another one  
> is 5442.

You don’t need separate ports for different DB connections.

> Then how to connect two databases and access the tables  
> without using port.Is there any solution for this?.Please help me.

Please explain your situation more clearly.

Best,  
–Â  
MarnenÂ Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![csci\_student](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/47e85d/32.png) [@csci\_student](https://www.ruby-forum.com/u/csci_student)\
**Post date:** [December 16, 2009, 4:10pm UTC](https://www.ruby-forum.com/t/rails-development-without-an-open-port/127258/6 "2009-12-16T16:10:45Z")

</div>

Hi,  
I am using the postgres database.If both the database and project are  
in the server(slicehost) then the project is working fine.But the  
project is not working when the postgres database is in  
server(slicehost).I need to access the server(slicehost) database from  
the localhost without opening the postgres database’s port in server.Is  
there any possible solution to access?.If not from this way then tell me  
the alternate way to do this.Please help me.

---

<div class="post-metadata">

**Author:** ![csci\_student](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/47e85d/32.png) [@csci\_student](https://www.ruby-forum.com/u/csci_student)\
**Post date:** [December 16, 2009, 4:59pm UTC](https://www.ruby-forum.com/t/rails-development-without-an-open-port/127258/7 "2009-12-16T16:59:25Z")

</div>

William Ss wrote:

> Hi,  
> I am using the postgres database.If both the database and project are  
> in the server(slicehost) then the project is working fine.But the  
> project is not working when the postgres database is in  
> server(slicehost).I need to access the server(slicehost) database from  
> the localhost without opening the postgres database’s port in server.

Why do you need to do that? You should have a local database to develop  
against.

> Is  
> there any possible solution to access?.If not from this way then tell me  
> the alternate way to do this.Please help me.

You could use an SSH tunnel. But you really need a local dev database.

Best,  
–Â  
MarnenÂ Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid
