| Q | A
| ----------------- | ---
| Issue Type | Bug, Feature?
| Deployer Version | 5.1.3
| Local Machine OS | CentOS 7 (VirtualBox)
| Remote Machine OS | CentOS 7
Now, we have the problem with deploy application if any process failed execution.
Maybe this is correct scenario, and we SHOULD manually unlock after failing execution?
deploy.phpDefault for Symfony3
First attempt with removed GIT:
$ ./bin/dep deploy develop --verbose
➤ Executing task deploy:prepare
app_dev@IP's password:
• done on [IP]
✔ Ok [4s 450ms]
➤ Executing task deploy:lock
• done on [IP]
✔ Ok [261ms]
➤ Executing task deploy:release
• done on [IP]
✔ Ok [1s 356ms]
➤ Executing task deploy:update_code
➤ Executing task deploy:failed
• done on [IP]
✔ Ok [0ms]
[Deployer\Exception\RuntimeException (1)]
The command "command -v 'git'" failed.
Exit Code: 1 (General error)
Host Name: IP
================
debug1: auto-mux: Trying existing master
debug1: mux_client_request_session: master session id: 2
Exception trace:
() at /var/www/zwooki.dev/vendor/deployer/deployer/src/Ssh/Client.php:95
Deployer\Ssh\Client->run() at /var/www/zwooki.dev/vendor/deployer/deployer/src/functions.php:297
Deployer\run() at /var/www/zwooki.dev/vendor/deployer/deployer/src/functions.php:752
Deployer\locateBinaryPath() at /var/www/zwooki.dev/vendor/deployer/deployer/recipe/common.php:107
Deployer\Deployer::Deployer\{closure}() at n/a:n/a
call_user_func() at /var/www/zwooki.dev/vendor/deployer/deployer/src/Configuration/Configuration.php:87
Deployer\Configuration\Configuration->get() at /var/www/zwooki.dev/vendor/deployer/deployer/src/functions.php:531
Deployer\get() at /var/www/zwooki.dev/vendor/deployer/deployer/recipe/deploy/update_code.php:16
Deployer\Deployer::Deployer\{closure}() at n/a:n/a
call_user_func() at /var/www/zwooki.dev/vendor/deployer/deployer/src/Task/Task.php:82
Deployer\Task\Task->run() at /var/www/zwooki.dev/vendor/deployer/deployer/src/Executor/SeriesExecutor.php:63
Deployer\Executor\SeriesExecutor->run() at /var/www/zwooki.dev/vendor/deployer/deployer/src/Console/TaskCommand.php:142
Deployer\Console\TaskCommand->execute() at /var/www/zwooki.dev/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:264
Symfony\Component\Console\Command\Command->run() at /var/www/zwooki.dev/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:869
Symfony\Component\Console\Application->doRunCommand() at /var/www/zwooki.dev/vendor/deployer/deployer/src/Console/Application.php:132
Deployer\Console\Application->doRunCommand() at /var/www/zwooki.dev/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:223
Symfony\Component\Console\Application->doRun() at /var/www/zwooki.dev/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:130
Symfony\Component\Console\Application->run() at /var/www/zwooki.dev/vendor/deployer/deployer/src/Deployer.php:320
Deployer\Deployer::run() at /var/www/zwooki.dev/vendor/deployer/deployer/bin/dep:120
deploy [-p|--parallel] [-l|--limit LIMIT] [--no-hooks] [--log LOG] [--roles ROLES] [--hosts HOSTS] [-o|--option OPTION] [--] [<stage>]
Second attempt with installed GIT:
$ ./bin/dep deploy develop --verbose
➤ Executing task deploy:prepare
• done on [IP]
✔ Ok [774ms]
➤ Executing task deploy:lock
[Deployer\Exception\GracefulShutdownException]
Deploy locked.
Execute "dep deploy:unlock develop" to unlock.
Exception trace:
() at /var/www/zwooki.dev/vendor/deployer/deployer/recipe/deploy/lock.php:19
Deployer\Deployer::Deployer\{closure}() at n/a:n/a
call_user_func() at /var/www/zwooki.dev/vendor/deployer/deployer/src/Task/Task.php:82
Deployer\Task\Task->run() at /var/www/zwooki.dev/vendor/deployer/deployer/src/Executor/SeriesExecutor.php:63
Deployer\Executor\SeriesExecutor->run() at /var/www/zwooki.dev/vendor/deployer/deployer/src/Console/TaskCommand.php:142
Deployer\Console\TaskCommand->execute() at /var/www/zwooki.dev/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:264
Symfony\Component\Console\Command\Command->run() at /var/www/zwooki.dev/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:869
Symfony\Component\Console\Application->doRunCommand() at /var/www/zwooki.dev/vendor/deployer/deployer/src/Console/Application.php:132
Deployer\Console\Application->doRunCommand() at /var/www/zwooki.dev/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:223
Symfony\Component\Console\Application->doRun() at /var/www/zwooki.dev/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:130
Symfony\Component\Console\Application->run() at /var/www/zwooki.dev/vendor/deployer/deployer/src/Deployer.php:320
Deployer\Deployer::run() at /var/www/zwooki.dev/vendor/deployer/deployer/bin/dep:120
deploy [-p|--parallel] [-l|--limit LIMIT] [--no-hooks] [--log LOG] [--roles ROLES] [--hosts HOSTS] [-o|--option OPTION] [--] [<stage>]
Deployer does not automatically unlock after failure. I figure this behaviour must be intentional for good reasons.
By adding the following line at the end of your deploy.php would trigger an automatic unlock on failure.
after('deploy:failed', 'deploy:unlock');
Hope is helps.
@martijn94 What are these good reasons?
Deployer does not automatically unlock after failure. I figure this behaviour must be intentional for good reasons.
This is for everybody can configure behavior.
@salarmehr Usally when a deployment fails further investigation is needed before attempting a new deployment. Especially when using automation or when not paying attention you don't want the deployment to be retried before you fixed a problem. This is a good "heads-up" that action is needed before a new attempt.
And as this behaviour can be modified easily with the deploy:failed hook it think it works great as it is.
Most helpful comment
@salarmehr Usally when a deployment fails further investigation is needed before attempting a new deployment. Especially when using automation or when not paying attention you don't want the deployment to be retried before you fixed a problem. This is a good "heads-up" that action is needed before a new attempt.
And as this behaviour can be modified easily with the deploy:failed hook it think it works great as it is.