Reputation: 4036
I need to deploy a Rails application via capistrano to a server on a remote intranet. For example, if I were to ssh into the target server it would look like:
localhost$ ssh server1
server1$ ssh server2
Whats the best way of doing this?
Thanks in advance.
Upvotes: 7
Views: 1224
Reputation: 1415
Apparently, gateway option was dropped from capistrano starting v3. Instead one can use a jump proxy as shown here: https://github.com/capistrano/sshkit#proxying
Here's how it's going to look in the configuration file (e.g. production.rb):
require 'net/ssh'
require 'net/ssh/proxy/jump'
set :ssh_options, {
proxy: Net::SSH::Proxy::Jump.new("user@host:port")
}
BTW, you can specify jump proxy with -J option of the ssh command, so you can debug the connection issues separately from capistrano.
Upvotes: 4
Reputation: 8449
I would recommend using:
set :ssh_options, { :forward_agent => true }
set :gateway, "user@host:port"
Upvotes: 3
Reputation: 15371
Capistrano makes this really easy. Just use
set :gateway, "user@server1:port"
in your config/deploy.rb.
Upvotes: 6