Feature/UI enhancements (#3835)

* Set default `public_path` config for laravel

* Remove config printouts

* Conditionally ask for DB configuration values

* Add confirmation for provision on incompatible OS

* Set default PHP version from composer.json

* Regenerate docs using php bin/docgen
This commit is contained in:
Midhun Monachan 2024-05-21 04:29:11 -04:00 committed by GitHub
parent 5edee95105
commit 6e7bad7929
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 104 additions and 79 deletions

View File

@ -54,7 +54,7 @@ The laravel recipe is based on the [common](/docs/recipe/common.md) recipe.
## Configuration
### shared_dirs
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L8)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L9)
Overrides [shared_dirs](/docs/recipe/deploy/shared.md#shared_dirs) from `recipe/deploy/shared.php`.
@ -66,7 +66,7 @@ Overrides [shared_dirs](/docs/recipe/deploy/shared.md#shared_dirs) from `recipe/
### shared_files
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L9)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L10)
Overrides [shared_files](/docs/recipe/deploy/shared.md#shared_files) from `recipe/deploy/shared.php`.
@ -78,7 +78,7 @@ Overrides [shared_files](/docs/recipe/deploy/shared.md#shared_files) from `recip
### writable_dirs
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L10)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L11)
Overrides [writable_dirs](/docs/recipe/deploy/writable.md#writable_dirs) from `recipe/deploy/writable.php`.
@ -101,7 +101,7 @@ Overrides [writable_dirs](/docs/recipe/deploy/writable.md#writable_dirs) from `r
### log_files
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L22)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L23)
@ -111,7 +111,7 @@ Overrides [writable_dirs](/docs/recipe/deploy/writable.md#writable_dirs) from `r
### laravel_version
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L23)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L24)
@ -122,11 +122,23 @@ return $matches[0][0] ?? 5.5;
```
### public_path
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L29)
Overrides [public_path](/docs/recipe/provision/website.md#public_path) from `recipe/provision/website.php`.
```php title="Default value"
'public'
```
## Tasks
### artisan:down
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L90)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L92)
Puts the application into maintenance / demo mode.
@ -134,7 +146,7 @@ Puts the application into maintenance / demo mode.
### artisan:up
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L93)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L95)
Brings the application out of maintenance mode.
@ -142,7 +154,7 @@ Brings the application out of maintenance mode.
### artisan:​key:generate
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L100)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L102)
Sets the application key.
@ -150,7 +162,7 @@ Sets the application key.
### artisan:passport:keys
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L103)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L105)
Creates the encryption keys for API authentication.
@ -158,7 +170,7 @@ Creates the encryption keys for API authentication.
### artisan:db:seed
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L110)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L112)
Seeds the database with records.
@ -166,7 +178,7 @@ Seeds the database with records.
### artisan:migrate
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L113)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L115)
Runs the database migrations.
@ -174,7 +186,7 @@ Runs the database migrations.
### artisan:migrate:fresh
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L116)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L118)
Drops all tables and re-run all migrations.
@ -182,7 +194,7 @@ Drops all tables and re-run all migrations.
### artisan:migrate:rollback
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L119)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L121)
Rollbacks the last database migration.
@ -190,7 +202,7 @@ Rollbacks the last database migration.
### artisan:migrate:status
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L122)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L124)
Shows the status of each migration.
@ -198,7 +210,7 @@ Shows the status of each migration.
### artisan:cache:clear
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L129)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L131)
Flushes the application cache.
@ -206,7 +218,7 @@ Flushes the application cache.
### artisan:config:cache
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L132)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L134)
Creates a cache file for faster configuration loading.
@ -214,7 +226,7 @@ Creates a cache file for faster configuration loading.
### artisan:config:clear
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L135)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L137)
Removes the configuration cache file.
@ -222,7 +234,7 @@ Removes the configuration cache file.
### artisan:event:cache
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L138)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L140)
Discovers and cache the application\'s events and listeners.
@ -230,7 +242,7 @@ Discovers and cache the application\'s events and listeners.
### artisan:event:clear
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L141)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L143)
Clears all cached events and listeners.
@ -238,7 +250,7 @@ Clears all cached events and listeners.
### artisan:event:list
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L144)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L146)
Lists the application\'s events and listeners.
@ -246,7 +258,7 @@ Lists the application\'s events and listeners.
### artisan:optimize
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L147)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L149)
Cache the framework bootstrap files.
@ -254,7 +266,7 @@ Cache the framework bootstrap files.
### artisan:optimize:clear
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L150)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L152)
Removes the cached bootstrap files.
@ -262,7 +274,7 @@ Removes the cached bootstrap files.
### artisan:route:cache
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L153)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L155)
Creates a route cache file for faster route registration.
@ -270,7 +282,7 @@ Creates a route cache file for faster route registration.
### artisan:route:clear
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L156)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L158)
Removes the route cache file.
@ -278,7 +290,7 @@ Removes the route cache file.
### artisan:route:list
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L159)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L161)
Lists all registered routes.
@ -286,7 +298,7 @@ Lists all registered routes.
### artisan:storage:link
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L162)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L164)
Creates the symbolic links configured for the application.
@ -294,7 +306,7 @@ Creates the symbolic links configured for the application.
### artisan:view:cache
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L165)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L167)
Compiles all of the application\'s Blade templates.
@ -302,7 +314,7 @@ Compiles all of the application\'s Blade templates.
### artisan:view:clear
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L168)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L170)
Clears all compiled view files.
@ -310,7 +322,7 @@ Clears all compiled view files.
### artisan:queue:failed
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L175)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L177)
Lists all of the failed queue jobs.
@ -318,7 +330,7 @@ Lists all of the failed queue jobs.
### artisan:queue:flush
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L178)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L180)
Flushes all of the failed queue jobs.
@ -326,7 +338,7 @@ Flushes all of the failed queue jobs.
### artisan:queue:restart
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L181)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L183)
Restarts queue worker daemons after their current job.
@ -334,7 +346,7 @@ Restarts queue worker daemons after their current job.
### artisan:horizon
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L184)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L186)
Starts a master supervisor in the foreground.
@ -342,7 +354,7 @@ Starts a master supervisor in the foreground.
### artisan:horizon:clear
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L187)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L189)
Deletes all of the jobs from the specified queue.
@ -350,7 +362,7 @@ Deletes all of the jobs from the specified queue.
### artisan:horizon:continue
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L190)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L192)
Instructs the master supervisor to continue processing jobs.
@ -358,7 +370,7 @@ Instructs the master supervisor to continue processing jobs.
### artisan:horizon:list
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L193)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L195)
Lists all of the deployed machines.
@ -366,7 +378,7 @@ Lists all of the deployed machines.
### artisan:horizon:pause
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L196)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L198)
Pauses the master supervisor.
@ -374,7 +386,7 @@ Pauses the master supervisor.
### artisan:horizon:purge
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L199)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L201)
Terminates any rogue Horizon processes.
@ -382,7 +394,7 @@ Terminates any rogue Horizon processes.
### artisan:horizon:status
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L202)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L204)
Gets the current status of Horizon.
@ -390,7 +402,7 @@ Gets the current status of Horizon.
### artisan:horizon:terminate
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L205)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L207)
Terminates the master supervisor so it can be restarted.
@ -398,7 +410,7 @@ Terminates the master supervisor so it can be restarted.
### artisan:horizon:publish
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L208)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L210)
Publish all of the Horizon resources.
@ -406,7 +418,7 @@ Publish all of the Horizon resources.
### artisan:​telescope:clear
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L215)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L217)
Clears all entries from Telescope.
@ -414,7 +426,7 @@ Clears all entries from Telescope.
### artisan:​telescope:prune
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L218)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L220)
Prunes stale entries from the Telescope database.
@ -422,7 +434,7 @@ Prunes stale entries from the Telescope database.
### artisan:octane
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L225)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L227)
Starts the octane server.
@ -430,7 +442,7 @@ Starts the octane server.
### artisan:octane:reload
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L228)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L230)
Reloads the octane server.
@ -438,7 +450,7 @@ Reloads the octane server.
### artisan:octane:stop
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L231)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L233)
Stops the octane server.
@ -446,7 +458,7 @@ Stops the octane server.
### artisan:octane:status
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L234)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L236)
Check the status of the octane server.
@ -454,7 +466,7 @@ Check the status of the octane server.
### artisan:nova:publish
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L241)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L243)
Publish all of the Laravel Nova resources.
@ -462,7 +474,7 @@ Publish all of the Laravel Nova resources.
### artisan:pulse:check
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L248)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L250)
Starts the Pulse server.
@ -470,7 +482,7 @@ Starts the Pulse server.
### artisan:pulse:restart
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L251)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L253)
Restarts the Pulse server.
@ -478,7 +490,7 @@ Restarts the Pulse server.
### artisan:pulse:purge
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L254)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L256)
Purges all Pulse data from storage.
@ -486,7 +498,7 @@ Purges all Pulse data from storage.
### artisan:pulse:work
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L257)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L259)
Process incoming Pulse data from the ingest stream.
@ -494,7 +506,7 @@ Process incoming Pulse data from the ingest stream.
### deploy
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L263)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L265)
Deploys your project.

View File

@ -18,7 +18,7 @@ require 'recipe/provision.php';
## Configuration
### lsb_release
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision.php#L15)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision.php#L16)
Name of lsb_release like: focal, bionic, etc.
As only Ubuntu 20.04 LTS is supported for provision should be the `focal`.
@ -29,7 +29,7 @@ return run("lsb_release -s -c");
### sudo_password
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision.php#L216)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision.php#L221)
@ -39,7 +39,7 @@ return askHiddenResponse(' Password for sudo: ');
### ssh_copy_id
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision.php#L222)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision.php#L227)
Specify which key to copy to server.
Set to `false` to disable copy of key.
@ -53,7 +53,7 @@ Set to `false` to disable copy of key.
## Tasks
### provision
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision.php#L20)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision.php#L21)
Provision the server.
@ -79,7 +79,7 @@ This task is group task which contains next tasks:
### provision:check
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision.php#L39)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision.php#L40)
Checks pre-required state.
@ -87,7 +87,7 @@ Checks pre-required state.
### provision:configure
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision.php#L59)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision.php#L63)
Collects required params.
@ -95,7 +95,7 @@ Collects required params.
### provision:update
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision.php#L82)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision.php#L87)
Adds repositories and update.
@ -103,7 +103,7 @@ Adds repositories and update.
### provision:upgrade
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision.php#L104)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision.php#L109)
Upgrades all packages.
@ -111,7 +111,7 @@ Upgrades all packages.
### provision:install
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision.php#L111)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision.php#L116)
Installs packages.
@ -119,7 +119,7 @@ Installs packages.
### provision:server
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision.php#L145)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision.php#L150)
Configures a server.
@ -127,7 +127,7 @@ Configures a server.
### provision:ssh
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision.php#L206)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision.php#L211)
Configures the ssh.
@ -135,7 +135,7 @@ Configures the ssh.
### provision:deployer
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision.php#L225)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision.php#L230)
Setups a deployer user.
@ -143,7 +143,7 @@ Setups a deployer user.
### provision:firewall
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision.php#L272)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision.php#L277)
Setups a firewall.
@ -151,7 +151,7 @@ Setups a firewall.
### provision:verify
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision.php#L280)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision.php#L285)
Verifies what provision was successful.

View File

@ -13,12 +13,15 @@ require 'recipe/provision/php.php';
## Configuration
### php_version
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision/php.php#L4)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision/php.php#L5)
```php title="Default value"
return ask(' What PHP version to install? ', '8.2', ['5.6', '7.4', '8.0', '8.1', '8.2']);
$defaultphpVersion = file_exists('composer.json')
? explode('|', preg_replace('/[^0-9.|]+/', '', json_decode(file_get_contents('composer.json'), true)['require']['php'] ?? '8.3'))[0]
: '8.3';
return ask(' What PHP version to install? ', $defaultphpVersion, ['5.6', '7.4', '8.0', '8.1', '8.2']);
```
@ -26,7 +29,7 @@ return ask(' What PHP version to install? ', '8.2', ['5.6', '7.4', '8.0', '8.1',
## Tasks
### provision:php
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision/php.php#L9)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision/php.php#L13)
Installs PHP packages.
@ -34,7 +37,7 @@ Installs PHP packages.
### logs:php-fpm
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision/php.php#L62)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision/php.php#L66)
Shows php-fpm logs.
@ -42,7 +45,7 @@ Shows php-fpm logs.
### provision:composer
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision/php.php#L67)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision/php.php#L71)
Installs Composer.

View File

@ -1,4 +1,5 @@
<?php
namespace Deployer;
require_once __DIR__ . '/common.php';
@ -25,6 +26,7 @@ set('laravel_version', function () {
preg_match_all('/(\d+\.?)+/', $result, $matches);
return $matches[0][0] ?? 5.5;
});
set('public_path', 'public');
/**
* Run an artisan command.

View File

@ -1,4 +1,5 @@
<?php
namespace Deployer;
require __DIR__ . '/provision/databases.php';
@ -52,6 +53,9 @@ task('provision:check', function () {
warning('!! Only Ubuntu 20.04 LTS supported! !!');
warning('!! !!');
warning('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!');
if (!askConfirmation(' Do you want to continue? (Not recommended)', false)) {
throw new \RuntimeException('Provision aborted due to incompatible OS.');
}
}
})->oncePerNode();
@ -63,19 +67,20 @@ task('provision:configure', function () {
'public_path',
'php_version',
'db_type',
];
$dbparams = [
'db_user',
'db_name',
'db_password',
];
$code = "\n\n host(<info>'{{alias}}'</info>)";
foreach ($params as $name) {
$code .= "\n ->set(<info>'$name'</info>, <info>'…'</info>)";
}
$code .= ";\n\n";
writeln($code);
foreach ($params as $name) {
get($name);
}
if (get('db_type') !== 'none') {
foreach ($dbparams as $name) {
get($name);
}
}
});
desc('Adds repositories and update');

View File

@ -1,8 +1,12 @@
<?php
namespace Deployer;
set('php_version', function () {
return ask(' What PHP version to install? ', '8.2', ['5.6', '7.4', '8.0', '8.1', '8.2']);
$defaultphpVersion = file_exists('composer.json')
? explode('|', preg_replace('/[^0-9.|]+/', '', json_decode(file_get_contents('composer.json'), true)['require']['php'] ?? '8.3'))[0]
: '8.3';
return ask(' What PHP version to install? ', $defaultphpVersion, ['5.6', '7.4', '8.0', '8.1', '8.2']);
});
desc('Installs PHP packages');
@ -68,4 +72,3 @@ task('provision:composer', function () {
run('curl -sS https://getcomposer.org/installer | php');
run('mv composer.phar /usr/local/bin/composer');
})->oncePerNode();