E
E
Evgeny Gavrilov2016-04-07 13:07:04
SSH
Evgeny Gavrilov, 2016-04-07 13:07:04

How to connect via ssh inside an ssh session when deploying via capistrano?

Hello.
There was a task to deploy a Ruby on Rails project on a virtual hosting beget.ru . Their documentation says how to deploy a project manually. But manually it's not an option at all. And I decided to set up a deployment through Capistrano . I set up the basic actions for copying and linking symlinks normally. But I just can’t figure out how to make it work out tasks, such as bundle install or assets:precompile. The documentation says that in order to work with ruby, you need to switch to the Docker virtual shell using the commandssh localhost -p222and manually it actually works fine - I connect and can do these tasks manually. But how to make Capistrano connect via ssh inside the ssh session during deployment? Can anyone tell me if anyone has any thoughts on this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Selivanov, 2016-04-07
@selivanov_pavel

ssh over ssh:

Host outside
HostName 192.168.0.1
User bob

Host inside
Hostname 172.16.0.1
User alice
ProxyCommand           ssh -q -A outside nc %h %p

The external host must be available to use netcat.
Or with port forwarding:
Host outside
HostName 192.168.0.1
User bob
LocalForward 1222

Host inside
HostName localhost
Port 1222
User alice

In this case, before connecting to inside, you must first connect to outside.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question