Created
March 23, 2019 16:43
-
-
Save trungpv1601/eedde3ca6f04f2129945bbf1fec42929 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Deployer; | |
$startTime = microtime(true); | |
require 'recipe/common.php'; | |
// Project name | |
set('application', 'xxx'); | |
// Project repository | |
set('repository', '[email protected]: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