Deployer: Deploy always fails with 'connection timed out' in the same step

Created on 23 Aug 2017  Â·  6Comments  Â·  Source: deployphp/deployer

| Q | A
| ----------------- | ---
| Issue Type | Bug, Question, Feature Request
| Deployer Version | 6.0.0
| Local Machine OS | Windows 10 Insider Preview 1703
| Remote Machine OS | Ubuntu 16.04.2

Description

Running dep deploy on a Laravel project based on this guide always fails during the same step, cd /var/www/html/vpr && if [ ! -d shared ]; then mkdir shared; fi, even after I created the folder manually.

Tried with git-bash from Git for Windows and WSL.

Steps to reproduce

Run dep deploy on a Laravel project.

Content of deploy.php

<?php
namespace Deployer;

require 'recipe/laravel.php';

// Project name
set('application', 'VPR');

// Project repository
set('repository', '<path/to/repo/redacted>');

// [Optional] Allocate tty for git clone. Default value is false.
// set('git_tty', true);

// Shared files/dirs between deploys 
add('shared_files', []);
add('shared_dirs', []);

// Writable dirs by web server 
add('writable_dirs', []);

set('http_user', 'www-data');
// Hosts

host('host-redacted')
    ->set('deploy_path', '/var/www/html/vpr');

//
set('ssh_multiplexing', false);

// Tasks

task('build', function () {
    run('cd {{release_path}} && build');
});

// [Optional] if deploy fails automatically unlock.
after('deploy:failed', 'deploy:unlock');

// Migrate database before symlink new release.

before('deploy:symlink', 'artisan:migrate');

Output log

git-bash

jmouette@desknb MINGW64 /d/Dev/vpr (feature/deployer)
$ dep deploy -vvv
[localhost] > git rev-parse --abbrev-ref HEAD
[localhost] < feature/deployer
✈︎ Deploying feature/deployer on host-redacted
• done on [host-redacted]
➤ Executing task deploy:prepare
[host-redacted] > echo $0
[host-redacted] < bash
[host-redacted] > if [ ! -d /var/www/html/vpr ]; then mkdir -p /var/www/html/vpr; fi
[host-redacted] > if [ ! -L /var/www/html/vpr/current ] && [ -d /var/www/html/vpr/current ]; then echo 'true'; fi
[host-redacted] > cd /var/www/html/vpr && if [ ! -d .dep ]; then mkdir .dep; fi
[host-redacted] > cd /var/www/html/vpr && if [ ! -d releases ]; then mkdir releases; fi
[host-redacted] > cd /var/www/html/vpr && if [ ! -d shared ]; then mkdir shared; fi
[host-redacted] < ssh: connect to host host-redacted port 22: Connection timed out
➤ Executing task deploy:failed
• done on [host-redacted]
✔ Ok [1ms]
➤ Executing task deploy:unlock
[host-redacted] > rm -f /var/www/html/vpr/.dep/deploy.lock
[host-redacted] < ssh: connect to host host-redacted port 22: Connection timed out


  [Deployer\Exception\RuntimeException (-1)]
  The command "rm -f /var/www/html/vpr/.dep/deploy.lock" failed.
  Exit Code: -1 (Unknown error)
  Host Name: host-redacted
  ================
  ssh: connect to host host-redacted port 22: Connection timed out


Exception trace:
 () at phar://D:/Apps/Git/usr/bin/dep/src/Ssh/Client.php:96
 Deployer\Ssh\Client->run() at phar://D:/Apps/Git/usr/bin/dep/src/functions.php:292
 Deployer\run() at phar://D:/Apps/Git/usr/bin/dep/recipe/deploy/lock.php:30
 Deployer\Deployer::Deployer\{closure}() at n/a:n/a
 call_user_func() at phar://D:/Apps/Git/usr/bin/dep/src/Task/Task.php:104
 Deployer\Task\Task->run() at phar://D:/Apps/Git/usr/bin/dep/src/Executor/SeriesExecutor.php:63
 Deployer\Executor\SeriesExecutor->run() at phar://D:/Apps/Git/usr/bin/dep/src/Console/TaskCommand.php:152
 Deployer\Console\TaskCommand->execute() at phar://D:/Apps/Git/usr/bin/dep/vendor/symfony/console/Command/Command.php:264
 Symfony\Component\Console\Command\Command->run() at phar://D:/Apps/Git/usr/bin/dep/vendor/symfony/console/Application.php:869
 Symfony\Component\Console\Application->doRunCommand() at phar://D:/Apps/Git/usr/bin/dep/src/Console/Application.php:132
 Deployer\Console\Application->doRunCommand() at phar://D:/Apps/Git/usr/bin/dep/vendor/symfony/console/Application.php:223
 Symfony\Component\Console\Application->doRun() at phar://D:/Apps/Git/usr/bin/dep/vendor/symfony/console/Application.php:130
 Symfony\Component\Console\Application->run() at phar://D:/Apps/Git/usr/bin/dep/src/Deployer.php:324
 Deployer\Deployer::run() at phar://D:/Apps/Git/usr/bin/dep/bin/dep:119
 require() at D:\Apps\Git\usr\bin\dep:4

deploy [-p|--parallel] [-l|--limit LIMIT] [--no-hooks] [--log LOG] [--roles ROLES] [--hosts HOSTS] [-o|--option OPTION] [--] [<stage>]

WSL

root@desknb:/mnt/d/Dev/vpr# dep deploy -vvv
[localhost] > git rev-parse --abbrev-ref HEAD
[localhost] < feature/deployer
✈︎ Deploying feature/deployer on host-redacted
• done on [host-redacted]
➤ Executing task deploy:prepare
[host-redacted] > echo $0
[host-redacted] < bash
[host-redacted] > if [ ! -d /var/www/html/vpr ]; then mkdir -p /var/www/html/vpr; fi
[host-redacted] > if [ ! -L /var/www/html/vpr/current ] && [ -d /var/www/html/vpr/current ]; then echo 'true'; fi
[host-redacted] > cd /var/www/html/vpr && if [ ! -d .dep ]; then mkdir .dep; fi
[host-redacted] > cd /var/www/html/vpr && if [ ! -d releases ]; then mkdir releases; fi
[host-redacted] > cd /var/www/html/vpr && if [ ! -d shared ]; then mkdir shared; fi
[host-redacted] < ssh: connect to host host-redacted port 22: Resource temporarily unavailable
➤ Executing task deploy:failed
• done on [host-redacted]
✔ Ok [1ms]
➤ Executing task deploy:unlock
[host-redacted] > rm -f /var/www/html/vpr/.dep/deploy.lock
[host-redacted] < ssh: connect to host host-redacted port 22: Resource temporarily unavailable


  [Deployer\Exception\RuntimeException (-1)]
  The command "rm -f /var/www/html/vpr/.dep/deploy.lock" failed.
  Exit Code: -1 (Unknown error)
  Host Name: host-redacted
  ================
  ssh: connect to host host-redacted port 22: Resource temporarily unavailable


Exception trace:
 () at phar:///usr/local/bin/dep/src/Ssh/Client.php:96
 Deployer\Ssh\Client->run() at phar:///usr/local/bin/dep/src/functions.php:292
 Deployer\run() at phar:///usr/local/bin/dep/recipe/deploy/lock.php:30
 Deployer\Deployer::Deployer\{closure}() at n/a:n/a
 call_user_func() at phar:///usr/local/bin/dep/src/Task/Task.php:104
 Deployer\Task\Task->run() at phar:///usr/local/bin/dep/src/Executor/SeriesExecutor.php:63
 Deployer\Executor\SeriesExecutor->run() at phar:///usr/local/bin/dep/src/Console/TaskCommand.php:152
 Deployer\Console\TaskCommand->execute() at phar:///usr/local/bin/dep/vendor/symfony/console/Command/Command.php:264
 Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/dep/vendor/symfony/console/Application.php:869
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/dep/src/Console/Application.php:132
 Deployer\Console\Application->doRunCommand() at phar:///usr/local/bin/dep/vendor/symfony/console/Application.php:223
 Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/dep/vendor/symfony/console/Application.php:130
 Symfony\Component\Console\Application->run() at phar:///usr/local/bin/dep/src/Deployer.php:324
 Deployer\Deployer::run() at phar:///usr/local/bin/dep/bin/dep:119
 require() at /usr/local/bin/dep:4

deploy [-p|--parallel] [-l|--limit LIMIT] [--no-hooks] [--log LOG] [--roles ROLES] [--hosts HOSTS] [-o|--option OPTION] [--] [<stage>]

Most helpful comment

Ressurecting this, as I had some new developments. Even in my Ubuntu VM I started facing the same issue, and started looking for causes elsewhere. In the server, there was a LIMIT rule on ufw that reportedly blocks multiple connections. After changing it to ALLOW, deploying through git-bash got past the previous point of error, but now I got this one:

  [Symfony\Component\Process\Exception\RuntimeException]
  TTY mode is not supported on Windows platform.

Setting set('git_tty', false); did the trick, the the deploy was succesful through git-bash. I haven't been able to test on WSL because I uninstalled it, but it would probably work, as the 'symptoms' where the same.
Closing the issue as it was not related to Deployer, but this could help someone.

All 6 comments

There is a bug in WSL: https://github.com/Microsoft/BashOnWindows/issues/714

Try this:

Add this to END your SSH config (usually located at ~/.ssh/config):

Host *
    ProxyCommand nc %h %p %r

Didn't work.

...
[onvpr.com] > cd /var/www/html/vpr && if [ ! -d releases ]; then mkdir releases; fi
[onvpr.com] < nc: getaddrinfo: Servname not supported for ai_socktype
[onvpr.com] < ssh_exchange_identification: Connection closed by remote host
➤ Executing task deploy:failed
• done on [onvpr.com]
✔ Ok [1ms]
➤ Executing task deploy:unlock
[onvpr.com] > rm -f /var/www/html/vpr/.dep/deploy.lock
[onvpr.com] < nc: getaddrinfo: Servname not supported for ai_socktype
[onvpr.com] < ssh_exchange_identification: Connection closed by remote host


  [Deployer\Exception\RuntimeException (-1)]
  The command "rm -f /var/www/html/vpr/.dep/deploy.lock" failed.
  Exit Code: -1 (Unknown error)
  Host Name: onvpr.com
  ================
  nc: getaddrinfo: Servname not supported for ai_socktype
  ssh_exchange_identification: Connection closed by remote host

Found this with a quick search, and dropped the %r in the command you provided. A little progress, but iin the end still nothing, and exactly at the same step:

[onvpr.com] > cd /var/www/html/vpr && if [ ! -d shared ]; then mkdir shared; fi
[onvpr.com] < ssh_exchange_identification: Connection closed by remote host
➤ Executing task deploy:failed

If the bug is WSL related, why would git-bash also fail in the exact same step?

Can't tell. Try disable multiplexing.

Already did. I've resorted to deploying from an Ubuntu VM, so feel free to close this at your discretion. Would be nice if I didn't have to though :)

Windows is a mistery for me) will be cool if someone can solve isseus there

Ressurecting this, as I had some new developments. Even in my Ubuntu VM I started facing the same issue, and started looking for causes elsewhere. In the server, there was a LIMIT rule on ufw that reportedly blocks multiple connections. After changing it to ALLOW, deploying through git-bash got past the previous point of error, but now I got this one:

  [Symfony\Component\Process\Exception\RuntimeException]
  TTY mode is not supported on Windows platform.

Setting set('git_tty', false); did the trick, the the deploy was succesful through git-bash. I haven't been able to test on WSL because I uninstalled it, but it would probably work, as the 'symptoms' where the same.
Closing the issue as it was not related to Deployer, but this could help someone.

Was this page helpful?
0 / 5 - 0 ratings