Forum: Rails deployment problem using non-standard port when deploying with git

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.
Abb15966ecc84bd6d0aec5219ff54731?d=identicon&s=25 Justus Ohlhaver (justus)
on 2008-10-09 16:45
Hello,

What do I need to change in the deploy.rb or elsewhere in order to use a
non-default port number?

Everything is working fine when I use the standard port 22 on my server.
I'm able to deploy my code with capistrano and github.

Now I changed my port number to something higher -say - 1234.

I also updated the deploy.rb with this line:

'ssh_options[:port] = 1234'

This works if I do a single command such as cap deploy:cleanup

BUT when I try to deploy updated code via GitHub I now get the following
error:

 'ssh: connect to host github.com port 1234: Connection refused'

When I remove the 'ssh_options[:port] = 1234' line from deploy.rb again
this error doesn't happen but instead:

'Capistrano::ConnectionError, connection failed for: xx.xx.x.xx
(Errno::ECONNREFUSED: Connection refused - connect(2))'

So does anybody know how to solve this?
What do I need to change in the deploy.rb or elsewhere in order to use a
non-default port number?

Thanks a lot for any help!

Justus
44cbd795ae9185fc634ab8bc7939b3e3?d=identicon&s=25 rubyphunk (Guest)
on 2008-10-09 17:10
(Received via mailing list)
You could add github.com to your ~/.ssh/config file and define a non-
default port:

Host github.com
  Port 1234

rubyphunk


On 9 Okt., 16:45, Justus Ohlhaver <ruby-forum-incom...@andreas-s.net>
Abb15966ecc84bd6d0aec5219ff54731?d=identicon&s=25 Justus Ohlhaver (justus)
on 2008-10-09 18:09
rubyphunk wrote:
> You could add github.com to your ~/.ssh/config file and define a non-
> default port:
>
> Host github.com
>   Port 1234
>
> rubyphunk
>
>
> On 9 Okt., 16:45, Justus Ohlhaver <ruby-forum-incom...@andreas-s.net>

Hi, thanks.

But this doesn't work. It looks like it is trying to connect to github
at this port (''ssh: connect to host github.com port 1234: Connection
refused') but that's not what I am trying to do.

All I am trying to specify is that to access my production server port
1234 needs to be used.

How can I specify this correctly in the deploy.rb?

Thanks again,
Justus
Ff803e4a435f1438fc928f41500b1ffa?d=identicon&s=25 Alex Malinovich (Guest)
on 2008-10-10 19:41
(Received via mailing list)
On Oct 9, 9:09 am, Justus Ohlhaver <ruby-forum-incom...@andreas-s.net>
wrote:
> But this doesn't work. It looks like it is trying to connect to github
> at this port (''ssh: connect to host github.com port 1234: Connection
> refused') but that's not what I am trying to do.
>
> All I am trying to specify is that to access my production server port
> 1234 needs to be used.
>
> How can I specify this correctly in the deploy.rb?

You can try putting an entry in your local .ssh/config file (~/.ssh/
config) that includes the port, and then connecting. I'm not sure if
it'll work, but it's worth a shot. Just add something like:

host = yourservername.com
port = 1234

Now, anytime you try to ssh to yourservername.com, it'll try the
connection over port 1234 instead of 22.
This topic is locked and can not be replied to.