Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
deployer laravel recipe
<?php
require 'recipe/common.php';
// Laravel shared dirs
set('shared_dirs', [
'storage/app',
'storage/framework/cache',
'storage/framework/sessions',
'storage/framework/views',
'storage/logs',
]);
// Laravel 5 shared file
set('shared_files', ['.env']); // 初回時どうしようかと迷う。デプロイサーバーからアップロードでも良いかもしれない
// Laravel writable dirs
set('writable_dirs', ['storage', 'vendor']);
/**
* tasks
*/
// migrate
task('database:migrate', function () {
run('php {{release_path}}/' . 'artisan migrate');
})->desc('Migrate database');
// optimize
task('deploy:optimize', function () {
run('php {{release_path}}/' . 'artisan optimize');
run('php {{release_path}}/' . 'artisan route:cache');
run('php {{release_path}}/' . 'artisan config:cache');
})->desc('Optimize Application');
/**
* Main task
*/
task('deploy', [
'deploy:prepare',
'deploy:release',
'deploy:update_code',
'deploy:vendors',
'deploy:shared',
'deploy:symlink',
'deploy:optimize',
])->desc('Deploy your project');
after('deploy', 'success');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment