Php/deploy/deployer
提供: 初心者エンジニアの簡易メモ
(作成途中)
目次
deployerのphp対応バージョン
Deployer 5.x supports only php7 and above. If you want to use older php version use Deployer 4.x
deployerのダウロード
http://deployer.org/deployer.phar
deployer4系ダウンロード
https://deployer.org/releases/v4.3.1/deployer.phar
プロジェクト直下に設置
$ wget http://deployer.org/deployer.phar $ mv deployer.phar /usr/local/bin/dep $ chmod +x /usr/local/bin/dep
DLせずにcomposerを使って環境を整える
composer require deployer/deployer --dev
ひな形作成
dep init [0] Common [1] Laravel [2] Symfony [3] Yii [4] Zend Framework [5] CakePHP [6] CodeIgniter [7] Drupal > 0
fwを使ってなければ0に
こんな感じのdeployファイルができる
deploy.php
namespace Deployer; require 'recipe/common.php'; // Configuration set('ssh_type', 'native'); set('ssh_multiplexing', true); set('repository', 'git@domain.com:username/repository.git'); set('shared_files', []); set('shared_dirs', []); set('writable_dirs', []); // Servers server('production', 'domain.com') ->user('username') ->identityFile() ->set('deploy_path', '/var/www/domain.com'); // Tasks desc('Restart PHP-FPM service'); task('php-fpm:restart', function () { // The user must have rights for restart service // /etc/sudoers: username ALL=NOPASSWD:/bin/systemctl restart php-fpm.service run('sudo systemctl restart php-fpm.service'); }); after('deploy:symlink', 'php-fpm:restart'); desc('Deploy your project'); task('deploy', [ 'deploy:prepare', 'deploy:lock', 'deploy:release', 'deploy:update_code', 'deploy:shared', 'deploy:writable', 'deploy:vendors', 'deploy:clear_paths', 'deploy:symlink', 'deploy:unlock', 'cleanup', 'success' ]); // [Optional] if deploy fails automatically unlock. after('deploy:failed', 'deploy:unlock');
deploy実行
dep deploy
以下エラーが出る
In NativeSsh.php line 102: Warning: Permanently added (RSA) to the list of known hosts.