定制 lianmafutra/deploy 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

lianmafutra/deploy

最新稳定版本:v1.8

Composer 安装命令:

composer require lianmafutra/deploy

包简介

Laravel Git FTP Deploy

README 文档

README

A Simple Package for Deployment Laravel App with Git FTP Server Method and SSH Server, Easy Configuration, Rollback Deploy, CI/CD

Screenshot 2023-07-03 115658

Screenshot_1

Requirement

Before using this package you must install and running GIT-FTP in your Local System https://github.com/git-ftp/git-ftp](https://github.com/git-ftp/git-ftp/blob/master/INSTALL.md

Installation

Require this package with composer. It is recommended to only require the package for development.

  1. Install with Composer
composer require lianmafutra/deploy --dev
  1. First publish config and console command into your app directory', by running the following command:
php artisan vendor:publish --provider="LianMafutra\Deploy\LibraryServiceProvider" --tag=deploy --force

will be create file : app/Console/Commands/Deploy.php , app/Console/Commands/DeploySetup.php, config/deploy.php

Package Configuration

  1. In your .env file, add the your SSH server host production and FTP account :
#Sample Configuration
DEPLOY_HOST=103.31.xx.xx
DEPLOY_PORT=22
DEPLOY_PATH="/www/wwwroot/myproject/"
DEPLOY_USER=root
DEPLOY_PASS=ssh_password

FTP_URL=103.31.xx.xx
FTP_USER=ftp_user
FTP_PASS=ftp_pass
  1. Run Command Setup, to test configuration :
php artisan deploy:setup

Screenshot_4

Setup is complete !

  1. you can custom command deploy in config/deploy.php , default command like this :
  'command-first-deploy' => [
      'composer install --no-interaction --prefer-dist --optimize-autoloader --no-dev',
      'php artisan down',
      'php artisan optimize',
      'php artisan storage:link',
      'php artisan migrate --force',
      'php artisan auth:clear-resets',
      'php artisan view:clear',
      'php artisan view:cache',
      'php artisan up'
   ],
   'command-deploy' => [
      'composer install --prefer-dist --no-scripts -q -o',
      'php artisan down',
      'php artisan optimize',
      'php artisan view:clear',
      'php artisan view:cache',
      'php artisan up'
   ],
   'command-optimize' => [
      'php artisan down',
      'php artisan optimize',
      'php artisan view:clear',
      'php artisan view:cache',
      'php artisan up'
   ]

Usage

  1. Run Command Terminal :
php artisan deploy
  1. Terminal Show Option, Select option with type number :

Screenshot 2023-07-03 115658

  • [1] First Deploy : First Upload Project to server
  • [2] Deploy Push : Push New Commit file with GIT FTP and Auto run command through SSH server with command php artisan down, php artisan optimize, php artisan view:clear, php artisan view:cache finally php artisan up
  • [3] Only Optimize : No Push commit, only run optimize in production
  • [4] Rollback Previous : Rollback last commit in GIT locally and push to server production, you can fix in local with default branch and push again after fix

Note

If you have error/failed to first git ftp init or first deploy, you must check this pull request git-ftp core error fix ( out of memory curl ), open git-ftp file and change it like this pull request git-ftp/git-ftp#638

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

统计信息

  • 总下载量: 693
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 7
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 7
  • Watchers: 1
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-05-28