Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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