capistrano-rails-console icon indicating copy to clipboard operation
capistrano-rails-console copied to clipboard

How can I set ssh port?

Open wkojiro opened this issue 8 years ago • 5 comments

Thank you for wonderful gem ! When I do "cap production rails:console" I get: "ssh: connect to host XXXXX port 22: Connection timed out"

I am not using default port 22 of course, I set port number in my deploy/production.rb and deploy works well. How and where should I put port number for this gem?

wkojiro avatar Jan 05 '17 03:01 wkojiro

How do you set the port in deploy/production.rb?

ydkn avatar Jan 08 '17 20:01 ydkn

Fails for me too, i've set the port like this in deploy/production.rb

set :ssh_options, { forward_agent: true, port: 39456, user: 'username' }

regular cap deploys work fine, this task does not

matthutchinson avatar Apr 03 '17 14:04 matthutchinson

+1

I set the port in deploy/production.rb as:

  set :ssh_options, {
    keys: %w(/Users/Augusto/Documents/Credentials/mykey.pem),
    port: 1222
  }

regular cap also works fine

augustosamame avatar Apr 20 '17 16:04 augustosamame

Aha! Fixed it like this:

In the single server settings in the deploy/production.rb file:


server 'xx.xx.xx.xx', user: 'deploy', roles: %w{web app db},
  ssh_options: { keys: %w(/Users/Augusto/Documents/Credentials/mykey.pem),
                 port: 1222
               }

Now the gem connects on the correct SSH port

augustosamame avatar Apr 20 '17 17:04 augustosamame

Hi @matthutchinson, @augustosamame thanks for your feedback.

This issue should be fixed with sshkit-interactive v0.2.1 (https://github.com/afeld/sshkit-interactive/commit/8491bcfb3df84127d06889da56b236735799252c). Please check if it works as expected after a bundle update.

ydkn avatar May 01 '17 19:05 ydkn