I'm using deployer (https://deployer.org/docs/6.x/tasks) to deploy my laravel application and it works like a charm. However, I want to make it more pretty. Why? Because I have background NodeJS processes running and at every deploy, they need to be restarted. Since there are 2 type of applications, the following is present in my deploy.php
task('post-deploy', [
//'cron:install',
'pm2:restart:qworker',
'pm2:restart:echo',
'cachetool:clear:opcache',
])->desc('After deploy tasks');
Now foir this to wotk, I had to make 2 tasks in recipes.php
desc('Restart QWorker');
task(
'pm2:restart:qworker',
function () {
$option = get('pm2_qworker_name');
run("pm2 restart ${option}");
}
)->onHosts(getenv('SSH_HOST_1'));
desc('Restart Echo Servers');
task(
'pm2:restart:echo',
function () {
$option = get('pm2_echo_name');
run("pm2 restart ${option}");
}
);
But I want to reduce this to one task only, but still being able to tell which process I wish to restart. My goal would look something like this in the deploy.php
file
task('post-deploy', [
//'cron:install',
'pm2:restart --something',
'pm2:restart --something2',
'cachetool:clear:opcache',
])->desc('After deploy tasks');
Any ideas how to define this in recipes.php
in only one task ?
0 Answers