strongloop / strong-pm

deployer for node applications
http://strong-pm.io
Other
1k stars 71 forks source link

Custom env variable SSH_PORT doesn't work for http+ssh deployment #300

Closed lkrnac closed 8 years ago

lkrnac commented 8 years ago

According docs ssh tunneling port should be configurable via SSH_PORT variable. But this doesn't work for me

I still get: ssh connection error: { [Error: connect ECONNREFUSED 192.168.1.100:22] code: 'ECONNREFUSED', errno: 'ECONNREFUSED', syscall: 'connect', address: '192.168.1.100', port: 22, level: 'client-socket' }

Server: strong-pm: 5.1.0

Client: strongloop: 6.0.0

Both are using strong-mesh-models 8.1.0 where this feature seem to be implemented: https://github.com/strongloop/strong-mesh-models/pull/107

rmg commented 8 years ago

@lkrnac what command are you trying to use?

lkrnac commented 8 years ago

slc deploy http+ssh://[httpUsername]:[httpPassword]@[domain]:[port]

I tried also:

slc deploy http+ssh://[httpUsername]:[httpPassword]@[domain]:[port]/default

rmg commented 8 years ago

@lkrnac and what did you set SSH_PORT to and how did you set it? It would also probably be helpful to know what OS this is and what version of node.

lkrnac commented 8 years ago

Target machine is mine Ubuntu 14.04. Node v4.2.3

Narrowing down my setup:

SSH_PORT is SSH port I use to connect to target machine. This port works because I use it to log into that machine and also for remote desktop access. Of course it is different than strong-pm port. I use certificates to access. I tried SSH_KEY and also (ssh agent) ssh-add. I turned off firewall on target machine while trying this configuration and I am sure there are no other network firewalls.

strong-pm is installed as service and is running under linux user which is configured as SSH_USER env variable when I am trying slv deploy command. This user is different than linux user on client machine and also different than httpUsername used by strong-pm http authentication.

So there are three different users involved:

rmg commented 8 years ago

@lkrnac thanks for the extra details. When you say you are using certificates, do you mean the signed certificate variation of ssh's public key based auth? If so, that has not been tested and it is possible it doesn't work. I would have expected to see a much different error message in that case, though.

Can you share the output from running the following (with your real values plugged in, of course):

SSH_USER=<user> SSH_KEY=<path-to-private-key> SSH_PORT=<port> DEBUG=* \
  slc deploy http+ssh://<httpuser>:<httppass>@<host>:<pmport>/default
lkrnac commented 8 years ago

First of all, I made a mistake. "I use certificates ..." should be "I use rsa keys ..." (https://help.github.com/articles/generating-ssh-keys/#step-2-generate-a-new-ssh-key). Sorry for confusion.

I tried your command, and it worked fine. I don't know what I was doing wrong previously. I tried to make it running under fish shell instead of bash. When I switched back to bash again and double checked all the configs, it works.

Thanks much for help