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/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/ms-teams.md b/docs/contrib/ms-teams.md index 2704c2f56..a85cfb5a1 100644 --- a/docs/contrib/ms-teams.md +++ b/docs/contrib/ms-teams.md @@ -82,9 +82,19 @@ return get('application', 'Project'); ``` -### teams_text +### teams_failure_continue [Source](https://github.com/deployphp/deployer/blob/master/contrib/ms-teams.php#L84) +Allow Continue on Failure + +```php title="Default value" +false +``` + + +### teams_text +[Source](https://github.com/deployphp/deployer/blob/master/contrib/ms-teams.php#L87) + Deploy message ```php title="Default value" @@ -93,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) @@ -103,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) @@ -113,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 @@ -123,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) @@ -133,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) @@ -146,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. @@ -154,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. @@ -162,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. 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 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 ea64ac9a5..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,15 +421,39 @@ 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. +### artisan\:horizon\:supervisors {#artisan-horizon-supervisors} +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L215) + +Lists all of the supervisors. + + + + +### artisan\:horizon\:clear-metrics {#artisan-horizon-clear-metrics} +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L218) + +Deletes metrics for all jobs and queues. + + + + +### artisan\:horizon\:snapshot {#artisan-horizon-snapshot} +[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L221) + +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#L228) 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#L235) 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#L238) 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#L245) 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#L248) 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#L251) 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#L254) 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#L261) 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#L268) 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#L271) 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#L278) 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#L281) 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#L284) 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#L287) 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#L293) Deploys your project. diff --git a/docs/recipe/shopware.md b/docs/recipe/shopware.md index 4b0deb4ea..5aee7d60c 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#L145) +[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#L156) +[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#L175) +[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#L188) +[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#L192) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L197) diff --git a/docs/recipe/typo3.md b/docs/recipe/typo3.md index d1dc48278..857a6b97f 100644 --- a/docs/recipe/typo3.md +++ b/docs/recipe/typo3.md @@ -28,38 +28,70 @@ 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 - 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 The typo3 recipe is based on the [common](/docs/recipe/common.md) recipe. ## Configuration -### typo3_webroot -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L12) +### 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/public_dir +[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`. @@ -67,40 +99,85 @@ Shared directories ```php title="Default value" [ - '{{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 -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L36) +### writable_dirs +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L70) -Overrides [shared_files](/docs/recipe/deploy/shared.md#shared_files) from `recipe/deploy/shared.php`. +Overrides [writable_dirs](/docs/recipe/deploy/writable.md#writable_dirs) from `recipe/deploy/writable.php`. -Shared files +Writeable directories ```php title="Default value" [ - '{{typo3_webroot}}/.htaccess', + '{{typo3/public_dir}}/fileadmin', + '{{typo3/public_dir}}/assets', + '{{typo3/public_dir}}/typo3temp/assets', + 'var/cache', + 'var/lock', + 'var/log', ] ``` -### writable_dirs -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L43) +### composer_options +[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`. + +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#L88) + +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#L90) + + + +```php title="Default value" +return get('use_rsync') ? 'rsync' : 'deploy:update_code'; +``` + + +### rsync +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L118) -Overrides [writable_dirs](/docs/recipe/deploy/writable.md#writable_dirs) from `recipe/deploy/writable.php`. -Writeable directories ```php title="Default value" [ - '{{typo3_webroot}}/fileadmin', - '{{typo3_webroot}}/typo3temp', - '{{typo3_webroot}}/typo3conf', - '{{typo3_webroot}}/uploads', + '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 +185,69 @@ Writeable directories ## Tasks +### typo3\:update_code {#typo3-update_code} +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L94) + + + + + + +### typo3\:cache\:flush {#typo3-cache-flush} +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L133) + +TYPO3 - Clear all caches. + + + + +### typo3\:cache\:warmup {#typo3-cache-warmup} +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L138) + +TYPO3 - Cache warmup for system caches. + + + + +### typo3\:language\:update {#typo3-language-update} +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L143) + +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#L148) + +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#L156) -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) +* [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/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 6e69c4502..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; } @@ -208,6 +211,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. */ diff --git a/recipe/shopware.php b/recipe/shopware.php index 393b6826b..ae03c8e4d 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'); @@ -136,6 +138,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/*'); }); 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'); 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 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)) {