Deployer: Deployer kills it self after echo $0

Created on 17 Oct 2018  Â·  12Comments  Â·  Source: deployphp/deployer

| Q | A
| ----------------- | ---
| Issue Type | Question
| Deployer Version | v6.0.5
| Local Machine OS | Mac 10.14
| Remote Machine OS | SMP Debian 4.9.88

Description

I try to setup a deployment but it seams that a the first response of the
server, the deployer fails and I don't see a error. Thx for any help

Steps to reproduce

Running: composer run dep deploy haserver --timeout=900 -- --branch=my-cool-branch -vvv

Content of deploy.php

namespace Deployer;

inventory('deploy.yaml');

require 'vendor/xxxx/deployer-recipes/recipe/speedcurve.php';
require 'vendor/xxxx/deployer-recipes/recipe/varnish.php';
require 'vendor/xxxx/deployer-recipes/recipe/check.php';
require 'vendor/xxxx/deployer-recipes/recipe/common.php';
require 'vendor/xxxx/deployer-recipes/recipe/npm.php';

set('bin/php', '/opt/php7.0/bin/php');

before('deploy:prepare', 'check:branch');
before('deploy:prepare', 'check:tag');
after('deploy:vendors', 'npm');
before('success', 'varnish:purge');
after('success', 'speedcurve:deploy');

deploy.yaml

.base: &base
    hostname: xx.xxx.xxx.xxx
    user: my_admin_user
    port: 22
    forwardAgent: true
    multiplexing: true
    repository: [email protected]/my-repo.git
    speedcurve_api_key:xxxxxx
    speedcurve_site_id: xxxxx
    shared_files:
        - .env
        - public_html/sitemap.xml
    copy_dirs:
        - vendor
        - node_modules
    shared_dirs:
        - public_html/assets/temp
        - system/user/cache/ansel_persistent
        - public_html/stashCache
        - public_html/assets/images/avatars
        - public_html/news-sitemap.xml
    writable_dirs:
        - system/user/cache

staging:
    <<: *base
    stage: staging
    branch: develop
    deploy_path: ~/web/site/staging

production:
    <<: *base
    stage: production
    deploy_path: ~/web/site/production
    varnish_purge_url: http://my-cool-site.test.*

testing:
    <<: *base
    stage: testing
    deploy_path: ~/web/site/testing

testing2:
    <<: *base
    stage: testing2
    deploy_path: ~/web/site/testing2

haserver:
    <<: *base
    hostname: xx.xxx.xxx.xxx
    stage: haserver
    deploy_path: ~/web/site/haserver

Output log

With enabled option for verbose output -vvv.

Reading ./composer.json
Loading config file ./composer.json
Checked CA file /private/etc/ssl/cert.pem: valid
Executing command (/Users/flaver/Develop/Work/my-project): git branch --no-color --no-abbrev -v
Reading /Users/flaver/.composer/composer.json
Loading config file /Users/flaver/.composer/composer.json
Reading /Users/flaver/Develop/Work/my-project/vendor/composer/installed.json
Reading /Users/flaver/.composer/vendor/composer/installed.json
Running 1.6.5 (2018-05-04 11:44:59) with PHP 7.2.6 on Darwin / 18.0.0
> dep: dep 'deploy' 'haserver' '--branch=my-cool-branch' '-vvv'
Executing command (CWD): dep 'deploy' 'haserver' '--branch=my-cool-branch' '-vvv'
[localhost] > git rev-parse --abbrev-ref HEAD
[localhost] < my-cool-branch
✈︎ Deploying my-cool-branch on xx.xxx.xxx.xxx
• done on [haserver]
➤ Executing task deploy:prepare
[haserver] > echo $0
[haserver] < ssh multiplexing initialization
[email protected]'s password:
[haserver] < bash
➤ Executing task deploy:failed
• done on [haserver]
✔ Ok [0ms]
➤ Executing task deploy:unlock
[haserver] > rm -f ~/web/site/haserver/.dep/deploy.lock

In Client.php line 96:

  [Deployer\Exception\RuntimeException (-1)]
  The command "rm -f ~/web/site/haserver/.dep/deploy.lock" failed.

  Exit Code: -1 (Unknown error)

  Host Name: haserver

  ================

Most helpful comment

I just did. The only thing that is different is the response by the server (it's missing the [exit_code]).
I opened a ticket with the hoster. I'll report back what they say on their end.

All 12 comments

Nervermind it was a problem with our server.

Hi there, @flaver12 – Did you ever get around to what was wrong on your end? I have the exact same error. Thanks!

Hey,
well in the end it was a miss configuered Server. I don't know what the fix was(managed Server).
But the output for echo $0 (send over shh) didn't output the exit_code.

Hope I Could help

Yes it's the same problem. I just can't figure out why the server behaves this way. Perhaps @antonmedv has an idea? It's as if the printf command never gets executed.

What is output of echo $0? Do you use ssh with keys?

Yes, I use it with keys.

The command echo 'echo $0' | ssh -A -p 22 -o ControlMaster=auto -o ControlPersist=60 -o ControlPath=~/.ssh/[email protected]:22 [email protected] 'bash -s; printf "[exit_code:%s]" $?;' returns bash

Looks really strange. Can you use debugger to do step by step debug?

I just did. The only thing that is different is the response by the server (it's missing the [exit_code]).
I opened a ticket with the hoster. I'll report back what they say on their end.

Whe had the same Problem, after we contacted the hoster and they fixed it

@flaver12 can you tell us, what was wrong from hoster side? Or he didn't tell?

We didn't got any info there, but I can look if I find the support ticket, when i'm at the office tomorrow

Wow, I just got a peculiar solution from my hoster. They said to use 'inexistent_cmd 2>/dev/null || bash -ls as a first command with the full query looking like this:

echo 'which php' | ssh -A -p 22 -o ControlMaster=auto -o ControlPersist=60 -o ControlPath=~/.ssh/[email protected]:22 [email protected] 'inexistent_cmd 2>/dev/null || bash -ls; printf "[exit_code:%s]" $?;'

Hope this helps people encountering the same, for now. The hoster did not give any explanation. I'm requesting that now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ovaiskhan11 picture ovaiskhan11  Â·  4Comments

minkbear picture minkbear  Â·  4Comments

flashios09 picture flashios09  Â·  4Comments

osbulbul picture osbulbul  Â·  3Comments

JonasDoebertin picture JonasDoebertin  Â·  4Comments