From 5e08f2db0a5d71d001e7e2d27efae34f37e9850d Mon Sep 17 00:00:00 2001 From: Jochen Date: Sun, 17 Dec 2023 14:41:49 +0100 Subject: [PATCH 1/4] [TASK] Add TYPO3 rsync recipe --- docs/recipe/README.md | 1 + docs/recipe/typo3-rsync.md | 178 +++++++++++++++++++++++++++++++++++++ recipe/typo3-rsync.php | 125 ++++++++++++++++++++++++++ 3 files changed, 304 insertions(+) create mode 100644 docs/recipe/typo3-rsync.md create mode 100644 recipe/typo3-rsync.php diff --git a/docs/recipe/README.md b/docs/recipe/README.md index 05a922165..1f6ff4130 100644 --- a/docs/recipe/README.md +++ b/docs/recipe/README.md @@ -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) \ No newline at end of file diff --git a/docs/recipe/typo3-rsync.md b/docs/recipe/typo3-rsync.md new file mode 100644 index 000000000..b6c30a900 --- /dev/null +++ b/docs/recipe/typo3-rsync.md @@ -0,0 +1,178 @@ + + + + +# Typo3-rsync Recipe + +```php +require 'recipe/typo3-rsync.php'; +``` + +[Source](/recipe/typo3-rsync.php) + +* Requires + * [common](/docs/recipe/common.md) + * [rsync](/docs/recipe/../contrib/rsync.md) + +## Configuration +### typo3_webroot +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3-rsync.php#L12) + +DocumentRoot / WebRoot for the TYPO3 installation + +```php title="Default value" +'public' +``` + + +### bin/typo3 +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3-rsync.php#L17) + +Path to TYPO3 cli + +```php title="Default value" +'vendor/bin/typo3' +``` + + +### shared_dirs +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3-rsync.php#L22) + +Overrides [shared_dirs](/docs/recipe/deploy/shared.md#shared_dirs) from `recipe/deploy/shared.php`. + +Shared directories + +```php title="Default value" +[ + '{{typo3_webroot}}/fileadmin', + '{{typo3_webroot}}/typo3temp', + '{{typo3_webroot}}/uploads' +] +``` + + +### shared_files +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3-rsync.php#L31) + +Overrides [shared_files](/docs/recipe/deploy/shared.md#shared_files) from `recipe/deploy/shared.php`. + +Shared files + +```php title="Default value" +[ + '{{typo3_webroot}}/.htaccess', + 'config/system/settings.php', +] +``` + + +### writable_dirs +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3-rsync.php#L39) + +Overrides [writable_dirs](/docs/recipe/deploy/writable.md#writable_dirs) from `recipe/deploy/writable.php`. + +Writeable directories + +```php title="Default value" +[ + '{{typo3_webroot}}/fileadmin', + 'var', +] +``` + + +### rsync +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3-rsync.php#L65) + + + +```php title="Default value" +[ + '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 +] +``` + + + +## Tasks + +### typo3:cache:warmup +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3-rsync.php#L79) + +TYPO3 - Cache warmup for all caches. + + + + +### typo3:cache:flush +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3-rsync.php#L85) + +TYPO3 - Cache clearing for all caches. + + + + +### typo3:language:update +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3-rsync.php#L91) + +TYPO3 - Update the language files of all activated extensions. + + + + +### typo3:extension:setup +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3-rsync.php#L97) + +TYPO3 - Set up extensions. + + + + +### deploy:update_code +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3-rsync.php#L105) + + + +Configure "deploy" task group. + + +### deploy:info +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3-rsync.php#L106) + + + + + + +### deploy +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3-rsync.php#L109) + +Deploys a TYPO3 project. + + + + +This task is group task which contains next tasks: +* [deploy:setup](/docs/recipe/deploy/setup.md#deploysetup) +* [deploy:lock](/docs/recipe/deploy/lock.md#deploylock) +* [deploy:release](/docs/recipe/deploy/release.md#deployrelease) +* [rsync](/docs/contrib/rsync.md#rsync) +* [deploy:shared](/docs/recipe/deploy/shared.md#deployshared) +* [deploy:writable](/docs/recipe/deploy/writable.md#deploywritable) +* [deploy:symlink](/docs/recipe/deploy/symlink.md#deploysymlink) +* [typo3:extension:setup](/docs/recipe/typo3-rsync.md#typo3extensionsetup) +* [typo3:cache:flush](/docs/recipe/typo3-rsync.md#typo3cacheflush) +* [typo3:language:update](/docs/recipe/typo3-rsync.md#typo3languageupdate) +* [deploy:unlock](/docs/recipe/deploy/lock.md#deployunlock) +* [deploy:cleanup](/docs/recipe/deploy/cleanup.md#deploycleanup) + + diff --git a/recipe/typo3-rsync.php b/recipe/typo3-rsync.php new file mode 100644 index 000000000..081ec0332 --- /dev/null +++ b/recipe/typo3-rsync.php @@ -0,0 +1,125 @@ + 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'); From 11dbbe8815c140841d737aae9f4bfe9bfa2e1541 Mon Sep 17 00:00:00 2001 From: Jochen Date: Sun, 17 Dec 2023 15:22:27 +0100 Subject: [PATCH 2/4] [TASK] Be more precise in task description --- recipe/typo3-rsync.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipe/typo3-rsync.php b/recipe/typo3-rsync.php index 081ec0332..70c66c59d 100644 --- a/recipe/typo3-rsync.php +++ b/recipe/typo3-rsync.php @@ -93,7 +93,7 @@ run('{{bin/php}} {{bin/typo3}} language:update'); }); -desc('TYPO3 - Set up extensions'); +desc('TYPO3 - Set up all extensions'); task('typo3:extension:setup', function () { cd('{{release_path}}'); run('{{bin/php}} {{bin/typo3}} extension:setup'); From 8a248ee45a11b0a5bd7758951f565c264d57a155 Mon Sep 17 00:00:00 2001 From: Jochen Date: Sun, 17 Dec 2023 15:24:25 +0100 Subject: [PATCH 3/4] [TASK] Add updated docs --- docs/recipe/typo3-rsync.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/recipe/typo3-rsync.md b/docs/recipe/typo3-rsync.md index b6c30a900..9102efacd 100644 --- a/docs/recipe/typo3-rsync.md +++ b/docs/recipe/typo3-rsync.md @@ -132,7 +132,7 @@ TYPO3 - Update the language files of all activated extensions. ### typo3:extension:setup [Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3-rsync.php#L97) -TYPO3 - Set up extensions. +TYPO3 - Set up all extensions. From f58975c7a5d2d7893c2669fd49cb985bdb623b55 Mon Sep 17 00:00:00 2001 From: Jochen Date: Sun, 17 Dec 2023 15:54:21 +0100 Subject: [PATCH 4/4] [TASK] Add updated docs --- docs/recipe/README.md | 2 +- .../recipe/{typo3-rsync.md => typo3_rsync.md} | 76 +++++++++++++------ recipe/{typo3-rsync.php => typo3_rsync.php} | 0 3 files changed, 54 insertions(+), 24 deletions(-) rename docs/recipe/{typo3-rsync.md => typo3_rsync.md} (54%) rename recipe/{typo3-rsync.php => typo3_rsync.php} (100%) diff --git a/docs/recipe/README.md b/docs/recipe/README.md index 1f6ff4130..52c2fdf63 100644 --- a/docs/recipe/README.md +++ b/docs/recipe/README.md @@ -23,7 +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) +* [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) \ No newline at end of file diff --git a/docs/recipe/typo3-rsync.md b/docs/recipe/typo3_rsync.md similarity index 54% rename from docs/recipe/typo3-rsync.md rename to docs/recipe/typo3_rsync.md index 9102efacd..469f9ed64 100644 --- a/docs/recipe/typo3-rsync.md +++ b/docs/recipe/typo3_rsync.md @@ -1,22 +1,52 @@ - + -# Typo3-rsync Recipe +# How to Deploy a TYPO3 rsync Project ```php -require 'recipe/typo3-rsync.php'; +require 'recipe/typo3_rsync.php'; ``` -[Source](/recipe/typo3-rsync.php) +[Source](/recipe/typo3_rsync.php) -* Requires - * [common](/docs/recipe/common.md) - * [rsync](/docs/recipe/../contrib/rsync.md) +Deployer is a free and open source deployment tool written in PHP. +It helps you to deploy your TYPO3 rsync application to a server. +It is very easy to use and has a lot of features. + +Three main features of Deployer are: +- **Provisioning** - provision your server for you. +- **Zero downtime deployment** - deploy your application without a downtime. +- **Rollbacks** - rollback your application to a previous version, if something goes wrong. + +Additionally, Deployer has a lot of other features, like: +- **Easy to use** - Deployer is very easy to use. It has a simple and intuitive syntax. +- **Fast** - Deployer is very fast. It uses parallel connections to deploy your application. +- **Secure** - Deployer uses SSH to connect to your server. +- **Supports all major PHP frameworks** - Deployer supports all major PHP frameworks. + +You can read more about Deployer in [Getting Started](/docs/getting-started.md). + +The [deploy](#deploy) task of **TYPO3 rsync** consists of: +* [deploy:setup](/docs/recipe/deploy/setup.md#deploysetup) – Prepares host for deploy +* [deploy:lock](/docs/recipe/deploy/lock.md#deploylock) – Locks deploy +* [deploy:release](/docs/recipe/deploy/release.md#deployrelease) – Prepares release +* [rsync](/docs/contrib/rsync.md#rsync) – Rsync local->remote +* [deploy:shared](/docs/recipe/deploy/shared.md#deployshared) – Creates symlinks for shared files and dirs +* [deploy:writable](/docs/recipe/deploy/writable.md#deploywritable) – Makes writable dirs +* [deploy:symlink](/docs/recipe/deploy/symlink.md#deploysymlink) – Creates symlink to release +* [typo3:extension:setup](/docs/recipe/typo3_rsync.md#typo3extensionsetup) – TYPO3 - Set up all extensions +* [typo3:cache:flush](/docs/recipe/typo3_rsync.md#typo3cacheflush) – TYPO3 - Cache clearing for all caches +* [typo3:language:update](/docs/recipe/typo3_rsync.md#typo3languageupdate) – TYPO3 - Update the language files of all activated extensions +* [deploy:unlock](/docs/recipe/deploy/lock.md#deployunlock) – Unlocks deploy +* [deploy:cleanup](/docs/recipe/deploy/cleanup.md#deploycleanup) – Cleanup old releases + + +The typo3_rsync recipe is based on the [common](/docs/recipe/common.md) recipe. ## Configuration ### typo3_webroot -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3-rsync.php#L12) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3_rsync.php#L12) DocumentRoot / WebRoot for the TYPO3 installation @@ -26,7 +56,7 @@ DocumentRoot / WebRoot for the TYPO3 installation ### bin/typo3 -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3-rsync.php#L17) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3_rsync.php#L17) Path to TYPO3 cli @@ -36,7 +66,7 @@ Path to TYPO3 cli ### shared_dirs -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3-rsync.php#L22) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3_rsync.php#L22) Overrides [shared_dirs](/docs/recipe/deploy/shared.md#shared_dirs) from `recipe/deploy/shared.php`. @@ -52,7 +82,7 @@ Shared directories ### shared_files -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3-rsync.php#L31) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3_rsync.php#L31) Overrides [shared_files](/docs/recipe/deploy/shared.md#shared_files) from `recipe/deploy/shared.php`. @@ -67,7 +97,7 @@ Shared files ### writable_dirs -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3-rsync.php#L39) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3_rsync.php#L39) Overrides [writable_dirs](/docs/recipe/deploy/writable.md#writable_dirs) from `recipe/deploy/writable.php`. @@ -82,7 +112,7 @@ Writeable directories ### rsync -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3-rsync.php#L65) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3_rsync.php#L65) @@ -106,7 +136,7 @@ Writeable directories ## Tasks ### typo3:cache:warmup -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3-rsync.php#L79) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3_rsync.php#L79) TYPO3 - Cache warmup for all caches. @@ -114,7 +144,7 @@ TYPO3 - Cache warmup for all caches. ### typo3:cache:flush -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3-rsync.php#L85) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3_rsync.php#L85) TYPO3 - Cache clearing for all caches. @@ -122,7 +152,7 @@ TYPO3 - Cache clearing for all caches. ### typo3:language:update -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3-rsync.php#L91) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3_rsync.php#L91) TYPO3 - Update the language files of all activated extensions. @@ -130,7 +160,7 @@ TYPO3 - Update the language files of all activated extensions. ### typo3:extension:setup -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3-rsync.php#L97) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3_rsync.php#L97) TYPO3 - Set up all extensions. @@ -138,7 +168,7 @@ TYPO3 - Set up all extensions. ### deploy:update_code -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3-rsync.php#L105) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3_rsync.php#L105) @@ -146,7 +176,7 @@ Configure "deploy" task group. ### deploy:info -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3-rsync.php#L106) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3_rsync.php#L106) @@ -154,7 +184,7 @@ Configure "deploy" task group. ### deploy -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3-rsync.php#L109) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3_rsync.php#L109) Deploys a TYPO3 project. @@ -169,9 +199,9 @@ This task is group task which contains next tasks: * [deploy:shared](/docs/recipe/deploy/shared.md#deployshared) * [deploy:writable](/docs/recipe/deploy/writable.md#deploywritable) * [deploy:symlink](/docs/recipe/deploy/symlink.md#deploysymlink) -* [typo3:extension:setup](/docs/recipe/typo3-rsync.md#typo3extensionsetup) -* [typo3:cache:flush](/docs/recipe/typo3-rsync.md#typo3cacheflush) -* [typo3:language:update](/docs/recipe/typo3-rsync.md#typo3languageupdate) +* [typo3:extension:setup](/docs/recipe/typo3_rsync.md#typo3extensionsetup) +* [typo3:cache:flush](/docs/recipe/typo3_rsync.md#typo3cacheflush) +* [typo3:language:update](/docs/recipe/typo3_rsync.md#typo3languageupdate) * [deploy:unlock](/docs/recipe/deploy/lock.md#deployunlock) * [deploy:cleanup](/docs/recipe/deploy/cleanup.md#deploycleanup) diff --git a/recipe/typo3-rsync.php b/recipe/typo3_rsync.php similarity index 100% rename from recipe/typo3-rsync.php rename to recipe/typo3_rsync.php