15

I'm trying to set up access to server via a port (ssh is on port 222), but still although i have in my deploy.rb

set :application, 'billing'
set :repo_url, 'git@github.com:random/stat.git'
set :keep_releases, 5
set :ssh_options, {
forward_agent: true,
port: 222
}
SSHKit.config.command_map[:rake] = "bundle exec rake" #8
SSHKit.config.command_map[:rails] = "bundle exec rails"

I still get error

SSHKit::Runner::ExecuteError: Exception while executing on host IP:
Operation timed out - connect(2) for "IP" port 22

How can i solve this error? what i'm doing wrong?

Elmor
  • 4,775
  • 6
  • 38
  • 70

2 Answers2

42

I was also having issues with ssh_options option.

I switched to using server method, so it looks something like this:

# config/deploy/production.rb
server "#{server_ip_here}", user: "deploy", roles: %w{web app db}, port: 222
  • yes, you're correct. in my case it was a server side problem. had to spend some time tweaking server – Elmor Aug 30 '14 at 22:02
  • This was a lifesaver for me. For some reason the syntax above when using the role-based syntax failed but using the one-liner you listed worked. – Isaac Askew Dec 04 '19 at 04:26
2

I also give another ans:
role :web, %w{deploy@123.456.78.9:222}

xiaopo
  • 627
  • 5
  • 4