mirror of
https://github.com/deployphp/deployer.git
synced 2025-02-24 09:12:51 +01:00
Fix remove of storage on first deployment for laravel recipe #875.
This commit is contained in:
parent
445951c099
commit
f68bfb4c94
@ -403,6 +403,7 @@ task('deploy:shared', function () {
|
||||
$dirname = dirname($file);
|
||||
// Remove from source.
|
||||
run("if [ -f $(echo {{release_path}}/$file) ]; then rm -rf {{release_path}}/$file; fi");
|
||||
|
||||
// Ensure dir is available in release
|
||||
run("if [ ! -d $(echo {{release_path}}/$dirname) ]; then mkdir -p {{release_path}}/$dirname;fi");
|
||||
|
||||
|
@ -4,76 +4,103 @@
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
/*
|
||||
* This recipe supports Laravel 5.1+, for older versions, please read the documentation https://github.com/deployphp/docs
|
||||
*/
|
||||
|
||||
namespace Deployer;
|
||||
|
||||
require_once __DIR__ . '/common.php';
|
||||
// This recipe supports Laravel 5.1+,
|
||||
// for older versions, please read the documentation https://github.com/deployphp/docs
|
||||
|
||||
// Laravel shared dirs
|
||||
set('shared_dirs', ['storage']);
|
||||
set('shared_dirs', [
|
||||
'storage'
|
||||
]);
|
||||
|
||||
// Laravel 5 shared file
|
||||
set('shared_files', ['.env']);
|
||||
// Laravel shared file
|
||||
set('shared_files', [
|
||||
'.env'
|
||||
]);
|
||||
|
||||
// Laravel writable dirs
|
||||
set('writable_dirs', ['bootstrap/cache', 'storage']);
|
||||
set('writable_dirs', [
|
||||
'bootstrap/cache',
|
||||
'storage',
|
||||
'storage/app',
|
||||
'storage/app/public',
|
||||
'storage/framework',
|
||||
'storage/framework/cache',
|
||||
'storage/framework/sessions',
|
||||
'storage/framework/views',
|
||||
'storage/logs',
|
||||
]);
|
||||
|
||||
/**
|
||||
* Helper tasks
|
||||
*/
|
||||
desc('Disable maintenance mode');
|
||||
task('artisan:up', function () {
|
||||
$output = run('if [ -f {{deploy_path}}/current/artisan ]; then {{bin/php}} {{deploy_path}}/current/artisan up; fi');
|
||||
writeln('<info>' . $output . '</info>');
|
||||
})->desc('Disable maintenance mode');
|
||||
});
|
||||
|
||||
desc('Enable maintenance mode');
|
||||
task('artisan:down', function () {
|
||||
$output = run('if [ -f {{deploy_path}}/current/artisan ]; then {{bin/php}} {{deploy_path}}/current/artisan down; fi');
|
||||
writeln('<error>' . $output . '</error>');
|
||||
})->desc('Enable maintenance mode');
|
||||
});
|
||||
|
||||
desc('Execute artisan migrate');
|
||||
task('artisan:migrate', function () {
|
||||
$output = run('{{bin/php}} {{release_path}}/artisan migrate --force');
|
||||
writeln('<info>' . $output . '</info>');
|
||||
})->desc('Execute artisan migrate');
|
||||
});
|
||||
|
||||
desc('Execute artisan migrate:rollback');
|
||||
task('artisan:migrate:rollback', function () {
|
||||
$output = run('{{bin/php}} {{release_path}}/artisan migrate:rollback --force');
|
||||
writeln('<info>' . $output . '</info>');
|
||||
})->desc('Execute artisan migrate:rollback');
|
||||
});
|
||||
|
||||
desc('Execute artisan migrate:status');
|
||||
task('artisan:migrate:status', function () {
|
||||
$output = run('{{bin/php}} {{release_path}}/artisan migrate:status');
|
||||
writeln('<info>' . $output . '</info>');
|
||||
})->desc('Execute artisan migrate:status');
|
||||
});
|
||||
|
||||
desc('Execute artisan db:seed');
|
||||
task('artisan:db:seed', function () {
|
||||
$output = run('{{bin/php}} {{release_path}}/artisan db:seed --force');
|
||||
writeln('<info>' . $output . '</info>');
|
||||
})->desc('Execute artisan db:seed');
|
||||
});
|
||||
|
||||
desc('Execute artisan cache:clear');
|
||||
task('artisan:cache:clear', function () {
|
||||
$output = run('{{bin/php}} {{release_path}}/artisan cache:clear');
|
||||
writeln('<info>' . $output . '</info>');
|
||||
})->desc('Execute artisan cache:clear');
|
||||
});
|
||||
|
||||
desc('Execute artisan config:cache');
|
||||
task('artisan:config:cache', function () {
|
||||
$output = run('{{bin/php}} {{release_path}}/artisan config:cache');
|
||||
writeln('<info>' . $output . '</info>');
|
||||
})->desc('Execute artisan config:cache');
|
||||
});
|
||||
|
||||
desc('Execute artisan route:cache');
|
||||
task('artisan:route:cache', function () {
|
||||
$output = run('{{bin/php}} {{release_path}}/artisan route:cache');
|
||||
writeln('<info>' . $output . '</info>');
|
||||
})->desc('Execute artisan route:cache');
|
||||
});
|
||||
|
||||
/**
|
||||
* Task deploy:public_disk support the public disk.
|
||||
* To run this task automatically, please add below line to your deploy.php file
|
||||
* <code>after('deploy:symlink', 'deploy:public_disk');</code>
|
||||
*
|
||||
* before('deploy:symlink', 'deploy:public_disk');
|
||||
*
|
||||
* @see https://laravel.com/docs/5.2/filesystem#configuration
|
||||
*/
|
||||
desc('Make symlink for public disk');
|
||||
task('deploy:public_disk', function () {
|
||||
// Remove from source.
|
||||
run('if [ -d $(echo {{release_path}}/public/storage) ]; then rm -rf {{release_path}}/public/storage; fi');
|
||||
@ -83,11 +110,12 @@ task('deploy:public_disk', function () {
|
||||
|
||||
// Symlink shared dir to release dir
|
||||
run('{{bin/symlink}} {{deploy_path}}/shared/storage/app/public {{release_path}}/public/storage');
|
||||
})->desc('Make symlink for public disk');
|
||||
});
|
||||
|
||||
/**
|
||||
* Main task
|
||||
*/
|
||||
desc('Deploy your project');
|
||||
task('deploy', [
|
||||
'deploy:prepare',
|
||||
'deploy:lock',
|
||||
@ -101,6 +129,6 @@ task('deploy', [
|
||||
'cleanup',
|
||||
'artisan:cache:clear',
|
||||
'artisan:config:cache',
|
||||
])->desc('Deploy your project');
|
||||
]);
|
||||
|
||||
after('deploy', 'success');
|
||||
|
Loading…
x
Reference in New Issue
Block a user