From 72a3d842b22b15a133eeb7dd9b4277574049ac15 Mon Sep 17 00:00:00 2001 From: Vladimir Pak Date: Thu, 15 May 2025 19:21:59 +0300 Subject: [PATCH 01/15] Rsync does not check emptyness of "became" option (#4074) https://github.com/deployphp/deployer/discussions/4073 --- src/Utility/Rsync.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Utility/Rsync.php b/src/Utility/Rsync.php index a905e2170..3bd4ae31c 100644 --- a/src/Utility/Rsync.php +++ b/src/Utility/Rsync.php @@ -67,7 +67,7 @@ public function call(Host $host, $source, string $destination, array $config = [ if ($connectionOptions !== '') { $options = array_merge($options, ['-e', "ssh $connectionOptions"]); } - if ($host->has("become")) { + if ($host->has('become') && !empty($host->get('become'))) { $options = array_merge($options, ['--rsync-path', "sudo -H -u {$host->get('become')} rsync"]); } if (!is_array($source)) { From ca4b29551e3e4f2997eff4f600eb4a4d64f0e480 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20M=C3=BCller?= <25648755+M-arcus@users.noreply.github.com> Date: Wed, 4 Jun 2025 11:11:35 +0200 Subject: [PATCH 02/15] Avoid setting JWT file permissions if the directory does not exist (#4077) --- docs/recipe/shopware.md | 10 +++++----- recipe/shopware.php | 3 +++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/docs/recipe/shopware.md b/docs/recipe/shopware.md index 4b0deb4ea..8f0e07db3 100644 --- a/docs/recipe/shopware.md +++ b/docs/recipe/shopware.md @@ -256,7 +256,7 @@ to build the theme remotely instead of locally. ### sw\:deploy {#sw-deploy} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L145) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L148) @@ -274,7 +274,7 @@ This task is group task which contains next tasks: ### deploy {#deploy} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L156) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L159) Deploys your project. @@ -291,7 +291,7 @@ This task is group task which contains next tasks: ### sw-build-without-db\:get-remote-config {#sw-build-without-db-get-remote-config} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L175) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L178) @@ -299,7 +299,7 @@ This task is group task which contains next tasks: ### sw-build-without-db\:build {#sw-build-without-db-build} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L188) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L191) @@ -307,7 +307,7 @@ This task is group task which contains next tasks: ### sw-build-without-db {#sw-build-without-db} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L192) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L195) diff --git a/recipe/shopware.php b/recipe/shopware.php index 393b6826b..827a6455c 100644 --- a/recipe/shopware.php +++ b/recipe/shopware.php @@ -136,6 +136,9 @@ function getPlugins(): array }); task('sw:writable:jwt', static function () { + if (!test('[ -d {{deploy_path}}/config/jwt/ ]')) { + return; + } run('cd {{release_path}} && chmod -R 660 config/jwt/*'); }); From 3fa0a7cf7e8904aba709036edba55aaf2318ab9d Mon Sep 17 00:00:00 2001 From: MHD Date: Wed, 4 Jun 2025 14:13:36 +0100 Subject: [PATCH 03/15] Add missing horizon tasks (#4078) * Add missing horizon tasks * Update laravel.php * Update laravel.php * format * Generate docs * Fix formatting * Add docs --- docs/recipe/laravel.md | 54 ++++++++++++++++++++++++++++++------------ recipe/laravel.php | 9 +++++++ 2 files changed, 48 insertions(+), 15 deletions(-) diff --git a/docs/recipe/laravel.md b/docs/recipe/laravel.md index ea64ac9a5..71b951527 100644 --- a/docs/recipe/laravel.md +++ b/docs/recipe/laravel.md @@ -428,8 +428,32 @@ Publish all of the Horizon resources. +### artisan\:horizon\:supervisors {#artisan-horizon-supervisors} +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L212) + +Lists all of the supervisors. + + + + +### artisan\:horizon\:clear-metrics {#artisan-horizon-clear-metrics} +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L215) + +Deletes metrics for all jobs and queues. + + + + +### artisan\:horizon\:snapshot {#artisan-horizon-snapshot} +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L218) + +Stores a snapshot of the queue metrics. + + + + ### artisan\:schedule\:interrupt {#artisan-schedule-interrupt} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L216) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L225) Interrupt in-progress schedule:run invocations. @@ -437,7 +461,7 @@ Scheduler. ### artisan\:telescope\:clear {#artisan-telescope-clear} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L223) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L232) Clears all entries from Telescope. @@ -445,7 +469,7 @@ Telescope. ### artisan\:telescope\:prune {#artisan-telescope-prune} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L226) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L235) Prunes stale entries from the Telescope database. @@ -453,7 +477,7 @@ Prunes stale entries from the Telescope database. ### artisan\:octane {#artisan-octane} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L233) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L242) Starts the octane server. @@ -461,7 +485,7 @@ Octane. ### artisan\:octane\:reload {#artisan-octane-reload} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L236) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L245) Reloads the octane server. @@ -469,7 +493,7 @@ Reloads the octane server. ### artisan\:octane\:stop {#artisan-octane-stop} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L239) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L248) Stops the octane server. @@ -477,7 +501,7 @@ Stops the octane server. ### artisan\:octane\:status {#artisan-octane-status} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L242) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L251) Check the status of the octane server. @@ -485,7 +509,7 @@ Check the status of the octane server. ### artisan\:nova\:publish {#artisan-nova-publish} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L249) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L258) Publish all of the Laravel Nova resources. @@ -493,7 +517,7 @@ Nova. ### artisan\:reverb\:start {#artisan-reverb-start} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L256) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L265) Starts the Reverb server. @@ -501,7 +525,7 @@ Reverb. ### artisan\:reverb\:restart {#artisan-reverb-restart} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L259) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L268) Restarts the Reverb server. @@ -509,7 +533,7 @@ Restarts the Reverb server. ### artisan\:pulse\:check {#artisan-pulse-check} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L266) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L275) Starts the Pulse server. @@ -517,7 +541,7 @@ Pulse. ### artisan\:pulse\:restart {#artisan-pulse-restart} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L269) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L278) Restarts the Pulse server. @@ -525,7 +549,7 @@ Restarts the Pulse server. ### artisan\:pulse\:purge {#artisan-pulse-purge} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L272) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L281) Purges all Pulse data from storage. @@ -533,7 +557,7 @@ Purges all Pulse data from storage. ### artisan\:pulse\:work {#artisan-pulse-work} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L275) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L284) Process incoming Pulse data from the ingest stream. @@ -541,7 +565,7 @@ Process incoming Pulse data from the ingest stream. ### deploy {#deploy} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L281) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L290) Deploys your project. diff --git a/recipe/laravel.php b/recipe/laravel.php index 6e69c4502..2e2e45a81 100644 --- a/recipe/laravel.php +++ b/recipe/laravel.php @@ -208,6 +208,15 @@ function laravel_version_compare($version, $comparator) desc('Publish all of the Horizon resources'); task('artisan:horizon:publish', artisan('horizon:publish')); +desc('Lists all of the supervisors'); +task('artisan:horizon:supervisors', artisan('horizon:supervisors', ['showOutput'])); + +desc('Deletes metrics for all jobs and queues'); +task('artisan:horizon:clear-metrics', artisan('horizon:clear-metrics')); + +desc('Stores a snapshot of the queue metrics'); +task('artisan:horizon:snapshot', artisan('horizon:snapshot')); + /* * Scheduler. */ From 8bebebd291c4d6941660a22d07cd8b9670798842 Mon Sep 17 00:00:00 2001 From: Sam James Date: Mon, 23 Jun 2025 06:18:14 +0100 Subject: [PATCH 04/15] fix: reloading PHP-FPM links (#4088) --- contrib/php-fpm.php | 4 ++-- docs/contrib/php-fpm.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/contrib/php-fpm.php b/contrib/php-fpm.php index da6899d94..cd4fd7d94 100644 --- a/contrib/php-fpm.php +++ b/contrib/php-fpm.php @@ -5,7 +5,7 @@ Do **not** reload php-fpm. Some user requests could fail or not complete in the process of reloading. -Instead, configure your server [properly](https://ï.at/avoid-php-fpm-reloading). If you're using Deployer's provision +Instead, configure your server [properly](avoid-php-fpm-reloading). If you're using Deployer's provision recipe, it's already configured the right way and no php-fpm reload is needed. ::: @@ -40,6 +40,6 @@ desc('Reloads the php-fpm service'); task('php-fpm:reload', function () { - warning('Avoid reloading php-fpm [ï.at/avoid-php-fpm-reloading]'); + warning('Avoid reloading php-fpm [deployer.org/docs/8.x/avoid-php-fpm-reloading]'); run('sudo systemctl reload {{php_fpm_service}}'); }); diff --git a/docs/contrib/php-fpm.md b/docs/contrib/php-fpm.md index 6630f6c6d..7f4c9f48b 100644 --- a/docs/contrib/php-fpm.md +++ b/docs/contrib/php-fpm.md @@ -15,7 +15,7 @@ require 'contrib/php-fpm.php'; :::caution Do **not** reload php-fpm. Some user requests could fail or not complete in the process of reloading. -Instead, configure your server [properly](https://ï.at/avoid-php-fpm-reloading). If you're using Deployer's provision +Instead, configure your server [properly](avoid-php-fpm-reloading). If you're using Deployer's provision recipe, it's already configured the right way and no php-fpm reload is needed. ::: ## Configuration @@ -39,7 +39,7 @@ after('deploy', 'php-fpm:reload'); :::caution Do **not** reload php-fpm. Some user requests could fail or not complete in the process of reloading. -Instead, configure your server [properly](https://ï.at/avoid-php-fpm-reloading). If you're using Deployer's provision +Instead, configure your server [properly](avoid-php-fpm-reloading). If you're using Deployer's provision recipe, it's already configured the right way and no php-fpm reload is needed. ::: ## Configuration From 8576688837a6e43ddd36e3cc6be9ac420595b199 Mon Sep 17 00:00:00 2001 From: Wanne Van Camp <3399877+wannevancamp@users.noreply.github.com> Date: Wed, 25 Jun 2025 10:31:03 +0200 Subject: [PATCH 05/15] Update shopware.php (#4090) --- recipe/shopware.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/recipe/shopware.php b/recipe/shopware.php index 827a6455c..5f901b25f 100644 --- a/recipe/shopware.php +++ b/recipe/shopware.php @@ -12,8 +12,8 @@ * ```php * host('SSH-HOSTNAME') * ->set('remote_user', 'SSH-USER') - * ->set('deploy_path', '/var/www/shopware') // This is the path, where deployer will create its directory structure - * ->set('http_user', 'www-data') // Not needed, if the `user` is the same user, the webserver is running with + * ->set('deploy_path', '/var/www/shopware') // This is the path where deployer will create its directory structure + * ->set('http_user', 'www-data') // Not needed, if the `user` is the same, the web server is running with * ->set('http_group', 'www-data') * ->set('writable_mode', 'chmod') * ->set('writable_recursive', true) @@ -50,6 +50,7 @@ 'files', 'var/log', 'public/media', + 'public/plugins' 'public/thumbnail', 'public/sitemap', ]); @@ -65,13 +66,14 @@ 'public/fonts', 'public/js', 'public/media', + 'public/plugins' 'public/sitemap', 'public/theme', 'public/thumbnail', 'var', ]); -// This sets the shopware version to the version of the shopware console command. +// This sets the Shopware version to the version of the Shopware console command. set('shopware_version', function () { $versionOutput = run('cd {{release_path}} && {{bin/console}} -V'); preg_match('/(\d+\.\d+\.\d+\.\d+)/', $versionOutput, $matches); @@ -111,7 +113,7 @@ run('cd {{release_path}} && {{bin/console}} theme:refresh'); }); -// This task is not used per default, but can be used, e.g. in combination with `SHOPWARE_SKIP_THEME_COMPILE=1`, +// This task is not used by default, but can be used, e.g. in combination with `SHOPWARE_SKIP_THEME_COMPILE=1`, // to build the theme remotely instead of locally. task('sw:theme:compile', function () { run('cd {{release_path}} && {{bin/console}} theme:compile'); From 8bdd5875a2d222238904884ba007d8d8e5ca28d5 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 25 Jun 2025 08:31:26 +0000 Subject: [PATCH 06/15] [automatic] Update docs with bin/docgen --- docs/recipe/shopware.md | 42 +++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/docs/recipe/shopware.md b/docs/recipe/shopware.md index 8f0e07db3..24f61e8d3 100644 --- a/docs/recipe/shopware.md +++ b/docs/recipe/shopware.md @@ -70,8 +70,8 @@ configure host: ```php host('SSH-HOSTNAME') ->set('remote_user', 'SSH-USER') - ->set('deploy_path', '/var/www/shopware') // This is the path, where deployer will create its directory structure - ->set('http_user', 'www-data') // Not needed, if the `user` is the same user, the webserver is running with + ->set('deploy_path', '/var/www/shopware') // This is the path where deployer will create its directory structure + ->set('http_user', 'www-data') // Not needed, if the `user` is the same, the web server is running with ->set('http_group', 'www-data') ->set('writable_mode', 'chmod') ->set('writable_recursive', true) @@ -134,6 +134,7 @@ These directories are shared among all releases. 'files', 'var/log', 'public/media', + 'public/plugins' 'public/thumbnail', 'public/sitemap', ] @@ -141,7 +142,7 @@ These directories are shared among all releases. ### writable_dirs -[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L59) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L60) Overrides [writable_dirs](/docs/recipe/deploy/writable.md#writable_dirs) from `recipe/deploy/writable.php`. @@ -158,6 +159,7 @@ Please note that the files in `config/jwt/*` receive special attention in the `s 'public/fonts', 'public/js', 'public/media', + 'public/plugins' 'public/sitemap', 'public/theme', 'public/thumbnail', @@ -167,9 +169,9 @@ Please note that the files in `config/jwt/*` receive special attention in the `s ### shopware_version -[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L75) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L77) -This sets the shopware version to the version of the shopware console command. +This sets the Shopware version to the version of the Shopware console command. ```php title="Default value" $versionOutput = run('cd {{release_path}} && {{bin/console}} -V'); @@ -182,7 +184,7 @@ return $matches[0] ?? '6.6.0'; ## Tasks ### sw\:cache\:clear {#sw-cache-clear} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L82) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L84) @@ -190,7 +192,7 @@ This task remotely executes the `cache:clear` console command on the target serv ### sw\:cache\:warmup {#sw-cache-warmup} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L88) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L90) @@ -199,7 +201,7 @@ visits the website, doesn't have to wait for the cache to be built up. ### sw\:database\:migrate {#sw-database-migrate} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L98) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L100) @@ -207,7 +209,7 @@ This task remotely executes the `database:migrate` console command on the target ### sw\:plugin\:refresh {#sw-plugin-refresh} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L102) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L104) @@ -215,7 +217,7 @@ This task remotely executes the `database:migrate` console command on the target ### sw\:scheduled-task\:register {#sw-scheduled-task-register} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L106) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L108) @@ -223,7 +225,7 @@ This task remotely executes the `database:migrate` console command on the target ### sw\:theme\:refresh {#sw-theme-refresh} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L110) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L112) @@ -231,16 +233,16 @@ This task remotely executes the `database:migrate` console command on the target ### sw\:theme\:compile {#sw-theme-compile} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L116) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L118) -This task is not used per default, but can be used, e.g. in combination with `SHOPWARE_SKIP_THEME_COMPILE=1`, +This task is not used by default, but can be used, e.g. in combination with `SHOPWARE_SKIP_THEME_COMPILE=1`, to build the theme remotely instead of locally. ### sw\:plugin\:update\:all {#sw-plugin-update-all} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L128) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L130) @@ -248,7 +250,7 @@ to build the theme remotely instead of locally. ### sw\:writable\:jwt {#sw-writable-jwt} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L138) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L140) @@ -256,7 +258,7 @@ to build the theme remotely instead of locally. ### sw\:deploy {#sw-deploy} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L148) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L150) @@ -274,7 +276,7 @@ This task is group task which contains next tasks: ### deploy {#deploy} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L159) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L161) Deploys your project. @@ -291,7 +293,7 @@ This task is group task which contains next tasks: ### sw-build-without-db\:get-remote-config {#sw-build-without-db-get-remote-config} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L178) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L180) @@ -299,7 +301,7 @@ This task is group task which contains next tasks: ### sw-build-without-db\:build {#sw-build-without-db-build} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L191) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L193) @@ -307,7 +309,7 @@ This task is group task which contains next tasks: ### sw-build-without-db {#sw-build-without-db} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L195) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L197) From ac46152a5fe1c057728192a083ed396ec47cc5e6 Mon Sep 17 00:00:00 2001 From: aladei-dean-lucassen Date: Wed, 25 Jun 2025 10:52:58 +0200 Subject: [PATCH 07/15] Bugfix dotenv test in laravel.php (#4082) * Bugfix dotenv test in laravel.php The test to check if .env file is present was not checking if the dotenv variable was set and always used the default. Added getter for dotenv variable. * change current_path to release_or_current_path in dotenv description Change instructions for set dotenv to use release_or_current_path variable. * change current_path to release_or_current_path in dotenv description Change instructions for set dotenv to use release_or_current_path variable. * Revert "Merge branch 'master' into patch-1" This reverts commit df230dbb5489867715de9b29b8f1ece59cf41447, reversing changes made to 8a92805f6b0eef6a51df6b6bf06711c3ea5922b5. --- recipe/common.php | 2 +- recipe/laravel.php | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/recipe/common.php b/recipe/common.php index ae1eb88ea..be12d04d6 100644 --- a/recipe/common.php +++ b/recipe/common.php @@ -81,7 +81,7 @@ * Path to `.env` file which will be used as environment variables for each command per `run()`. * * ```php - * set('dotenv', '{{current_path}}/.env'); + * set('dotenv', '{{release_or_current_path}}/.env'); * ``` */ set('dotenv', false); diff --git a/recipe/laravel.php b/recipe/laravel.php index 2e2e45a81..d23b32a5a 100644 --- a/recipe/laravel.php +++ b/recipe/laravel.php @@ -58,12 +58,15 @@ function artisan($command, $options = []) return; } + // Get the dotenv path or use default. + $dotenv = get('dotenv', '{{release_or_current_path}}/.env'); + // Ensure we warn or fail when a command relies on the ".env" file. - if (in_array('failIfNoEnv', $options) && !test('[ -s {{release_or_current_path}}/.env ]')) { + if (in_array('failIfNoEnv', $options) && !test("[ -s $dotenv ]")) { throw new \Exception('Your .env file is empty! Cannot proceed.'); } - if (in_array('skipIfNoEnv', $options) && !test('[ -s {{release_or_current_path}}/.env ]')) { + if (in_array('skipIfNoEnv', $options) && !test("[ -s $dotenv ]")) { warning("Your .env file is empty! Skipping..."); return; } From 8b5482ab8c8657a2a02e6a86beff8f9f7f61a90f Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 25 Jun 2025 08:53:23 +0000 Subject: [PATCH 08/15] [automatic] Update docs with bin/docgen --- docs/recipe/common.md | 2 +- docs/recipe/laravel.md | 106 ++++++++++++++++++++--------------------- 2 files changed, 54 insertions(+), 54 deletions(-) diff --git a/docs/recipe/common.md b/docs/recipe/common.md index db55d7e10..a51c16d6c 100644 --- a/docs/recipe/common.md +++ b/docs/recipe/common.md @@ -96,7 +96,7 @@ run('echo $KEY', env: ['KEY' => 'over']); Path to `.env` file which will be used as environment variables for each command per `run()`. ```php -set('dotenv', '{{current_path}}/.env'); +set('dotenv', '{{release_or_current_path}}/.env'); ``` ```php title="Default value" diff --git a/docs/recipe/laravel.md b/docs/recipe/laravel.md index 71b951527..baeabd7fb 100644 --- a/docs/recipe/laravel.md +++ b/docs/recipe/laravel.md @@ -149,7 +149,7 @@ Overrides [public_path](/docs/recipe/provision/website.md#public_path) from `rec ## Tasks ### artisan\:down {#artisan-down} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L91) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L94) Puts the application into maintenance / demo mode. @@ -157,7 +157,7 @@ Maintenance mode. ### artisan\:up {#artisan-up} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L94) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L97) Brings the application out of maintenance mode. @@ -165,7 +165,7 @@ Brings the application out of maintenance mode. ### artisan\:key\:generate {#artisan-key-generate} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L101) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L104) Sets the application key. @@ -173,7 +173,7 @@ Generate keys. ### artisan\:passport\:keys {#artisan-passport-keys} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L104) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L107) Creates the encryption keys for API authentication. @@ -181,7 +181,7 @@ Creates the encryption keys for API authentication. ### artisan\:db\:seed {#artisan-db-seed} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L111) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L114) Seeds the database with records. @@ -189,7 +189,7 @@ Database and migrations. ### artisan\:migrate {#artisan-migrate} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L114) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L117) Runs the database migrations. @@ -197,7 +197,7 @@ Runs the database migrations. ### artisan\:migrate\:fresh {#artisan-migrate-fresh} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L117) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L120) Drops all tables and re-run all migrations. @@ -205,7 +205,7 @@ Drops all tables and re-run all migrations. ### artisan\:migrate\:rollback {#artisan-migrate-rollback} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L120) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L123) Rollbacks the last database migration. @@ -213,7 +213,7 @@ Rollbacks the last database migration. ### artisan\:migrate\:status {#artisan-migrate-status} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L123) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L126) Shows the status of each migration. @@ -221,7 +221,7 @@ Shows the status of each migration. ### artisan\:cache\:clear {#artisan-cache-clear} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L130) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L133) Flushes the application cache. @@ -229,7 +229,7 @@ Cache and optimizations. ### artisan\:config\:cache {#artisan-config-cache} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L133) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L136) Creates a cache file for faster configuration loading. @@ -237,7 +237,7 @@ Creates a cache file for faster configuration loading. ### artisan\:config\:clear {#artisan-config-clear} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L136) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L139) Removes the configuration cache file. @@ -245,7 +245,7 @@ Removes the configuration cache file. ### artisan\:event\:cache {#artisan-event-cache} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L139) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L142) Discovers and cache the application\'s events and listeners. @@ -253,7 +253,7 @@ Discovers and cache the application\'s events and listeners. ### artisan\:event\:clear {#artisan-event-clear} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L142) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L145) Clears all cached events and listeners. @@ -261,7 +261,7 @@ Clears all cached events and listeners. ### artisan\:event\:list {#artisan-event-list} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L145) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L148) Lists the application\'s events and listeners. @@ -269,7 +269,7 @@ Lists the application\'s events and listeners. ### artisan\:optimize {#artisan-optimize} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L148) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L151) Cache the framework bootstrap files. @@ -277,7 +277,7 @@ Cache the framework bootstrap files. ### artisan\:optimize\:clear {#artisan-optimize-clear} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L151) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L154) Removes the cached bootstrap files. @@ -285,7 +285,7 @@ Removes the cached bootstrap files. ### artisan\:route\:cache {#artisan-route-cache} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L154) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L157) Creates a route cache file for faster route registration. @@ -293,7 +293,7 @@ Creates a route cache file for faster route registration. ### artisan\:route\:clear {#artisan-route-clear} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L157) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L160) Removes the route cache file. @@ -301,7 +301,7 @@ Removes the route cache file. ### artisan\:route\:list {#artisan-route-list} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L160) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L163) Lists all registered routes. @@ -309,7 +309,7 @@ Lists all registered routes. ### artisan\:storage\:link {#artisan-storage-link} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L163) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L166) Creates the symbolic links configured for the application. @@ -317,7 +317,7 @@ Creates the symbolic links configured for the application. ### artisan\:view\:cache {#artisan-view-cache} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L166) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L169) Compiles all of the application\'s Blade templates. @@ -325,7 +325,7 @@ Compiles all of the application\'s Blade templates. ### artisan\:view\:clear {#artisan-view-clear} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L169) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L172) Clears all compiled view files. @@ -333,7 +333,7 @@ Clears all compiled view files. ### artisan\:queue\:failed {#artisan-queue-failed} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L176) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L179) Lists all of the failed queue jobs. @@ -341,7 +341,7 @@ Queue and Horizon. ### artisan\:queue\:flush {#artisan-queue-flush} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L179) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L182) Flushes all of the failed queue jobs. @@ -349,7 +349,7 @@ Flushes all of the failed queue jobs. ### artisan\:queue\:restart {#artisan-queue-restart} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L182) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L185) Restarts queue worker daemons after their current job. @@ -357,7 +357,7 @@ Restarts queue worker daemons after their current job. ### artisan\:horizon {#artisan-horizon} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L185) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L188) Starts a master supervisor in the foreground. @@ -365,7 +365,7 @@ Starts a master supervisor in the foreground. ### artisan\:horizon\:clear {#artisan-horizon-clear} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L188) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L191) Deletes all of the jobs from the specified queue. @@ -373,7 +373,7 @@ Deletes all of the jobs from the specified queue. ### artisan\:horizon\:continue {#artisan-horizon-continue} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L191) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L194) Instructs the master supervisor to continue processing jobs. @@ -381,7 +381,7 @@ Instructs the master supervisor to continue processing jobs. ### artisan\:horizon\:list {#artisan-horizon-list} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L194) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L197) Lists all of the deployed machines. @@ -389,7 +389,7 @@ Lists all of the deployed machines. ### artisan\:horizon\:pause {#artisan-horizon-pause} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L197) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L200) Pauses the master supervisor. @@ -397,7 +397,7 @@ Pauses the master supervisor. ### artisan\:horizon\:purge {#artisan-horizon-purge} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L200) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L203) Terminates any rogue Horizon processes. @@ -405,7 +405,7 @@ Terminates any rogue Horizon processes. ### artisan\:horizon\:status {#artisan-horizon-status} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L203) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L206) Gets the current status of Horizon. @@ -413,7 +413,7 @@ Gets the current status of Horizon. ### artisan\:horizon\:terminate {#artisan-horizon-terminate} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L206) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L209) Terminates the master supervisor so it can be restarted. @@ -421,7 +421,7 @@ Terminates the master supervisor so it can be restarted. ### artisan\:horizon\:publish {#artisan-horizon-publish} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L209) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L212) Publish all of the Horizon resources. @@ -429,7 +429,7 @@ Publish all of the Horizon resources. ### artisan\:horizon\:supervisors {#artisan-horizon-supervisors} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L212) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L215) Lists all of the supervisors. @@ -437,7 +437,7 @@ Lists all of the supervisors. ### artisan\:horizon\:clear-metrics {#artisan-horizon-clear-metrics} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L215) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L218) Deletes metrics for all jobs and queues. @@ -445,7 +445,7 @@ Deletes metrics for all jobs and queues. ### artisan\:horizon\:snapshot {#artisan-horizon-snapshot} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L218) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L221) Stores a snapshot of the queue metrics. @@ -453,7 +453,7 @@ Stores a snapshot of the queue metrics. ### artisan\:schedule\:interrupt {#artisan-schedule-interrupt} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L225) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L228) Interrupt in-progress schedule:run invocations. @@ -461,7 +461,7 @@ Scheduler. ### artisan\:telescope\:clear {#artisan-telescope-clear} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L232) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L235) Clears all entries from Telescope. @@ -469,7 +469,7 @@ Telescope. ### artisan\:telescope\:prune {#artisan-telescope-prune} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L235) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L238) Prunes stale entries from the Telescope database. @@ -477,7 +477,7 @@ Prunes stale entries from the Telescope database. ### artisan\:octane {#artisan-octane} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L242) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L245) Starts the octane server. @@ -485,7 +485,7 @@ Octane. ### artisan\:octane\:reload {#artisan-octane-reload} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L245) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L248) Reloads the octane server. @@ -493,7 +493,7 @@ Reloads the octane server. ### artisan\:octane\:stop {#artisan-octane-stop} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L248) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L251) Stops the octane server. @@ -501,7 +501,7 @@ Stops the octane server. ### artisan\:octane\:status {#artisan-octane-status} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L251) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L254) Check the status of the octane server. @@ -509,7 +509,7 @@ Check the status of the octane server. ### artisan\:nova\:publish {#artisan-nova-publish} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L258) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L261) Publish all of the Laravel Nova resources. @@ -517,7 +517,7 @@ Nova. ### artisan\:reverb\:start {#artisan-reverb-start} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L265) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L268) Starts the Reverb server. @@ -525,7 +525,7 @@ Reverb. ### artisan\:reverb\:restart {#artisan-reverb-restart} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L268) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L271) Restarts the Reverb server. @@ -533,7 +533,7 @@ Restarts the Reverb server. ### artisan\:pulse\:check {#artisan-pulse-check} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L275) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L278) Starts the Pulse server. @@ -541,7 +541,7 @@ Pulse. ### artisan\:pulse\:restart {#artisan-pulse-restart} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L278) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L281) Restarts the Pulse server. @@ -549,7 +549,7 @@ Restarts the Pulse server. ### artisan\:pulse\:purge {#artisan-pulse-purge} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L281) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L284) Purges all Pulse data from storage. @@ -557,7 +557,7 @@ Purges all Pulse data from storage. ### artisan\:pulse\:work {#artisan-pulse-work} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L284) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L287) Process incoming Pulse data from the ingest stream. @@ -565,7 +565,7 @@ Process incoming Pulse data from the ingest stream. ### deploy {#deploy} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L290) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L293) Deploys your project. From 169ca3cffb1f2934799e26ce3cd0c88a335f5141 Mon Sep 17 00:00:00 2001 From: Anton Medvedev Date: Tue, 1 Jul 2025 14:54:04 +0200 Subject: [PATCH 09/15] Fix showware.php --- recipe/shopware.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipe/shopware.php b/recipe/shopware.php index 5f901b25f..ae03c8e4d 100644 --- a/recipe/shopware.php +++ b/recipe/shopware.php @@ -50,7 +50,7 @@ 'files', 'var/log', 'public/media', - 'public/plugins' + 'public/plugins', 'public/thumbnail', 'public/sitemap', ]); @@ -66,7 +66,7 @@ 'public/fonts', 'public/js', 'public/media', - 'public/plugins' + 'public/plugins', 'public/sitemap', 'public/theme', 'public/thumbnail', From 946bf0762126fea736fa92147044b86f3073f31b Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 1 Jul 2025 12:54:21 +0000 Subject: [PATCH 10/15] [automatic] Update docs with bin/docgen --- docs/recipe/shopware.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/recipe/shopware.md b/docs/recipe/shopware.md index 24f61e8d3..5aee7d60c 100644 --- a/docs/recipe/shopware.md +++ b/docs/recipe/shopware.md @@ -134,7 +134,7 @@ These directories are shared among all releases. 'files', 'var/log', 'public/media', - 'public/plugins' + 'public/plugins', 'public/thumbnail', 'public/sitemap', ] @@ -159,7 +159,7 @@ Please note that the files in `config/jwt/*` receive special attention in the `s 'public/fonts', 'public/js', 'public/media', - 'public/plugins' + 'public/plugins', 'public/sitemap', 'public/theme', 'public/thumbnail', From 30742fc95e446fc164fb24aa7bf6ad8e610f1b70 Mon Sep 17 00:00:00 2001 From: Gregor Harlan Date: Tue, 1 Jul 2025 16:19:56 +0200 Subject: [PATCH 11/15] Fix command options mode (InputOption::VALUE_REQUIRED) (#4091) --- src/Command/ConfigCommand.php | 2 +- src/Command/InitCommand.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Command/ConfigCommand.php b/src/Command/ConfigCommand.php index 6db5624fb..aebb3a244 100644 --- a/src/Command/ConfigCommand.php +++ b/src/Command/ConfigCommand.php @@ -30,7 +30,7 @@ public function __construct(Deployer $deployer) protected function configure() { parent::configure(); - $this->addOption('format', null, InputOption::VALUE_OPTIONAL, 'The output format (json, yaml)', 'yaml'); + $this->addOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (json, yaml)', 'yaml'); $this->getDefinition()->getArgument('selector')->setDefault(['all']); } diff --git a/src/Command/InitCommand.php b/src/Command/InitCommand.php index 25643ac2c..d0ee35d18 100644 --- a/src/Command/InitCommand.php +++ b/src/Command/InitCommand.php @@ -28,7 +28,7 @@ protected function configure() $this ->setName('init') ->setDescription('Initialize deployer in your project') - ->addOption('path', 'p', InputOption::VALUE_OPTIONAL, 'Recipe path'); + ->addOption('path', 'p', InputOption::VALUE_REQUIRED, 'Recipe path'); } protected function execute(InputInterface $input, OutputInterface $output): int From 70df6ff12d133e1ade54bc9e6c45cee955415da4 Mon Sep 17 00:00:00 2001 From: David Bonhagen Date: Fri, 11 Jul 2025 10:15:22 +0200 Subject: [PATCH 12/15] Update typo3.php (#4094) * Update typo3.php * Add regenerated docs * refactor: remove tasks to remove * refactor: wrap composer in set config option * refactor: enable user to choose transfer method * chore: regenerated documentation * fix: apply php-cs-fixer * refactor: use absolute path to execute typo3 binary * refactor: remove effectless warm up * refactor: rename public dir and adjust shared / writable dirs * refactor: rename rsync task for more consistency * refactor: adjust exclude list * refactor: make shared files configurable * refactor: extend cache flush * refactor: reduce shared files * fix: revert rsync task renaming --- docs/recipe/typo3.md | 206 +++++++++++++++++++++++++++++++++++++------ recipe/typo3.php | 162 ++++++++++++++++++++++++++++++---- 2 files changed, 322 insertions(+), 46 deletions(-) diff --git a/docs/recipe/typo3.md b/docs/recipe/typo3.md index d1dc48278..b96683cbc 100644 --- a/docs/recipe/typo3.md +++ b/docs/recipe/typo3.md @@ -28,38 +28,71 @@ 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: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 +* [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 -* [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 +* [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); +``` + + ### 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#L17) 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#L30) + +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#L43) + +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) +[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`. @@ -69,13 +102,16 @@ 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) +[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`. @@ -83,13 +119,14 @@ 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) +[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`. @@ -99,8 +136,60 @@ 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#L77) + +Overrides [composer_options](/docs/recipe/deploy/vendors.md#composer_options) from `recipe/deploy/vendors.php`. + +Composer options + +```php title="Default value" +' --no-dev --verbose --prefer-dist --no-progress --no-interaction --optimize-autoloader' +``` + + +### 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, ] ``` @@ -108,17 +197,78 @@ Writeable directories ## 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#L126) + +TYPO3 - Cache warmup for system caches. + + + + +### typo3\:cache\:flush {#typo3-cache-flush} +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L132) + +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#L138) + +TYPO3 - Cache warmup for frontend caches. + + + + +### typo3\:language\:update {#typo3-language-update} +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L144) + +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#L150) + +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#L159) -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: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) +* [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) -* [deploy:publish](/docs/recipe/common.md#deploy-publish) +* [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) diff --git a/recipe/typo3.php b/recipe/typo3.php index ae01a00cf..5da2c3cda 100644 --- a/recipe/typo3.php +++ b/recipe/typo3.php @@ -3,46 +3,172 @@ namespace Deployer; require_once __DIR__ . '/common.php'; +require_once 'contrib/rsync.php'; 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', 'Web'); +set('typo3/public_dir', function () { + $composerConfig = get('composer_config'); + + 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 () { + $composerConfig = get('composer_config'); + + 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 */ set('shared_dirs', [ - '{{typo3_webroot}}/fileadmin', - '{{typo3_webroot}}/typo3temp', - '{{typo3_webroot}}/uploads', + '{{typo3/public_dir}}/fileadmin', + '{{typo3/public_dir}}/assets', + '{{typo3/public_dir}}/typo3temp/assets', + 'var/lock', + 'var/log', + 'var/session', + 'var/spool', ]); /** * Shared files */ -set('shared_files', [ - '{{typo3_webroot}}/.htaccess', -]); +if (!has('shared_files') || empty(get('shared_files'))) { + set('shared_files', [ + 'config/system/settings.php', + ]); +} /** * Writeable directories */ set('writable_dirs', [ - '{{typo3_webroot}}/fileadmin', - '{{typo3_webroot}}/typo3temp', - '{{typo3_webroot}}/typo3conf', - '{{typo3_webroot}}/uploads', + '{{typo3/public_dir}}/fileadmin', + '{{typo3/public_dir}}/assets', + '{{typo3/public_dir}}/typo3temp/assets', + 'var/cache', + 'var/lock', + 'var/log', +]); + +/** + * Composer options + */ +set('composer_options', ' --no-dev --verbose --prefer-dist --no-progress --no-interaction --optimize-autoloader'); + + +/** + * If set in the config this recipe uses rsync. Default: false (use the Git repository) + */ +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/', + '/{{typo3/public_dir}}/assets', + '/{{typo3/public_dir}}/fileadmin', + '/{{typo3/public_dir}}/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 - 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 - Update the language files of all activated extensions'); +task('typo3:language:update', function () { + run('{{bin/php}} {{release_path}}/public/typo3 language:update'); +}); + +desc('TYPO3 - Set up all extensions'); +task('typo3:extension:setup', function () { + run('{{bin/php}} {{release_path}}/public/typo3 extension:setup'); +}); + +/** + * Configure "deploy" task group. + */ +desc('Deploys a TYPO3 project'); +task('deploy', [ + 'deploy:info', + 'deploy:setup', + 'deploy:lock', + 'deploy:release', + 'typo3:update_code', + 'deploy:shared', + 'deploy:writable', + 'deploy:vendors', + 'typo3:cache:warmup', + 'typo3:extension:setup', + 'typo3:language:update', + 'typo3:cache:flush', + 'deploy:unlock', + 'deploy:cleanup', + 'deploy:success', ]); + +after('deploy:failed', 'deploy:unlock'); From 4bc695c959f3b508e3a13058d6ce48ef9fd64105 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 11 Jul 2025 08:15:46 +0000 Subject: [PATCH 13/15] [automatic] Update docs with bin/docgen --- docs/recipe/typo3.md | 75 ++++++++++++++++---------------------------- 1 file changed, 27 insertions(+), 48 deletions(-) diff --git a/docs/recipe/typo3.md b/docs/recipe/typo3.md index b96683cbc..857a6b97f 100644 --- a/docs/recipe/typo3.md +++ b/docs/recipe/typo3.md @@ -39,8 +39,7 @@ The [deploy](#deploy) task of **TYPO3** consists of: * [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 +* [typo3:cache:flush](/docs/recipe/typo3.md#typo3-cache-flush) – TYPO3 - Clear all 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 @@ -59,7 +58,7 @@ return json_decode(file_get_contents('./composer.json'), true, 512, JSON_THROW_O ``` -### typo3_webroot +### typo3/public_dir [Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L17) DocumentRoot / WebRoot for the TYPO3 installation @@ -100,33 +99,19 @@ Shared directories ```php title="Default value" [ - '{{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', -] -``` - - -### shared_files -[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 - -```php title="Default value" -[ - 'config/system/settings.php', - '.env', + 'var/log', + 'var/session', + 'var/spool', ] ``` ### writable_dirs -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L68) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L70) Overrides [writable_dirs](/docs/recipe/deploy/writable.md#writable_dirs) from `recipe/deploy/writable.php`. @@ -134,15 +119,18 @@ Writeable directories ```php title="Default value" [ - '{{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', ] ``` ### composer_options -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L77) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L82) Overrides [composer_options](/docs/recipe/deploy/vendors.md#composer_options) from `recipe/deploy/vendors.php`. @@ -154,7 +142,7 @@ Composer options ### use_rsync -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L83) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L88) If set in the config this recipe uses rsync. Default: false (use the Git repository) @@ -164,7 +152,7 @@ false ### update_code_task -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L85) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L90) @@ -174,7 +162,7 @@ return get('use_rsync') ? 'rsync' : 'deploy:update_code'; ### rsync -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L112) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L118) @@ -198,39 +186,31 @@ return get('use_rsync') ? 'rsync' : 'deploy:update_code'; ## Tasks ### typo3\:update_code {#typo3-update_code} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L89) - - - +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L94) -### typo3\:cache\:warmup {#typo3-cache-warmup} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L126) - -TYPO3 - Cache warmup for system caches. - ### typo3\:cache\:flush {#typo3-cache-flush} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L132) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L133) -TYPO3 - Cache clearing for frontend caches. +TYPO3 - Clear all caches. -### typo3\:cache\:pages\:warmup {#typo3-cache-pages-warmup} +### typo3\:cache\:warmup {#typo3-cache-warmup} [Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L138) -TYPO3 - Cache warmup for frontend caches. +TYPO3 - Cache warmup for system caches. ### typo3\:language\:update {#typo3-language-update} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L144) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L143) TYPO3 - Update the language files of all activated extensions. @@ -238,7 +218,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#L150) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L148) TYPO3 - Set up all extensions. @@ -246,7 +226,7 @@ TYPO3 - Set up all extensions. ### deploy {#deploy} -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L159) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L156) Deploys a TYPO3 project. @@ -266,7 +246,6 @@ This task is group task which contains next tasks: * [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 3d995d9e3ea48bc51b54da77f6eb164e247ee96c Mon Sep 17 00:00:00 2001 From: Brian Freytag Date: Mon, 14 Jul 2025 11:07:26 -0400 Subject: [PATCH 14/15] Allow Continue on Failure (#4098) Since a Teams notification is not necessarily an essential part of a deploy, we should allow users to continue the deploy should a notification fail to send. --- contrib/ms-teams.php | 52 ++++++++++++++++++++++++++++++---------- docs/contrib/ms-teams.md | 14 +++++++++++ 2 files changed, 54 insertions(+), 12 deletions(-) diff --git a/contrib/ms-teams.php b/contrib/ms-teams.php index 4a47b03a7..3c4fbf9e2 100644 --- a/contrib/ms-teams.php +++ b/contrib/ms-teams.php @@ -80,6 +80,9 @@ return get('application', 'Project'); }); +// Allow Continue on Failure +set('teams_failure_continue', false); + // Deploy message set('teams_text', '_{{user}}_ deploying `{{what}}` to *{{where}}*'); set('teams_success_text', 'Deploy to *{{where}}* successful'); @@ -97,10 +100,19 @@ return; } - Httpie::post(get('teams_webhook'))->jsonBody([ - "themeColor" => get('teams_color'), - 'text' => get('teams_text'), - ])->send(); + try { + Httpie::post(get('teams_webhook'))->jsonBody([ + "themeColor" => get('teams_color'), + 'text' => get('teams_text'), + ])->send(); + } catch (\Exception $e) { + if (get('teams_failure_continue', false)) { + warning('Error sending Teams Notification: ' . $e->getMessage()); + } else { + throw $e; + } + } + }) ->once() ->hidden(); @@ -112,10 +124,18 @@ return; } - Httpie::post(get('teams_webhook'))->jsonBody([ - "themeColor" => get('teams_success_color'), - 'text' => get('teams_success_text'), - ])->send(); + try { + Httpie::post(get('teams_webhook'))->jsonBody([ + "themeColor" => get('teams_success_color'), + 'text' => get('teams_success_text'), + ])->send(); + } catch (\Exception $e) { + if (get('teams_failure_continue', false)) { + warning('Error sending Teams Notification: ' . $e->getMessage()); + } else { + throw $e; + } + } }) ->once() ->hidden(); @@ -127,10 +147,18 @@ return; } - Httpie::post(get('teams_webhook'))->jsonBody([ - "themeColor" => get('teams_failure_color'), - 'text' => get('teams_failure_text'), - ])->send(); + try { + Httpie::post(get('teams_webhook'))->jsonBody([ + "themeColor" => get('teams_failure_color'), + 'text' => get('teams_failure_text'), + ])->send(); + } catch (\Exception $e) { + if (get('teams_failure_continue', false)) { + warning('Error sending Teams Notification: ' . $e->getMessage()); + } else { + throw $e; + } + } }) ->once() ->hidden(); diff --git a/docs/contrib/ms-teams.md b/docs/contrib/ms-teams.md index 2704c2f56..a0205d610 100644 --- a/docs/contrib/ms-teams.md +++ b/docs/contrib/ms-teams.md @@ -41,6 +41,10 @@ after('deploy:failed', 'teams:notify:failure'); set('teams_webhook', 'https://outlook.office.com/webhook/...'); ``` - `teams_title` – the title of application, default `{{application}}` +- `teams_failure_continue` - allow deploys to continue on failure + ``` + set('teams_failure_continue', true); + ``` - `teams_text` – notification message template, markdown supported ``` set('teams_text', '_{{user}}_ deploying `{{what}}` to *{{where}}*'); @@ -56,6 +60,7 @@ after('deploy:failed', 'teams:notify:failure'); - `teams_color` – color's attachment - `teams_success_color` – success color's attachment - `teams_failure_color` – failure color's attachment + ## Usage If you want to notify only about beginning of deployment add this line only: ```php @@ -81,6 +86,15 @@ Title of project return get('application', 'Project'); ``` +### teams_failure_continue +[Source](https://github.com/deployphp/deployer/blob/master/contrib/ms-teams.php#L79) + +Allow Continue on Failure + +```php title="Continue on Failure" +return get('teams_failure_continue', false) +``` + ### teams_text [Source](https://github.com/deployphp/deployer/blob/master/contrib/ms-teams.php#L84) From 0ffbaab09d0dc25af25c24e2ef11b34e2a59835f Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 14 Jul 2025 15:07:44 +0000 Subject: [PATCH 15/15] [automatic] Update docs with bin/docgen --- docs/contrib/ms-teams.md | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/docs/contrib/ms-teams.md b/docs/contrib/ms-teams.md index a0205d610..a85cfb5a1 100644 --- a/docs/contrib/ms-teams.md +++ b/docs/contrib/ms-teams.md @@ -41,10 +41,6 @@ after('deploy:failed', 'teams:notify:failure'); set('teams_webhook', 'https://outlook.office.com/webhook/...'); ``` - `teams_title` – the title of application, default `{{application}}` -- `teams_failure_continue` - allow deploys to continue on failure - ``` - set('teams_failure_continue', true); - ``` - `teams_text` – notification message template, markdown supported ``` set('teams_text', '_{{user}}_ deploying `{{what}}` to *{{where}}*'); @@ -60,7 +56,6 @@ after('deploy:failed', 'teams:notify:failure'); - `teams_color` – color's attachment - `teams_success_color` – success color's attachment - `teams_failure_color` – failure color's attachment - ## Usage If you want to notify only about beginning of deployment add this line only: ```php @@ -86,18 +81,19 @@ Title of project return get('application', 'Project'); ``` + ### teams_failure_continue -[Source](https://github.com/deployphp/deployer/blob/master/contrib/ms-teams.php#L79) +[Source](https://github.com/deployphp/deployer/blob/master/contrib/ms-teams.php#L84) Allow Continue on Failure -```php title="Continue on Failure" -return get('teams_failure_continue', false) +```php title="Default value" +false ``` ### teams_text -[Source](https://github.com/deployphp/deployer/blob/master/contrib/ms-teams.php#L84) +[Source](https://github.com/deployphp/deployer/blob/master/contrib/ms-teams.php#L87) Deploy message @@ -107,7 +103,7 @@ Deploy message ### teams_success_text -[Source](https://github.com/deployphp/deployer/blob/master/contrib/ms-teams.php#L85) +[Source](https://github.com/deployphp/deployer/blob/master/contrib/ms-teams.php#L88) @@ -117,7 +113,7 @@ Deploy message ### teams_failure_text -[Source](https://github.com/deployphp/deployer/blob/master/contrib/ms-teams.php#L86) +[Source](https://github.com/deployphp/deployer/blob/master/contrib/ms-teams.php#L89) @@ -127,7 +123,7 @@ Deploy message ### teams_color -[Source](https://github.com/deployphp/deployer/blob/master/contrib/ms-teams.php#L89) +[Source](https://github.com/deployphp/deployer/blob/master/contrib/ms-teams.php#L92) Color of attachment @@ -137,7 +133,7 @@ Color of attachment ### teams_success_color -[Source](https://github.com/deployphp/deployer/blob/master/contrib/ms-teams.php#L90) +[Source](https://github.com/deployphp/deployer/blob/master/contrib/ms-teams.php#L93) @@ -147,7 +143,7 @@ Color of attachment ### teams_failure_color -[Source](https://github.com/deployphp/deployer/blob/master/contrib/ms-teams.php#L91) +[Source](https://github.com/deployphp/deployer/blob/master/contrib/ms-teams.php#L94) @@ -160,7 +156,7 @@ Color of attachment ## Tasks ### teams\:notify {#teams-notify} -[Source](https://github.com/deployphp/deployer/blob/master/contrib/ms-teams.php#L94) +[Source](https://github.com/deployphp/deployer/blob/master/contrib/ms-teams.php#L97) Notifies Teams. @@ -168,7 +164,7 @@ Notifies Teams. ### teams\:notify\:success {#teams-notify-success} -[Source](https://github.com/deployphp/deployer/blob/master/contrib/ms-teams.php#L109) +[Source](https://github.com/deployphp/deployer/blob/master/contrib/ms-teams.php#L121) Notifies Teams about deploy finish. @@ -176,7 +172,7 @@ Notifies Teams about deploy finish. ### teams\:notify\:failure {#teams-notify-failure} -[Source](https://github.com/deployphp/deployer/blob/master/contrib/ms-teams.php#L124) +[Source](https://github.com/deployphp/deployer/blob/master/contrib/ms-teams.php#L144) Notifies Teams about deploy failure.