deploy.php

<?php
namespace Deployer;

require 'recipe/common.php';

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

// Project repository
set('repository', 'git地址');

// [Optional] Allocate tty for git clone. Default value is false.
set('git_tty', true); 

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

// Writable dirs by web server 
set('writable_dirs', []);

set('keep_releases', 15);

// Hosts

host('localhost')
    ->user('www-data')
    ->set('branch', 'master')
    ->set('deploy_path', '部署地址');    
    

// Tasks

desc('Deploy your project');
task('deploy', [
    'deploy:info',
    'deploy:prepare',
    'deploy:lock',
    'deploy:release',
    'deploy:update_code',
    'deploy:shared',
    'deploy:writable',
    //'deploy:vendors',
    'deploy:clear_paths',
    'deploy:symlink',
    'deploy:unlock',
    'cleanup',
    'success'
]);

task('moveConfig', function(){
    run('cp /home/workspace/files/config_master.php /www/current/application/config.php');
});

task('moveDatabase', function(){
    run('cp /home/workspace/files/database_master.php /www/current/application/database.php');
});

task('createRuntime', function(){
    run('mkdir /www/current/runtime');
    run('mkdir /www/current/runtime/cache');
    run('mkdir /www/current/runtime/log');
    run('mkdir /www/current/runtime/temp');
    run('mkdir /www/current/runtime/tlogs');
});

task('curl', function(){
    run('curl http://url/reset.php');
    run('curl http://url/reset.php');
});


// [Optional] If deploy fails automatically unlock.
after('deploy:failed', 'deploy:unlock');
after('deploy:unlock', 'moveConfig');
after('moveConfig', 'moveDatabase');
after('moveDatabase', 'curl');
after('curl', 'createRuntime');

 

上一篇:[linux] 手机Deploy linux 桌面中文乱码


下一篇:IOS自动化测试环境搭建(Python & Java)