Deployer recipe中Laravel配置檔案

火魂發表於2019-02-16

1 laravel.php

recipe目錄下包含了常用框架的部署配置檔案
這裡以Laravel框架的部署配置為例進行分析
在laravel.php中主要配置了laravel框架的相關目錄

shared_dirs : 
shareD_files :
writable_dirs:
laravel_version

另外還定義了larvael的常用命令

artisan:up
artisan:down
artisan:migrate
artisan:migrate:fresh
artisan:migrate:rollback
artisan:migrate:status
artisan:db:seed
artisan:cache:clear
artisan:config:cache
artisan:route:cache
artisan:view:clear
artisan:optimize
artisan:queue:Restart
artisan:storage:link
deploy:public_disk

然後定義了larvael的部署流程

deploy

2 common.php 公共配置

在配置檔案recipelaravel.php中首先引入了公共配置檔案common.php

;recipecommon.php
require __DIR__ . `/config/current.php`;
require __DIR__ . `/config/dump.php`;
require __DIR__ . `/config/hosts.php`;
require __DIR__ . `/deploy/info.php`;
require __DIR__ . `/deploy/prepare.php`;
require __DIR__ . `/deploy/lock.php`;
require __DIR__ . `/deploy/release.php`;
require __DIR__ . `/deploy/update_code.php`;
require __DIR__ . `/deploy/clear_paths.php`;
require __DIR__ . `/deploy/shared.php`;
require __DIR__ . `/deploy/writable.php`;
require __DIR__ . `/deploy/vendors.php`;
require __DIR__ . `/deploy/symlink.php`;
require __DIR__ . `/deploy/cleanup.php`;
require __DIR__ . `/deploy/copy_dirs.php`;
require __DIR__ . `/deploy/rollback.php`;

common.php公共配置檔案中 載入了config和deploy兩個目錄下的配置檔案
另外還定義了幾個常用變數資訊

hostname user target

常用配置引數

keep_releasese
repository
shared_dirs
shared_files
copy_dirs

wirtable_dirs
writable_mode 
writable_use_sudo
writable_chmod_mode
writable_chmod_recursive

http_user
http_group

clear_paths
clear_use_sudo

use_atomic_symlink
composer_action
composer_options
env
currrent_path

常用命令

bin/php
bin/git
bin/composer
bin/symlink

選項引數

tag
revision
branch

兩個命令

sucess
deploy:failed

3 config的配置檔案

1 current.php

檢視當前工作目錄 命令

config:current

2 dump.php

檢視配置資訊 命令

config:dump

3 hosts.php

檢視所有主機命令

config:hosts

4 deploy的配置檔案

deploy目錄下配置了部署中常用的命令
這些命令與common.php的引數有關

1 cleanup.php

清理舊的釋出版本 cleanup

2 clear_paths.php

清理指定目錄 clear_paths

3 copy_dirs.php

同步拷貝目錄 deploy:copy_dirs

4 info.php

獲取引數資訊 deploy:info

5 lock.php

建立鎖定檔案 deploy:lock

6 prepare.php

建立基本目錄 deploy:prepare

7 release.php

部署新版本 deploy:release

8 shared.php

9 symlink.php

10 update_code.php

11 vendors.php

12 writable.php

5 總結

總的配置檔案分為三個層次
config和deploy層次規定了常用命令
common.php規定了常用引數
laravel.php規定laravel框架的引數和部署流程

-2018.4.8 21:47

相關文章