Skip to content

Commit

Permalink
[TASK] Add TYPO3 rsync recipe
Browse files Browse the repository at this point in the history
  • Loading branch information
ochorocho committed Dec 17, 2023
1 parent 11cef74 commit aad7e93
Show file tree
Hide file tree
Showing 2 changed files with 126 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/recipe/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* [Sulu Recipe](/docs/recipe/sulu.md)
* [Symfony Recipe](/docs/recipe/symfony.md)
* [TYPO3 Recipe](/docs/recipe/typo3.md)
* [TYPO3-rsync Recipe](/docs/recipe/typo3-rsync.md)
* [WordPress Recipe](/docs/recipe/wordpress.md)
* [Yii2 Recipe](/docs/recipe/yii.md)
* [Zend Framework Recipe](/docs/recipe/zend_framework.md)
125 changes: 125 additions & 0 deletions recipe/typo3-rsync.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
<?php
namespace Deployer;

require_once __DIR__ . '/common.php';
require_once __DIR__ . '/../contrib/rsync.php';

add('recipes', ['typo3_rsync']);

/**
* DocumentRoot / WebRoot for the TYPO3 installation
*/
set('typo3_webroot', 'public');

/**
* Path to TYPO3 cli
*/
set('bin/typo3', 'vendor/bin/typo3');

/**
* Shared directories
*/
set('shared_dirs', [
'{{typo3_webroot}}/fileadmin',
'{{typo3_webroot}}/typo3temp',
'{{typo3_webroot}}/uploads'
]);

/**
* Shared files
*/
set('shared_files', [
'{{typo3_webroot}}/.htaccess',
'config/system/settings.php',
]);

/**
* Writeable directories
*/
set('writable_dirs', [
'{{typo3_webroot}}/fileadmin',
'var',
]);

$exclude = [
'.Build',
'.git',
'.gitlab',
'.ddev',
'.deployer',
'.idea',
'.DS_Store',
'.gitlab-ci.yml',
'.npm',
'deploy.yaml',
'package.json',
'package-lock.json',
'node_modules/',
'var/',
'public/fileadmin/',
'public/typo3temp/',
'config/system/additional.php',
'config/system/settings.php',
];

set('rsync', [
'exclude' => array_merge(get('shared_dirs'), get('shared_files'), $exclude),
'exclude-file' => false,
'include' => ['vendor'],
'include-file' => false,
'filter' => ['dir-merge,-n /.gitignore'],
'filter-file' => false,
'filter-perdir' => false,
'flags' => 'avz',
'options' => ['delete', 'keep-dirlinks', 'links'],
'timeout' => 600
]);

desc('TYPO3 - Cache warmup for all caches');
task('typo3:cache:warmup', function () {
cd('{{release_path}}');
run('{{bin/php}} {{bin/typo3}} cache:warmup');
});

desc('TYPO3 - Cache clearing for all caches');
task('typo3:cache:flush', function () {
cd('{{release_path}}');
run('{{bin/php}} {{bin/typo3}} cache:flush');
});

desc('TYPO3 - Update the language files of all activated extensions');
task('typo3:language:update', function () {
cd('{{release_path}}');
run('{{bin/php}} {{bin/typo3}} language:update');
});

desc('TYPO3 - Set up extensions');
task('typo3:extension:setup', function () {
cd('{{release_path}}');
run('{{bin/php}} {{bin/typo3}} extension:setup');
});

/**
* Configure "deploy" task group.
*/
task('deploy:update_code')->hidden()->disable();
task('deploy:info')->hidden()->disable();

desc('Deploys a TYPO3 project');
task('deploy', [
'deploy:setup',
'deploy:lock',
'deploy:release',
'rsync',
'deploy:shared',
'deploy:writable',
'deploy:symlink',
'typo3:extension:setup',
'typo3:cache:flush',
'typo3:language:update',
'deploy:unlock',
'deploy:cleanup',
'deploy:success'
]);

after('deploy:failed', 'deploy:unlock');

0 comments on commit aad7e93

Please sign in to comment.