question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

deploy:update connection refused

See original GitHub issue

Been banging my head against the wall trying to figure out why I can’t get this working. I’m convinced this must be a bug with how ssh-pool is opening connections with the remote server. Every time I attempt to deploy, I’m met with the following error:

'deploy:update' errored after 20 s
Error: Command failed: ssh user@myhost "echo \"74ad4f770102875ded99dcc781d8c3100cf12c5a\" > /var/apps/app/releases/20180422202738/REVISION"
ssh: connect to host myhost port 22: Connection refused

at ChildProcess.exithandler (child_process.js:273:12)
at ChildProcess.emit (events.js:180:13)
at maybeClose (internal/child_process.js:936:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)

Yes, the environment is setup correctly with keys. I can ssh manually to my server (with the same user that shipit is using), and ssh’ing from the server to itself also works without any issues.

After setting the sshd log level to verbose & inspecting my server’s auth log (/var/log/auth.log), I noticed that shipit’s ssh attempts succeed, but are then immediately closed by the client (not the server):

Apr 22 20:27:38 api sshd[13276]: Accepted publickey for user from <IP_ADDRESS> port 51536 ssh2: RSA SHA256: ---
Apr 22 20:27:38 api sshd[13276]: pam_unix(sshd:session): session opened for user user by (uid=0)
Apr 22 20:27:38 api systemd-logind[1384]: New session 621 of user user.
Apr 22 20:27:38 api sshd[13308]: Received disconnect from <IP_ADDRESS> port 51536:11: disconnected by user
Apr 22 20:27:38 api sshd[13308]: Disconnected from <IP_ADDRESS> port 51536
Apr 22 20:27:38 api sshd[13276]: pam_unix(sshd:session): session closed for user user
Apr 22 20:27:38 api systemd-logind[1384]: Removed session 621.

Also, while trying to get to the source of this issue, it occurred to me that supporting ssh verbosity levels (-v, -vv, -vvv) would be an extremely useful feature. Are there any plans to add those in the future?

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:2
  • Comments:12 (9 by maintainers)

github_iconTop GitHub Comments

10reactions
evenfrostcommented, Apr 19, 2019

TL;DR: Login to your droplet and do ufw allow ssh.

So, I faced it myself and did some digging. This ‘ssh rate limit’ is because active ufw service, which is default firewall for Ubuntu. Interestingly enough, it is disabled in default Ubuntu (16.04) droplet, but enabled in some others (Ubuntu 18.04 with Docker in my case).

You can check status with ufw status, it should say something like 22/tcp LIMIT if ssh connections are rate-limited. Default hitcount (concurrent ssh connections) is 6 and can be found in /etc/ufw/user.rules, as seen here:

Screenshot from 2019-04-19 16-03-01

So, in order to fix issue with deployment, you either do ufw allow ssh to disable rate-limiting to port 22 at all or fine-tune limits (especially hitcount param seems to do the trick) to allow shipit to do its job while having some DDOS prevention mechanism as well.

More info here:

2reactions
jonathandioncommented, Apr 29, 2018

Same problem 😕

Everything is copied successfully inside “releases” but got Connection refused before deploy:update

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to deploy update a react app to app service
I have a react app running on an app service, I have already updated the app multiple times through the Azure vsCode extension....
Read more >
Connection refused when deploying a web service with the ...
Trying to deploy a REST Service from PDSOE to the local OE Web Server nothing happens. No errors are reported on the screen,...
Read more >
Data deploy- update date format is not working
Hi, I've problem with date deploy, date format update. Running on opendeploy 6.0.2 and deploy to mysql database.
Read more >
Deployment - PM2
Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and that the repository ......
Read more >
Troubleshoot Amazon EC2 Auto Scaling issues
Do not use the Auto Scaling service to add the hook, because the addition will not be recognized by CodeDeploy. aws deploy update-deployment-group...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found