Skip to content

Instantly share code, notes, and snippets.

@trungpv1601
Created March 23, 2019 16:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trungpv1601/eedde3ca6f04f2129945bbf1fec42929 to your computer and use it in GitHub Desktop.
Save trungpv1601/eedde3ca6f04f2129945bbf1fec42929 to your computer and use it in GitHub Desktop.
<?php
namespace Deployer;
$startTime = microtime(true);
require 'recipe/common.php';
// Project name
set('application', 'xxx');
// Project repository
set('repository', 'git@bitbucket.org:xxx/xxx.git');
// [Optional] Allocate tty for git clone. Default value is false.
set('git_tty', true);
// Shared files/dirs between deploys
set('shared_files', [
'.env'
]);
set('shared_dirs', []);
// Writable dirs by web server
set('writable_dirs', []);
// Hosts
set('branch', 'production');
host('xxx.xxx.xxx.xxx')
->stage('production')
->user('deployer')
->identityFile('~/.ssh/deployerkey')
->set('deploy_path', '/var/www/{{application}}');
host('xxx.xxx.xxx.xxx')
->stage('production')
->user('deployer')
->identityFile('~/.ssh/deployerkey')
->set('deploy_path', '/var/www/{{application}}');
// Tasks
task('notify:done', function () use ($startTime) {
$seconds = intval(microtime(true) - $startTime);
$minutes = substr('0' . intval($seconds / 60), -2);
$seconds %= 60;
$seconds = substr('0' . $seconds, -2);
shell_exec("osascript -e 'display notification \"It took: $minutes:$seconds\" with title \"Deploy Finished\"'");
});
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',
'notify:done'
]);
// [Optional] If deploy fails automatically unlock.
after('deploy:failed', 'deploy:unlock');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment