PHP deployer - task deploy:unlock throws RuntimeException

1.2k views Asked by At

I use the deployer bundle

https://deployer.org/

with an symfony4 receipe to deploy my symfony5 app to an Centos Server from uberspace via SSH.

My deploy.php looks like this:

<?php
namespace Deployer;

require 'recipe/symfony4.php';

// Project name
set('application', 'system.company');

// Project repository
set('repository', '[email protected]:username/system.company.git');

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

set('ssh_multiplexing', false);

set('default_stage', 'production');

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

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


// Hosts

host('greip.uberspace.de')
    ->user('username')
    ->port(22)
    ->identityFile('C:\Users\Username\.ssh\id_rsa')
    ->forwardAgent(true)
    ->addSshOption('UserKnownHostsFile', '/dev/null')
    ->addSshOption('StrictHostKeyChecking', 'no')
    ->stage('production')
    ->set('/var/www/virtual/username/system', '~/{{application}}')
    ->set('deploy_path', '/var/www/virtual/username/system')
    ->set('http_user', 'www-data');
    
// Tasks
task('pwd', function () {
    $result = run('pwd');
    writeln("Current dir: $result");
});

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', 'database:migrate');

The Task "deploy:unlock" failed with this exeception:

 [Deployer\Exception\RuntimeException (2)]
  The command "cd /var/www/virtual/username/system/releases/5 && (setfacl -L -R -m u:"httpd":rwX -m u:`whoami`:rwX var)" failed.

  Exit Code: 2 (Misuse of shell builtins)

  Host Name: greip.uberspace.de

  ================
  Warning: Permanently added 'greip.uberspace.de,2a00:d0c0:200:0:a88f:85ff:fe87:1061' (ED25519) to the list of known hosts.
  setfacl: Option -m: Invalid argument near character 3

Anyone an idea to fix it?

1

There are 1 answers

0
goldlife On

Found the answer:

set('http_user', 'www-data');
set('writable_mode', 'chmod');
set('use_relative_symlink', '0');