Last active
April 11, 2017 13:56
-
-
Save GesJeremie/f8c59c097b67da29e30b to your computer and use it in GitHub Desktop.
Laravel 5 example deployer
This file contains 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 | |
/** | |
* Require dependency | |
*/ | |
require_once 'recipe/common.php'; | |
/** | |
* How many releases we want to keep | |
*/ | |
set('keep_releases', 5); | |
/** | |
* Auth to the server | |
*/ | |
server('prod', 'your_host', 22) | |
->user('root') | |
->password('your_password') | |
->stage('production') | |
->env('deploy_path', 'var/www/something_replace_by_your_path'); | |
/** | |
* Git Repository | |
*/ | |
set('repository', 'your_git_repo'); | |
/** | |
* Shared dirs | |
*/ | |
set('shared_dirs', [ | |
'storage/app', | |
'storage/framework/cache', | |
'storage/framework/sessions', | |
'storage/framework/views', | |
'storage/logs', | |
]); | |
/** | |
* Shared Files | |
*/ | |
set('shared_files', ['.env']); | |
/** | |
* Chmod stuff | |
*/ | |
set('writable_dirs', ['storage', 'vendor']); | |
/** | |
* Run migrations | |
*/ | |
task('migration', function() { | |
run('php {{release_path}}/artisan migrate --force'); | |
})->desc('Artisan migrations'); | |
/** | |
* Main task (deploy) | |
*/ | |
task('deploy', [ | |
'deploy:prepare', | |
'deploy:release', | |
'deploy:update_code', | |
'deploy:vendors', | |
'deploy:writable', | |
'deploy:shared', | |
'deploy:symlink', | |
'migration', | |
'cleanup' | |
])->desc('Deploy the app'); | |
after('deploy', 'success'); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment