deployer 攻略

2019-07-25 17:55:53 阅读:3 编辑
SSH-keygen -t rsa -b 4096 -f  %userprofile%\.ssh\deployerkey

上传 deployerkey.pub 至。ssh

SSH root@120.25.210.43

输入密码

cd .ssh

cat deployerkey.pub >> authorized_keys

SSH root@120.25.210.43 -i %userprofile%\.ssh\deployerkey

Git bash

SSH-copy-id /i %userprofile%\.ssh\deployerkey.pub root@120.25.210.43

Linux:

SSH-keygen -t rsa -b 4096 -f  ~/.ssh/deployerkey
SSH-copy-id -i ~/.ssh/deployerkey.pub root@120.25.210.43

deploy.php

<?PHP
namespace Deployer;

require 'recipe/laravel.php';

// Project name
set ('application', 'my_project2');

// Project repository
set ('repository', 'SSH://Git@git.xmyunce.com:10022/linson/blog.git');

set ('bin/PHP', function () {return "/usr/local/PHP/bin/PHP";});
$identityFile = "~/.ssh/deployerkey";
$win = DIRECTORY_SEPARATOR == '\\' ;
set ('SSH_multiplexing', false);
if ($win)
{
    $identityFile = "%userprofile%/.ssh/deployerkey";
    set ('Git_tty', false);
    set ('use_relative_symlinks', false);

}else{set ('Git_tty', true);

}
// [Optional] Allocate tty for Git clone. Default value is false.

// Shared files/dirs between deploys 
add ('shared_files', []);
add ('shared_dirs', []);

// Writable dirs by Web server 
add ('writable_dirs', []);

// Hosts
host ('120.25.210.43')
    ->user ('root')
    ->multiplexing (true)
    ->identityFile ($identityFile)
    ->set ('deploy_path', '/usr/share/nginx/HTML/test/{{application}}');

// Tasks

task ('build', function () {run ('cd {{release_path}} && build');
});

// [Optional] if deploy fails automatically unlock.
after ('deploy:failed', 'deploy:unlock');

// Migrate database before symlink new release.

before ('deploy:symlink', 'artisan:migrate');