diff --git a/deploy.php b/deploy.php
index f00824c..fff5bba 100644
--- a/deploy.php
+++ b/deploy.php
@@ -29,10 +29,10 @@ host('develop')
->set('deploy_path', '/var/www/helpdesk_dev');
host('mpba')
- ->set('hostname', 'helpdesk.mpba.dev')
+ ->set('hostname', 'sirius.absdev.net')
->set('remote_user', 'mag')
->set('branch', 'main')
- ->set('deploy_path', '/var/www/helpdesk_mpba');
+ ->set('deploy_path', '/var/www/helpdesk');
/*
* Install the root npm tree, then every module that owns its own lock file,
@@ -86,9 +86,29 @@ task('artisan:clear', function (): void {
});
task('services:restart', function (): void {
+ // Validate and reload nginx.
run('sudo -n nginx -t');
run('sudo -n systemctl reload nginx');
- run('sudo -n systemctl restart php8.3-fpm');
+
+ // Detect the PHP-FPM socket configured in nginx.
+ $socket = trim(run(
+ "sudo -n nginx -T 2>/dev/null"
+ . " | grep -oE 'php[0-9]+\\.[0-9]+-fpm\\.sock'"
+ . " | sort -Vu"
+ . " | tail -n 1"
+ ));
+
+ if ($socket === '') {
+ throw new \RuntimeException(
+ 'Unable to detect the PHP-FPM version from nginx configuration.'
+ );
+ }
+ // Convert php8.5-fpm.sock into php8.5-fpm.
+ $service = str_replace('.sock', '', $socket);
+ writeln("Detected PHP-FPM service: {$service}");
+ // Restart the detected PHP-FPM service.
+ run("sudo -n systemctl restart {$service}");
+ writeln("PHP-FPM restarted successfully.");
});
after('deploy:update_code', 'deploy:write_revision_file');