Ok, so I am trying to call Envoy from a controller function but running into permissions problems that nobody else seems to be getting?
I have installed envoy globally and done a symlink to /usr/local/bin so that my site can see it. But I cannot figure out why it doesn't have permission.
I am running from Ubuntu 16.04, Nginx, PHP 7.0
Any help is appreciated:
$result = [];
$live = false;
$process = new \Symfony\Component\Process\Process('envoy run deploy --domain="test"');
$process->setTimeout(3600);
$process->setIdleTimeout(300);
$process->setWorkingDirectory(base_path());
$process->run(
function ($type, $buffer) use ($live, &$result) {
$buffer = str_replace('[127.0.0.1]: ', '', $buffer);
if ($live) {
echo $buffer . '</br />';
}
$result[] = $buffer;
}
);
dd($result);
But getting:
0 => "sh: 1: "
1 => "envoy: Permission denied"
2 => "
"
I believe it is the permission for the laravel app user. You should take into acccount that laravel process is owned by a different user (presumably www-data
) who does not have permission to execute envoy
.
To fix this, you have to tweak the permissions of the envoy
which could lead to security weaknesses and time consuming on different deployments.
sudo chown www-data:www-data ~/.composer/vendor/laravel/envoy/envoy
However, I recommend that you use composer require laravel/envoy
in your project and execute it from vendor/bin/envoy
.
I have found a solution by using: laravelcollective.com/docs/5.0/ssh