stekel / laravel-deploy
帮助部署特定仓库到远程机器的实用命令。
v3.1.9
2023-03-08 00:38 UTC
Requires
- php: >7.1
- illuminate/console: >5.7
- illuminate/support: >5.7
- phpseclib/phpseclib: ^3.0
Requires (Dev)
- mockery/mockery: ^1.0@dev
- phpunit/phpunit: ^8.0
README
帮助部署特定仓库到远程机器的实用命令
安装
使用 composer 安装:composer require stekel/laravel-deploy
创建配置文件:php artisan vendor:publish --provider="stekel\LaravelDeploy\Laravel\Providers\LaravelDeployServiceProvider"
创建站点配置类
<?php namespace App; use stekel\LaravelDeploy\Site; class SampleSite extends Site { public function prod() { $this->ssh('192.168.1.100, admin, password, function ($connection) { $connection->command('git reset --hard'); $connection->command('git pull'); $connection->command('composer install --optimize-autoloader --no-dev'); $connection->command('php artisan migrate'); $connection->command('php artisan cache:clear'); $connection->command('php artisan config:cache'); $connection->command('php artisan route:cache'); $connection->command('php artisan view:cache'); }); } }
在配置中引用该类
// ... 'sites' => [ 'sample-site' => \App\SampleSite::class, ], // ...
在部署时引用站点/环境
// stekel:deploy {site} {environment}
stekel:deploy sample-site prod