2020-05-29 13:52:24 +02:00
|
|
|
<?php
|
|
|
|
namespace Deployer;
|
|
|
|
|
|
|
|
set('repository', 'git@github.com:shopware/production.git');
|
|
|
|
|
|
|
|
set('shared_files', [
|
2020-08-06 12:28:39 +02:00
|
|
|
'.env',
|
|
|
|
'.psh.yaml.override'
|
2020-05-29 13:52:24 +02:00
|
|
|
]);
|
|
|
|
set('shared_dirs', [
|
2020-08-06 13:22:03 +02:00
|
|
|
'custom/plugins',
|
2020-06-24 20:16:26 +02:00
|
|
|
'config/jwt',
|
2020-08-06 13:22:03 +02:00
|
|
|
'files',
|
|
|
|
'var/log',
|
2020-05-29 13:52:24 +02:00
|
|
|
'public/media',
|
2020-06-24 20:16:26 +02:00
|
|
|
'public/thumbnail',
|
2020-08-06 13:22:03 +02:00
|
|
|
'public/sitemap',
|
2020-05-29 13:52:24 +02:00
|
|
|
]);
|
|
|
|
set('writable_dirs', [
|
2020-08-06 13:22:03 +02:00
|
|
|
'custom/plugins',
|
|
|
|
'config/jwt',
|
|
|
|
'files',
|
2020-05-29 13:52:24 +02:00
|
|
|
'var',
|
|
|
|
'public/media',
|
2020-08-06 13:22:03 +02:00
|
|
|
'public/thumbnail',
|
|
|
|
'public/sitemap'
|
2020-05-29 13:52:24 +02:00
|
|
|
]);
|
|
|
|
set('static_folders', []);
|
|
|
|
|
|
|
|
task('sw:update_code', function(){
|
2020-08-06 12:28:39 +02:00
|
|
|
run('git clone {{repository}} {{release_path}}');
|
2020-05-29 13:52:24 +02:00
|
|
|
});
|
|
|
|
|
2020-06-24 20:16:26 +02:00
|
|
|
task('sw:system:install', function(){
|
2020-08-06 12:28:39 +02:00
|
|
|
run('cd {{release_path}} && bin/console system:install');
|
2020-06-24 20:16:26 +02:00
|
|
|
});
|
|
|
|
task('sw:storefront:build', function(){
|
2020-08-06 12:28:39 +02:00
|
|
|
run('cd {{release_path}} && ./psh.phar storefront:install-dependencies');
|
|
|
|
run('cd {{release_path}} && ./psh.phar storefront:build');
|
|
|
|
});
|
|
|
|
task('sw:administration:build', function(){
|
|
|
|
run('cd {{release_path}} && ./psh.phar administration:install-dependencies');
|
|
|
|
run('cd {{release_path}} && ./psh.phar administration:build');
|
2020-06-24 20:16:26 +02:00
|
|
|
});
|
|
|
|
task('sw:system:setup', function(){
|
2020-08-06 12:28:39 +02:00
|
|
|
run('cd {{release_path}} && bin/console system:setup');
|
2020-06-24 20:16:26 +02:00
|
|
|
});
|
2020-05-29 13:52:24 +02:00
|
|
|
task('sw:theme:compile', function(){
|
2020-08-06 12:28:39 +02:00
|
|
|
run('cd {{release_path}} && bin/console theme:compile');
|
2020-05-29 13:52:24 +02:00
|
|
|
});
|
|
|
|
task('sw:cache:clear', function(){
|
2020-08-06 12:28:39 +02:00
|
|
|
run('cd {{release_path}} && bin/console cache:clear');
|
|
|
|
});
|
|
|
|
task('sw:cache:warmup', function(){
|
|
|
|
run('cd {{release_path}} && bin/console cache:warmup');
|
|
|
|
run('cd {{release_path}} && bin/console http:cache:warm:up');
|
2020-05-29 13:52:24 +02:00
|
|
|
});
|
2020-08-06 13:22:03 +02:00
|
|
|
task(
|
|
|
|
function(){
|
2020-08-06 12:28:39 +02:00
|
|
|
run('cd {{release_path}} && bin/console assets:install');
|
|
|
|
});
|
|
|
|
task('sw:database:migrate', function(){
|
|
|
|
run('cd {{release_path}} && bin/console database:migrate --all');
|
|
|
|
});
|
|
|
|
task('composer:install', function() {
|
|
|
|
run ('cd {{release_path}} && composer install --no-dev');
|
2020-06-24 20:16:26 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
task('sw:deploy',[
|
2020-08-06 12:28:39 +02:00
|
|
|
'composer:install',
|
|
|
|
'sw:administration:build',
|
2020-06-24 20:16:26 +02:00
|
|
|
'sw:storefront:build',
|
2020-08-06 13:22:03 +02:00
|
|
|
'sw:assets:install',
|
2020-08-06 12:28:39 +02:00
|
|
|
'sw:database:migrate',
|
2020-06-24 20:16:26 +02:00
|
|
|
'sw:theme:compile',
|
|
|
|
'sw:cache:clear'
|
|
|
|
]);
|
2020-05-29 13:52:24 +02:00
|
|
|
/**
|
|
|
|
* Main task
|
|
|
|
*/
|
|
|
|
task('deploy', [
|
|
|
|
'deploy:prepare',
|
|
|
|
'deploy:lock',
|
|
|
|
'deploy:release',
|
|
|
|
'deploy:update_code',
|
|
|
|
'deploy:shared',
|
2020-06-24 20:16:26 +02:00
|
|
|
'sw:deploy',
|
2020-05-29 13:52:24 +02:00
|
|
|
'deploy:writable',
|
|
|
|
'deploy:clear_paths',
|
|
|
|
'deploy:symlink',
|
|
|
|
'deploy:unlock',
|
2020-08-06 12:28:39 +02:00
|
|
|
'sw:cache:warmup',
|
2020-05-29 13:52:24 +02:00
|
|
|
'cleanup',
|
|
|
|
'success'
|
|
|
|
])->desc('Deploy your project');
|
|
|
|
|
|
|
|
after('deploy', 'success');
|
|
|
|
after('deploy:failed', 'deploy:unlock');
|