Skip to content

Instantly share code, notes, and snippets.

@GesJeremie
Last active April 11, 2017 13:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save GesJeremie/f8c59c097b67da29e30b to your computer and use it in GitHub Desktop.
Save GesJeremie/f8c59c097b67da29e30b to your computer and use it in GitHub Desktop.
Laravel 5 example deployer
<?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