capistrano 3 set ssh port but 22 is still used

Elmor picture Elmor · Aug 29, 2014 · Viewed 11.1k times · Source

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, '[email protected]: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?

Answer

user777337 picture user777337 · Aug 30, 2014

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