From 6528a20c41aaf9cdf47aec3075b4cb307643e476 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=9D=99?= Date: Wed, 5 Jan 2022 13:30:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=8F=91=E5=B8=83=E8=84=9A?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy.php | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/deploy.php b/deploy.php index 89354083..72d738f5 100644 --- a/deploy.php +++ b/deploy.php @@ -35,11 +35,31 @@ host('test.zichunsheng.cn') ->set('branch', 'develop') ->set('deploy_path', '/www/wwwroot/test.zichunsheng.cn'); + +// 生产环境 +host('47.108.202.152', '47.108.227.246') + ->user('deployer') + ->port(22) + ->identityFile('~/.ssh/deployer_rsa') + ->forwardAgent(true) + ->multiplexing(true) + ->addSshOption('UserKnownHostsFile', '/dev/null') + ->addSshOption('StrictHostKeyChecking', 'no') + ->stage('production') + ->set('branch', 'master') + ->set('deploy_path', '/www/wwwroot/api.zichunsheng.cn'); + // Tasks -// [Optional] if deploy fails automatically unlock. +// 如果发布失败,自动解锁 after('deploy:failed', 'deploy:unlock'); +// 发布完成后重启 PHP-FPM +after('success', 'php:restart'); // Migrate database before symlink new release. - before('deploy:symlink', 'artisan:migrate'); + +desc('重启 PHP-FPM 进程'); +task('php:restart', function () { + run('sudo kill -USR2 $(cat /www/server/php/80/var/run/php-fpm.pid)'); +});