From 0fd0394f0e34605012acce4a1f1231b917c544b2 Mon Sep 17 00:00:00 2001 From: David Bonhagen Date: Wed, 2 Jul 2025 15:22:29 +0200 Subject: [PATCH 01/16] Update typo3.php --- recipe/typo3.php | 178 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 165 insertions(+), 13 deletions(-) diff --git a/recipe/typo3.php b/recipe/typo3.php index ae01a00cf..bc2e7817e 100644 --- a/recipe/typo3.php +++ b/recipe/typo3.php @@ -2,24 +2,38 @@ namespace Deployer; -require_once __DIR__ . '/common.php'; +require_once 'recipe/common.php'; +require_once 'contrib/rsync.php'; +$composerConfig = json_decode(file_get_contents('./composer.json'), true, 512, JSON_THROW_ON_ERROR); add('recipes', ['typo3']); /** * DocumentRoot / WebRoot for the TYPO3 installation */ -set('typo3_webroot', 'Web'); +set('typo3_webroot', function () use ($composerConfig) { + if ($composerConfig['extra']['typo3/cms']['web-dir'] ?? false) { + return $composerConfig['extra']['typo3/cms']['web-dir']; + } + + return 'public'; +}); /** - * Main TYPO3 task + * Path to TYPO3 cli */ -desc('Deploys your project'); -task('deploy', [ - 'deploy:prepare', - 'deploy:vendors', - 'deploy:publish', -]); +set('bin/typo3', function () use ($composerConfig) { + if ($composerConfig['config']['bin-dir'] ?? false) { + return $composerConfig['config']['bin-dir'] . '/typo3'; + } + + return 'vendor/bin/typo3'; +}); + +/** + * Log files to display when running `./vendor/bin/dep logs:app` + */ +set('log_files', 'var/log/typo3_*.log'); /** * Shared directories @@ -27,14 +41,18 @@ set('shared_dirs', [ '{{typo3_webroot}}/fileadmin', '{{typo3_webroot}}/typo3temp', - '{{typo3_webroot}}/uploads', + 'var/session', + 'var/log', + 'var/lock', + 'var/charset', ]); /** * Shared files */ set('shared_files', [ - '{{typo3_webroot}}/.htaccess', + 'config/system/settings.php', + '.env', ]); /** @@ -43,6 +61,140 @@ set('writable_dirs', [ '{{typo3_webroot}}/fileadmin', '{{typo3_webroot}}/typo3temp', - '{{typo3_webroot}}/typo3conf', - '{{typo3_webroot}}/uploads', + 'var', ]); + +/** + * Composer options + */ +set('composer_options', ' --no-dev --verbose --prefer-dist --no-progress --no-interaction --optimize-autoloader'); + +/** + * Determine if 'repository' is defined in config.yaml and set deployment strategy based on presence of 'repository' + */ +$useGitDeployment = has('repository') && !empty(get('repository')); +$updateCodeTask = $useGitDeployment ? 'deploy:update_code' : 'rsync'; + +if (!$useGitDeployment) { + $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/', + ]; + + + 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 system caches'); +task('typo3:cache:warmup', function () { + cd('{{release_path}}'); + run('{{bin/php}} {{bin/typo3}} cache:warmup --group system'); +}); + +desc('TYPO3 - Cache clearing for frontend caches'); +task('typo3:cache:flush', function () { + cd('{{release_path}}'); + run('{{bin/php}} {{bin/typo3}} cache:flush --group pages'); +}); + +desc('TYPO3 - Cache warmup for frontend caches'); +task('typo3:cache:pages:warmup', function () { + cd('{{release_path}}'); + run('{{bin/php}} {{bin/typo3}} cache:warmup --group pages'); +}); + +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 all extensions'); +task('typo3:extension:setup', function () { + cd('{{release_path}}'); + run('{{bin/php}} {{bin/typo3}} extension:setup'); +}); + + +$tasksToRemove = [ + 'logs:caddy', + 'logs:caddy:syslog', + 'provision', + 'provision:server', + 'provision:ssh', + 'provision:databases', + 'provision:firewall', + 'provision:install', + 'provision:npm', + 'provision:php', + 'provision:postgresql', + 'provision:mariadb', + 'provision:mysql', + 'provision:update', + 'provision:upgrade', + 'provision:verify', + 'provision:website', + 'provision:composer', + 'provision:configure', + 'provision:deployer', + 'provision:check', +]; +foreach ($tasksToRemove as $task) { + try { + task($task)->hidden()->disable(); + } catch (\InvalidArgumentException $e) { + // Task not found ... + } +} + +/** + * Configure "deploy" task group. + */ +desc('Deploys a TYPO3 project'); +task('deploy', [ + 'deploy:info', + 'deploy:setup', + 'deploy:lock', + 'deploy:release', + $updateCodeTask, + 'deploy:shared', + 'deploy:writable', + 'deploy:vendors', + 'typo3:cache:warmup', + 'typo3:extension:setup', + 'typo3:language:update', + 'typo3:cache:flush', + 'typo3:cache:pages:warmup', + 'deploy:unlock', + 'deploy:cleanup', + 'deploy:success', +]); + +after('deploy:failed', 'deploy:unlock'); \ No newline at end of file From ab9116016ae3b0557b11ee5a2ee17448c1556580 Mon Sep 17 00:00:00 2001 From: David Bonhagen Date: Wed, 2 Jul 2025 15:25:02 +0200 Subject: [PATCH 02/16] Add regenerated docs --- docs/recipe/typo3.md | 137 +++++++++++++++++++++++++++++++------------ 1 file changed, 98 insertions(+), 39 deletions(-) diff --git a/docs/recipe/typo3.md b/docs/recipe/typo3.md index d1dc48278..51170c2e6 100644 --- a/docs/recipe/typo3.md +++ b/docs/recipe/typo3.md @@ -28,40 +28,49 @@ Additionally, Deployer has a lot of other features, like: You can read more about Deployer in [Getting Started](/docs/getting-started.md). The [deploy](#deploy) task of **TYPO3** consists of: -* [deploy:prepare](/docs/recipe/common.md#deploy-prepare) – Prepares a new release - * [deploy:info](/docs/recipe/deploy/info.md#deploy-info) – Displays info about deployment - * [deploy:setup](/docs/recipe/deploy/setup.md#deploy-setup) – Prepares host for deploy - * [deploy:lock](/docs/recipe/deploy/lock.md#deploy-lock) – Locks deploy - * [deploy:release](/docs/recipe/deploy/release.md#deploy-release) – Prepares release - * [deploy:update_code](/docs/recipe/deploy/update_code.md#deploy-update_code) – Updates code - * [deploy:env](/docs/recipe/deploy/env.md#deploy-env) – Configure .env file - * [deploy:shared](/docs/recipe/deploy/shared.md#deploy-shared) – Creates symlinks for shared files and dirs - * [deploy:writable](/docs/recipe/deploy/writable.md#deploy-writable) – Makes writable dirs -* [deploy:vendors](/docs/recipe/deploy/vendors.md#deploy-vendors) – Installs vendors -* [deploy:publish](/docs/recipe/common.md#deploy-publish) – Publishes the release - * [deploy:symlink](/docs/recipe/deploy/symlink.md#deploy-symlink) – Creates symlink to release - * [deploy:unlock](/docs/recipe/deploy/lock.md#deploy-unlock) – Unlocks deploy - * [deploy:cleanup](/docs/recipe/deploy/cleanup.md#deploy-cleanup) – Cleanup old releases - * [deploy:success](/docs/recipe/common.md#deploy-success) – Deploys your project - - -The typo3 recipe is based on the [common](/docs/recipe/common.md) recipe. +* [deploy:info](/docs/recipe/deploy/info.md#deploy-info) – Displays info about deployment +* [deploy:setup](/docs/recipe/deploy/setup.md#deploy-setup) – Prepares host for deploy +* [deploy:lock](/docs/recipe/deploy/lock.md#deploy-lock) – Locks deploy +* [deploy:release](/docs/recipe/deploy/release.md#deploy-release) – Prepares release + + +The typo3 recipe is based on the [common](/docs/reciperecipe/common.md) recipe. ## Configuration ### typo3_webroot -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L12) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L14) DocumentRoot / WebRoot for the TYPO3 installation +:::info Autogenerated +The value of this configuration is autogenerated on access. +::: + + + + +### bin/typo3 +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L25) + +Path to TYPO3 cli +:::info Autogenerated +The value of this configuration is autogenerated on access. +::: + + + + +### log_files +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L36) + +Log files to display when running `./vendor/bin/dep logs:app` ```php title="Default value" -'Web' +'var/log/typo3_*.log' ``` ### shared_dirs -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L27) - -Overrides [shared_dirs](/docs/recipe/deploy/shared.md#shared_dirs) from `recipe/deploy/shared.php`. +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L41) Shared directories @@ -69,29 +78,29 @@ Shared directories [ '{{typo3_webroot}}/fileadmin', '{{typo3_webroot}}/typo3temp', - '{{typo3_webroot}}/uploads', + 'var/session', + 'var/log', + 'var/lock', + 'var/charset', ] ``` ### shared_files -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L36) - -Overrides [shared_files](/docs/recipe/deploy/shared.md#shared_files) from `recipe/deploy/shared.php`. +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L53) Shared files ```php title="Default value" [ - '{{typo3_webroot}}/.htaccess', + 'config/system/settings.php', + '.env', ] ``` ### writable_dirs -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L43) - -Overrides [writable_dirs](/docs/recipe/deploy/writable.md#writable_dirs) from `recipe/deploy/writable.php`. +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L61) Writeable directories @@ -99,26 +108,76 @@ Writeable directories [ '{{typo3_webroot}}/fileadmin', '{{typo3_webroot}}/typo3temp', - '{{typo3_webroot}}/typo3conf', - '{{typo3_webroot}}/uploads', + 'var', ] ``` +### composer_options +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L70) + +Composer options + +```php title="Default value" +' --no-dev --verbose --prefer-dist --no-progress --no-interaction --optimize-autoloader' +``` + + ## Tasks +### typo3\:cache\:warmup {#typo3-cache-warmup} +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L116) + +TYPO3 - Cache warmup for system caches. + + + + +### typo3\:cache\:flush {#typo3-cache-flush} +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L122) + +TYPO3 - Cache clearing for frontend caches. + + + + +### typo3\:cache\:pages\:warmup {#typo3-cache-pages-warmup} +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L128) + +TYPO3 - Cache warmup for frontend caches. + + + + +### typo3\:language\:update {#typo3-language-update} +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L134) + +TYPO3 - Update the language files of all activated extensions. + + + + +### typo3\:extension\:setup {#typo3-extension-setup} +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L140) + +TYPO3 - Set up all extensions. + + + + ### deploy {#deploy} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L18) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L181) -Deploys your project. +Deploys a TYPO3 project. -Main TYPO3 task +Configure "deploy" task group. This task is group task which contains next tasks: -* [deploy:prepare](/docs/recipe/common.md#deploy-prepare) -* [deploy:vendors](/docs/recipe/deploy/vendors.md#deploy-vendors) -* [deploy:publish](/docs/recipe/common.md#deploy-publish) +* [deploy:info](/docs/recipe/deploy/info.md#deploy-info) +* [deploy:setup](/docs/recipe/deploy/setup.md#deploy-setup) +* [deploy:lock](/docs/recipe/deploy/lock.md#deploy-lock) +* [deploy:release](/docs/recipe/deploy/release.md#deploy-release) From 12e06e9f009ec45dd400252cbc8b5693befe8b1b Mon Sep 17 00:00:00 2001 From: David Bonhagen Date: Fri, 4 Jul 2025 13:41:11 +0200 Subject: [PATCH 03/16] refactor: remove tasks to remove --- recipe/typo3.php | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/recipe/typo3.php b/recipe/typo3.php index bc2e7817e..4da3d00c5 100644 --- a/recipe/typo3.php +++ b/recipe/typo3.php @@ -142,38 +142,6 @@ run('{{bin/php}} {{bin/typo3}} extension:setup'); }); - -$tasksToRemove = [ - 'logs:caddy', - 'logs:caddy:syslog', - 'provision', - 'provision:server', - 'provision:ssh', - 'provision:databases', - 'provision:firewall', - 'provision:install', - 'provision:npm', - 'provision:php', - 'provision:postgresql', - 'provision:mariadb', - 'provision:mysql', - 'provision:update', - 'provision:upgrade', - 'provision:verify', - 'provision:website', - 'provision:composer', - 'provision:configure', - 'provision:deployer', - 'provision:check', -]; -foreach ($tasksToRemove as $task) { - try { - task($task)->hidden()->disable(); - } catch (\InvalidArgumentException $e) { - // Task not found ... - } -} - /** * Configure "deploy" task group. */ From 506e1415dad62c79b5adab439c0c255e0cf606b8 Mon Sep 17 00:00:00 2001 From: David Bonhagen Date: Fri, 4 Jul 2025 14:00:37 +0200 Subject: [PATCH 04/16] refactor: wrap composer in set config option --- recipe/typo3.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/recipe/typo3.php b/recipe/typo3.php index 4da3d00c5..0e9ef5876 100644 --- a/recipe/typo3.php +++ b/recipe/typo3.php @@ -2,16 +2,21 @@ namespace Deployer; -require_once 'recipe/common.php'; +require_once __DIR__ . '/common.php'; require_once 'contrib/rsync.php'; -$composerConfig = json_decode(file_get_contents('./composer.json'), true, 512, JSON_THROW_ON_ERROR); add('recipes', ['typo3']); +set('composer_config', function () { + return json_decode(file_get_contents('./composer.json'), true, 512, JSON_THROW_ON_ERROR); +}); + /** * DocumentRoot / WebRoot for the TYPO3 installation */ -set('typo3_webroot', function () use ($composerConfig) { +set('typo3_webroot', function () { + $composerConfig = get('composer_config'); + if ($composerConfig['extra']['typo3/cms']['web-dir'] ?? false) { return $composerConfig['extra']['typo3/cms']['web-dir']; } @@ -22,7 +27,9 @@ /** * Path to TYPO3 cli */ -set('bin/typo3', function () use ($composerConfig) { +set('bin/typo3', function () { + $composerConfig = get('composer_config'); + if ($composerConfig['config']['bin-dir'] ?? false) { return $composerConfig['config']['bin-dir'] . '/typo3'; } From 8d590b913bdbbd0765fdd958fb45f5769d82643e Mon Sep 17 00:00:00 2001 From: David Bonhagen Date: Fri, 4 Jul 2025 14:01:28 +0200 Subject: [PATCH 05/16] refactor: enable user to choose transfer method --- recipe/typo3.php | 83 +++++++++++++++++++++++++----------------------- 1 file changed, 43 insertions(+), 40 deletions(-) diff --git a/recipe/typo3.php b/recipe/typo3.php index 0e9ef5876..7b62df729 100644 --- a/recipe/typo3.php +++ b/recipe/typo3.php @@ -76,48 +76,51 @@ */ set('composer_options', ' --no-dev --verbose --prefer-dist --no-progress --no-interaction --optimize-autoloader'); + /** - * Determine if 'repository' is defined in config.yaml and set deployment strategy based on presence of 'repository' + * If set in the config this recipe uses rsync. Default: false (use the Git repository) */ -$useGitDeployment = has('repository') && !empty(get('repository')); -$updateCodeTask = $useGitDeployment ? 'deploy:update_code' : 'rsync'; - -if (!$useGitDeployment) { - $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/', - ]; - - - 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, - ]); - -} +set('use_rsync', false); + +set('update_code_task', function () { + return get('use_rsync') ? 'rsync' : 'deploy:update_code'; +}); +task('typo3:update_code', function () { + invoke(get('update_code_task')); +}); + +$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/', +]; + +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 system caches'); task('typo3:cache:warmup', function () { @@ -158,7 +161,7 @@ 'deploy:setup', 'deploy:lock', 'deploy:release', - $updateCodeTask, + 'typo3:update_code', 'deploy:shared', 'deploy:writable', 'deploy:vendors', From 2325200d0acf5ae42fbc6af6a6a3590fe69a39fb Mon Sep 17 00:00:00 2001 From: David Bonhagen Date: Fri, 4 Jul 2025 14:03:45 +0200 Subject: [PATCH 06/16] chore: regenerated documentation --- docs/recipe/typo3.md | 121 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 106 insertions(+), 15 deletions(-) diff --git a/docs/recipe/typo3.md b/docs/recipe/typo3.md index 51170c2e6..b96683cbc 100644 --- a/docs/recipe/typo3.md +++ b/docs/recipe/typo3.md @@ -32,13 +32,35 @@ The [deploy](#deploy) task of **TYPO3** consists of: * [deploy:setup](/docs/recipe/deploy/setup.md#deploy-setup) – Prepares host for deploy * [deploy:lock](/docs/recipe/deploy/lock.md#deploy-lock) – Locks deploy * [deploy:release](/docs/recipe/deploy/release.md#deploy-release) – Prepares release +* [typo3:update_code](/docs/recipe/typo3.md#typo3-update_code) – +* [deploy:shared](/docs/recipe/deploy/shared.md#deploy-shared) – Creates symlinks for shared files and dirs +* [deploy:writable](/docs/recipe/deploy/writable.md#deploy-writable) – Makes writable dirs +* [deploy:vendors](/docs/recipe/deploy/vendors.md#deploy-vendors) – Installs vendors +* [typo3:cache:warmup](/docs/recipe/typo3.md#typo3-cache-warmup) – TYPO3 - Cache warmup for system caches +* [typo3:extension:setup](/docs/recipe/typo3.md#typo3-extension-setup) – TYPO3 - Set up all extensions +* [typo3:language:update](/docs/recipe/typo3.md#typo3-language-update) – TYPO3 - Update the language files of all activated extensions +* [typo3:cache:flush](/docs/recipe/typo3.md#typo3-cache-flush) – TYPO3 - Cache clearing for frontend caches +* [typo3:cache:pages:warmup](/docs/recipe/typo3.md#typo3-cache-pages-warmup) – TYPO3 - Cache warmup for frontend caches +* [deploy:unlock](/docs/recipe/deploy/lock.md#deploy-unlock) – Unlocks deploy +* [deploy:cleanup](/docs/recipe/deploy/cleanup.md#deploy-cleanup) – Cleanup old releases +* [deploy:success](/docs/recipe/common.md#deploy-success) – Deploys your project + + +The typo3 recipe is based on the [common](/docs/recipe/common.md) recipe. +## Configuration +### composer_config +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L10) + + + +```php title="Default value" +return json_decode(file_get_contents('./composer.json'), true, 512, JSON_THROW_ON_ERROR); +``` -The typo3 recipe is based on the [common](/docs/reciperecipe/common.md) recipe. -## Configuration ### typo3_webroot -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L14) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L17) DocumentRoot / WebRoot for the TYPO3 installation :::info Autogenerated @@ -49,7 +71,7 @@ The value of this configuration is autogenerated on access. ### bin/typo3 -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L25) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L30) Path to TYPO3 cli :::info Autogenerated @@ -60,7 +82,7 @@ The value of this configuration is autogenerated on access. ### log_files -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L36) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L43) Log files to display when running `./vendor/bin/dep logs:app` @@ -70,7 +92,9 @@ Log files to display when running `./vendor/bin/dep logs:app` ### shared_dirs -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L41) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L48) + +Overrides [shared_dirs](/docs/recipe/deploy/shared.md#shared_dirs) from `recipe/deploy/shared.php`. Shared directories @@ -87,7 +111,9 @@ Shared directories ### shared_files -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L53) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L60) + +Overrides [shared_files](/docs/recipe/deploy/shared.md#shared_files) from `recipe/deploy/shared.php`. Shared files @@ -100,7 +126,9 @@ Shared files ### writable_dirs -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L61) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L68) + +Overrides [writable_dirs](/docs/recipe/deploy/writable.md#writable_dirs) from `recipe/deploy/writable.php`. Writeable directories @@ -114,7 +142,9 @@ Writeable directories ### composer_options -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L70) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L77) + +Overrides [composer_options](/docs/recipe/deploy/vendors.md#composer_options) from `recipe/deploy/vendors.php`. Composer options @@ -123,11 +153,60 @@ Composer options ``` +### use_rsync +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L83) + +If set in the config this recipe uses rsync. Default: false (use the Git repository) + +```php title="Default value" +false +``` + + +### update_code_task +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L85) + + + +```php title="Default value" +return get('use_rsync') ? 'rsync' : 'deploy:update_code'; +``` + + +### rsync +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L112) + + + +```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\:update_code {#typo3-update_code} +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L89) + + + + + + ### typo3\:cache\:warmup {#typo3-cache-warmup} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L116) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L126) TYPO3 - Cache warmup for system caches. @@ -135,7 +214,7 @@ TYPO3 - Cache warmup for system caches. ### typo3\:cache\:flush {#typo3-cache-flush} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L122) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L132) TYPO3 - Cache clearing for frontend caches. @@ -143,7 +222,7 @@ TYPO3 - Cache clearing for frontend caches. ### typo3\:cache\:pages\:warmup {#typo3-cache-pages-warmup} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L128) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L138) TYPO3 - Cache warmup for frontend caches. @@ -151,7 +230,7 @@ TYPO3 - Cache warmup for frontend caches. ### typo3\:language\:update {#typo3-language-update} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L134) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L144) TYPO3 - Update the language files of all activated extensions. @@ -159,7 +238,7 @@ TYPO3 - Update the language files of all activated extensions. ### typo3\:extension\:setup {#typo3-extension-setup} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L140) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L150) TYPO3 - Set up all extensions. @@ -167,7 +246,7 @@ TYPO3 - Set up all extensions. ### deploy {#deploy} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L181) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L159) Deploys a TYPO3 project. @@ -179,5 +258,17 @@ This task is group task which contains next tasks: * [deploy:setup](/docs/recipe/deploy/setup.md#deploy-setup) * [deploy:lock](/docs/recipe/deploy/lock.md#deploy-lock) * [deploy:release](/docs/recipe/deploy/release.md#deploy-release) +* [typo3:update_code](/docs/recipe/typo3.md#typo3-update_code) +* [deploy:shared](/docs/recipe/deploy/shared.md#deploy-shared) +* [deploy:writable](/docs/recipe/deploy/writable.md#deploy-writable) +* [deploy:vendors](/docs/recipe/deploy/vendors.md#deploy-vendors) +* [typo3:cache:warmup](/docs/recipe/typo3.md#typo3-cache-warmup) +* [typo3:extension:setup](/docs/recipe/typo3.md#typo3-extension-setup) +* [typo3:language:update](/docs/recipe/typo3.md#typo3-language-update) +* [typo3:cache:flush](/docs/recipe/typo3.md#typo3-cache-flush) +* [typo3:cache:pages:warmup](/docs/recipe/typo3.md#typo3-cache-pages-warmup) +* [deploy:unlock](/docs/recipe/deploy/lock.md#deploy-unlock) +* [deploy:cleanup](/docs/recipe/deploy/cleanup.md#deploy-cleanup) +* [deploy:success](/docs/recipe/common.md#deploy-success) From 5a538608d6071d84c35e77b016ad3b69e3c61f05 Mon Sep 17 00:00:00 2001 From: David Bonhagen Date: Fri, 4 Jul 2025 15:55:18 +0200 Subject: [PATCH 07/16] fix: apply php-cs-fixer --- recipe/typo3.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipe/typo3.php b/recipe/typo3.php index 7b62df729..e5400ce15 100644 --- a/recipe/typo3.php +++ b/recipe/typo3.php @@ -175,4 +175,4 @@ 'deploy:success', ]); -after('deploy:failed', 'deploy:unlock'); \ No newline at end of file +after('deploy:failed', 'deploy:unlock'); From 3b7bba6175980100ec50cbb5465fdbce3741e069 Mon Sep 17 00:00:00 2001 From: David Bonhagen Date: Thu, 10 Jul 2025 16:16:43 +0200 Subject: [PATCH 08/16] refactor: use absolute path to execute typo3 binary --- recipe/typo3.php | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/recipe/typo3.php b/recipe/typo3.php index e5400ce15..cb33ca06f 100644 --- a/recipe/typo3.php +++ b/recipe/typo3.php @@ -124,32 +124,27 @@ desc('TYPO3 - Cache warmup for system caches'); task('typo3:cache:warmup', function () { - cd('{{release_path}}'); - run('{{bin/php}} {{bin/typo3}} cache:warmup --group system'); + run('{{bin/php}} {{release_path}}/public/typo3 cache:warmup --group system'); }); desc('TYPO3 - Cache clearing for frontend caches'); task('typo3:cache:flush', function () { - cd('{{release_path}}'); - run('{{bin/php}} {{bin/typo3}} cache:flush --group pages'); + run('{{bin/php}} {{release_path}}/public/typo3 cache:flush --group pages'); }); desc('TYPO3 - Cache warmup for frontend caches'); task('typo3:cache:pages:warmup', function () { - cd('{{release_path}}'); - run('{{bin/php}} {{bin/typo3}} cache:warmup --group pages'); + run('{{bin/php}} {{release_path}}/public/typo3 cache:warmup --group pages'); }); 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'); + run('{{bin/php}} {{release_path}}/public/typo3 language:update'); }); desc('TYPO3 - Set up all extensions'); task('typo3:extension:setup', function () { - cd('{{release_path}}'); - run('{{bin/php}} {{bin/typo3}} extension:setup'); + run('{{bin/php}} {{release_path}}/public/typo3 extension:setup'); }); /** From 059697ae9db95f976658a42c111638fb87499ed6 Mon Sep 17 00:00:00 2001 From: David Bonhagen Date: Thu, 10 Jul 2025 16:23:41 +0200 Subject: [PATCH 09/16] refactor: remove effectless warm up --- recipe/typo3.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/recipe/typo3.php b/recipe/typo3.php index cb33ca06f..be6be98c7 100644 --- a/recipe/typo3.php +++ b/recipe/typo3.php @@ -132,11 +132,6 @@ run('{{bin/php}} {{release_path}}/public/typo3 cache:flush --group pages'); }); -desc('TYPO3 - Cache warmup for frontend caches'); -task('typo3:cache:pages:warmup', function () { - run('{{bin/php}} {{release_path}}/public/typo3 cache:warmup --group pages'); -}); - desc('TYPO3 - Update the language files of all activated extensions'); task('typo3:language:update', function () { run('{{bin/php}} {{release_path}}/public/typo3 language:update'); @@ -164,7 +159,6 @@ 'typo3:extension:setup', 'typo3:language:update', 'typo3:cache:flush', - 'typo3:cache:pages:warmup', 'deploy:unlock', 'deploy:cleanup', 'deploy:success', From d86ee81271c0b2590603f497452e6b87056ab1d1 Mon Sep 17 00:00:00 2001 From: David Bonhagen Date: Thu, 10 Jul 2025 16:42:17 +0200 Subject: [PATCH 10/16] refactor: rename public dir and adjust shared / writable dirs --- recipe/typo3.php | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/recipe/typo3.php b/recipe/typo3.php index be6be98c7..9b2a41b28 100644 --- a/recipe/typo3.php +++ b/recipe/typo3.php @@ -14,7 +14,7 @@ /** * DocumentRoot / WebRoot for the TYPO3 installation */ -set('typo3_webroot', function () { +set('typo3/public_dir', function () { $composerConfig = get('composer_config'); if ($composerConfig['extra']['typo3/cms']['web-dir'] ?? false) { @@ -46,12 +46,13 @@ * Shared directories */ set('shared_dirs', [ - '{{typo3_webroot}}/fileadmin', - '{{typo3_webroot}}/typo3temp', - 'var/session', - 'var/log', + '{{typo3/public_dir}}/fileadmin', + '{{typo3/public_dir}}/assets', + '{{typo3/public_dir}}/typo3temp/assets', 'var/lock', - 'var/charset', + 'var/log', + 'var/session', + 'var/spool', ]); /** @@ -66,9 +67,12 @@ * Writeable directories */ set('writable_dirs', [ - '{{typo3_webroot}}/fileadmin', - '{{typo3_webroot}}/typo3temp', - 'var', + '{{typo3/public_dir}}/fileadmin', + '{{typo3/public_dir}}/assets', + '{{typo3/public_dir}}/typo3temp/assets', + 'var/cache', + 'var/lock', + 'var/log', ]); /** From 3b4e7b6aa327f0ea3edb7d00961edfb775998594 Mon Sep 17 00:00:00 2001 From: David Bonhagen Date: Thu, 10 Jul 2025 16:42:51 +0200 Subject: [PATCH 11/16] refactor: rename rsync task for more consistency --- recipe/typo3.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipe/typo3.php b/recipe/typo3.php index 9b2a41b28..21881da9c 100644 --- a/recipe/typo3.php +++ b/recipe/typo3.php @@ -87,7 +87,7 @@ set('use_rsync', false); set('update_code_task', function () { - return get('use_rsync') ? 'rsync' : 'deploy:update_code'; + return get('use_rsync') ? 'deploy:rsync' : 'deploy:update_code'; }); task('typo3:update_code', function () { @@ -113,7 +113,7 @@ 'public/typo3temp/', ]; -set('rsync', [ +set('deploy:rsync', [ 'exclude' => array_merge(get('shared_dirs'), get('shared_files'), $exclude), 'exclude-file' => false, 'include' => ['vendor'], From 346bf8de41351a258c15bb6ea385a5f259adff06 Mon Sep 17 00:00:00 2001 From: David Bonhagen Date: Thu, 10 Jul 2025 16:53:10 +0200 Subject: [PATCH 12/16] refactor: adjust exclude list --- recipe/typo3.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/recipe/typo3.php b/recipe/typo3.php index 21881da9c..bb7c46e9a 100644 --- a/recipe/typo3.php +++ b/recipe/typo3.php @@ -109,8 +109,9 @@ 'package-lock.json', 'node_modules/', 'var/', - 'public/fileadmin/', - 'public/typo3temp/', + '/{{typo3/public_dir}}/assets', + '/{{typo3/public_dir}}/fileadmin', + '/{{typo3/public_dir}}/typo3temp', ]; set('deploy:rsync', [ From 6c72f9a0f15f599a75f10d670cf66054e2ca9f1b Mon Sep 17 00:00:00 2001 From: David Bonhagen Date: Thu, 10 Jul 2025 16:53:30 +0200 Subject: [PATCH 13/16] refactor: make shared files configurable --- recipe/typo3.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/recipe/typo3.php b/recipe/typo3.php index bb7c46e9a..c107b461f 100644 --- a/recipe/typo3.php +++ b/recipe/typo3.php @@ -58,10 +58,12 @@ /** * Shared files */ -set('shared_files', [ - 'config/system/settings.php', - '.env', -]); +if (!has('shared_files') || empty(get('shared_files'))) { + set('shared_files', [ + 'config/system/settings.php', + '.env', + ]); +} /** * Writeable directories From b9ccbeb08f0678f9bbdfc108a1753a419b0d638e Mon Sep 17 00:00:00 2001 From: David Bonhagen Date: Thu, 10 Jul 2025 16:53:52 +0200 Subject: [PATCH 14/16] refactor: extend cache flush --- recipe/typo3.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/recipe/typo3.php b/recipe/typo3.php index c107b461f..dbdf64cce 100644 --- a/recipe/typo3.php +++ b/recipe/typo3.php @@ -129,16 +129,17 @@ 'timeout' => 600, ]); + +desc('TYPO3 - Clear all caches'); +task('typo3:cache:flush', function () { + run('{{bin/php}} {{release_path}}/public/typo3 cache:flush '); +}); + desc('TYPO3 - Cache warmup for system caches'); task('typo3:cache:warmup', function () { run('{{bin/php}} {{release_path}}/public/typo3 cache:warmup --group system'); }); -desc('TYPO3 - Cache clearing for frontend caches'); -task('typo3:cache:flush', function () { - run('{{bin/php}} {{release_path}}/public/typo3 cache:flush --group pages'); -}); - desc('TYPO3 - Update the language files of all activated extensions'); task('typo3:language:update', function () { run('{{bin/php}} {{release_path}}/public/typo3 language:update'); From e0d7c01a63d4330a0c4de39783cb096c6e8fdd0b Mon Sep 17 00:00:00 2001 From: David Bonhagen Date: Thu, 10 Jul 2025 16:55:28 +0200 Subject: [PATCH 15/16] refactor: reduce shared files --- recipe/typo3.php | 1 - 1 file changed, 1 deletion(-) diff --git a/recipe/typo3.php b/recipe/typo3.php index dbdf64cce..b4f2895af 100644 --- a/recipe/typo3.php +++ b/recipe/typo3.php @@ -61,7 +61,6 @@ if (!has('shared_files') || empty(get('shared_files'))) { set('shared_files', [ 'config/system/settings.php', - '.env', ]); } From 0aa09b23d1472c7a9f6991b60f16a2f7ce0b1c68 Mon Sep 17 00:00:00 2001 From: David Bonhagen Date: Thu, 10 Jul 2025 17:08:29 +0200 Subject: [PATCH 16/16] fix: revert rsync task renaming --- recipe/typo3.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipe/typo3.php b/recipe/typo3.php index b4f2895af..5da2c3cda 100644 --- a/recipe/typo3.php +++ b/recipe/typo3.php @@ -88,7 +88,7 @@ set('use_rsync', false); set('update_code_task', function () { - return get('use_rsync') ? 'deploy:rsync' : 'deploy:update_code'; + return get('use_rsync') ? 'rsync' : 'deploy:update_code'; }); task('typo3:update_code', function () { @@ -115,7 +115,7 @@ '/{{typo3/public_dir}}/typo3temp', ]; -set('deploy:rsync', [ +set('rsync', [ 'exclude' => array_merge(get('shared_dirs'), get('shared_files'), $exclude), 'exclude-file' => false, 'include' => ['vendor'],