Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

jclee100's avatar

Step after Activate New Release always fails with Connection Refused

For some reason my latest deployments always fail on the step after Activate New Release.

ssh: connect to host port 22: Connection refused

I mean it can connect to do the deployment why does it fail after Activate New Release?

Does Activate New Release disconnects ssh or something? Shouldn't it be able to reconnect?

Is there any access to log files to find out why?

0 likes
8 replies
ejdelmonico's avatar

The step after Activate New Release is Purge Old Releases. Are you sure there are old releases to purge? If so, then the server must be breaking the connection. Maybe directory permissions are causing the issue. To my knowledge, Envoyer only tries to connect initially for the deploy process. I don't think it makes or attempts to make a persistent connection.

jclee100's avatar

@ejdelmonico I've since added another step after Activate new release and it's now breaking on that step so I think the issue is with activate new release.

I can't think of why it would do this.

Activate new release does work successfully and my application does get updated. But without completing the next steps It's causing my queue workers to break.

Are there any logs which would provide more information?

jclee100's avatar

@ejdelmonico

After more testing, I always get disconnected on the 8th step no matter what commands they are. I wonder why. Adding or removing steps will always result in the 8th step breaking.

jclee100's avatar

Looking at /var/log/auth.log I can see that envoyer reconnects for every hook.

Accepted publickey for envoyer from 159.203.66.107 port 50177 ssh2: RSA
...
Received disconnect from 159.203.66.107 port 50177:11: disconnected by user
Disconnected from 159.203.66.107 port 50177
pam_unix(sshd:session): session closed for user envoyer
Removed session 5996.

Either my server is blocking the 8th connection or something is wrong with envoyer. I don't see any evidence from the log that it fails to connect.

I am going to try reducing number of hooks by running many commands within a hook.

jclee100's avatar

By compressing the hooks to 7, I am able to successfully deploy. Still not sure why it'll break on the 8th hook.

ejdelmonico's avatar

@komirad I would make an issue on github that provides the data to duplicate. All of my Envoyer deploys use 7 steps. I tried adding an 8th one and it worked on my dev server.

jclee100's avatar

I worked with DigitalOcean support to narrow it down to ufw limit rules. After allowing the IPs before the limit rule, it's working.

I think since it's a rate limit, it doesn't show up on auth.log. ufw and fail2ban comes with their one-click install of LAMP server.

deansatch's avatar

do you have any instructions on how to do this? I am having the same problem as rate limiting is set at 6 per 30 seconds but no idea how to either change it to a higher number or add envoyer as an exception

Please or to participate in this conversation.