deployer/docs/recipe/common.md

265 lines
6.0 KiB
Markdown
Raw Normal View History

2021-09-26 15:25:58 +02:00
<!-- DO NOT EDIT THIS FILE! -->
<!-- Instead edit recipe/common.php -->
<!-- Then run bin/docgen -->
2022-07-26 09:18:44 +02:00
# Common Recipe
2021-09-26 15:25:58 +02:00
2022-09-12 12:29:44 +02:00
```php
require 'recipe/common.php';
```
2021-09-26 15:25:58 +02:00
[Source](/recipe/common.php)
* Requires
2021-10-09 15:59:42 +00:00
* [provision](/docs/recipe/provision.md)
2021-09-26 15:25:58 +02:00
* [check_remote](/docs/recipe/deploy/check_remote.md)
* [cleanup](/docs/recipe/deploy/cleanup.md)
* [clear_paths](/docs/recipe/deploy/clear_paths.md)
* [copy_dirs](/docs/recipe/deploy/copy_dirs.md)
* [info](/docs/recipe/deploy/info.md)
* [lock](/docs/recipe/deploy/lock.md)
* [push](/docs/recipe/deploy/push.md)
* [release](/docs/recipe/deploy/release.md)
* [rollback](/docs/recipe/deploy/rollback.md)
* [setup](/docs/recipe/deploy/setup.md)
* [shared](/docs/recipe/deploy/shared.md)
* [symlink](/docs/recipe/deploy/symlink.md)
* [update_code](/docs/recipe/deploy/update_code.md)
* [vendors](/docs/recipe/deploy/vendors.md)
* [writable](/docs/recipe/deploy/writable.md)
## Configuration
### user
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L29)
2021-09-26 15:25:58 +02:00
Name of current user who is running deploy.
If not set will try automatically get git user name,
otherwise output of `whoami` command.
2022-09-12 12:53:42 +02:00
:::info Autogenerated
The value of this configuration is autogenerated on access.
:::
2021-09-26 15:25:58 +02:00
### keep_releases
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L46)
2021-09-26 15:25:58 +02:00
Number of releases to preserve in releases folder.
```php title="Default value"
10
```
### repository
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L49)
2021-09-26 15:25:58 +02:00
Repository to deploy.
### default_timeout
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L54)
2021-09-26 15:25:58 +02:00
Default timeout for `run()` and `runLocally()` functions.
Set to `null` to disable timeout.
```php title="Default value"
300
```
### env
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L70)
2021-09-26 15:25:58 +02:00
Remote environment variables.
```php
set('env', [
'KEY' => 'something',
]);
```
It is possible to override it per `run()` call.
```php
run('echo $KEY', env: ['KEY' => 'over']);
2021-09-26 15:25:58 +02:00
```
### dotenv
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L79)
2021-09-26 15:25:58 +02:00
Path to `.env` file which will be used as environment variables for each command per `run()`.
```php
set('dotenv', '{{current_path}}/.env');
```
```php title="Default value"
false
```
2021-10-18 18:29:14 +02:00
### deploy_path
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L89)
2021-10-18 18:29:14 +02:00
The deploy path.
For example can be set for a bunch of host once as:
```php
set('deploy_path', '~/{{alias}}');
```
2022-09-12 12:53:42 +02:00
:::info Required
Throws exception if not set.
:::
2021-10-18 18:29:14 +02:00
2021-09-26 15:25:58 +02:00
### current_path
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L99)
2021-09-26 15:25:58 +02:00
2021-10-18 18:29:14 +02:00
Return current release path. Default to [deploy_path](/docs/recipe/common.md#deploy_path)/`current`.
2021-09-26 15:25:58 +02:00
```php
set('current_path', '/var/public_html');
```
```php title="Default value"
'{{deploy_path}}/current'
```
2021-10-18 18:29:14 +02:00
### bin/php
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L102)
2021-10-18 18:29:14 +02:00
Path to the `php` bin.
2022-09-12 12:53:42 +02:00
```php title="Default value"
if (currentHost()->hasOwn('php_version')) {
return '/usr/bin/php{{php_version}}';
}
return which('php');
```
2021-10-18 18:29:14 +02:00
### bin/git
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L110)
2021-10-18 18:29:14 +02:00
Path to the `git` bin.
2022-09-12 12:53:42 +02:00
```php title="Default value"
return which('git');
```
2021-10-18 18:29:14 +02:00
### use_relative_symlink
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L116)
2021-10-18 18:29:14 +02:00
Should [bin/symlink](/docs/recipe/common.md#bin/symlink) use `--relative` option or not. Will detect
automatically.
2022-09-12 12:53:42 +02:00
```php title="Default value"
return commandSupportsOption('ln', '--relative');
```
2021-10-18 18:29:14 +02:00
### bin/symlink
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L121)
2021-10-18 18:29:14 +02:00
Path to the `ln` bin. With predefined options `-nfs`.
2022-09-12 12:53:42 +02:00
```php title="Default value"
return get('use_relative_symlink') ? 'ln -nfs --relative' : 'ln -nfs';
```
2021-10-18 18:29:14 +02:00
2021-09-26 15:25:58 +02:00
### sudo_askpass
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L128)
2021-09-26 15:25:58 +02:00
Path to a file which will store temp script with sudo password.
Defaults to `.dep/sudo_pass`. This script is only temporary and will be deleted after
sudo command executed.
2022-09-12 12:53:42 +02:00
:::info Autogenerated
The value of this configuration is autogenerated on access.
:::
2021-09-26 15:25:58 +02:00
## Tasks
### deploy:prepare
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L137)
2021-09-26 15:43:51 +02:00
2021-11-08 22:59:39 +01:00
Prepares a new release.
2021-09-26 15:25:58 +02:00
This task is group task which contains next tasks:
* [deploy:info](/docs/recipe/deploy/info.md#deployinfo)
* [deploy:setup](/docs/recipe/deploy/setup.md#deploysetup)
* [deploy:lock](/docs/recipe/deploy/lock.md#deploylock)
* [deploy:release](/docs/recipe/deploy/release.md#deployrelease)
* [deploy:update_code](/docs/recipe/deploy/update_code.md#deployupdate_code)
* [deploy:shared](/docs/recipe/deploy/shared.md#deployshared)
* [deploy:writable](/docs/recipe/deploy/writable.md#deploywritable)
### deploy:publish
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L148)
2021-09-26 15:43:51 +02:00
2021-11-08 22:59:39 +01:00
Publishes the release.
2021-09-26 15:25:58 +02:00
This task is group task which contains next tasks:
* [deploy:symlink](/docs/recipe/deploy/symlink.md#deploysymlink)
* [deploy:unlock](/docs/recipe/deploy/lock.md#deployunlock)
* [deploy:cleanup](/docs/recipe/deploy/cleanup.md#deploycleanup)
* [deploy:success](/docs/recipe/common.md#deploysuccess)
### deploy
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L156)
Deploys your project.
This task is group task which contains next tasks:
* [deploy:prepare](/docs/recipe/common.md#deployprepare)
* [deploy:publish](/docs/recipe/common.md#deploypublish)
2021-09-26 15:25:58 +02:00
### deploy:success
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L165)
2021-09-26 15:25:58 +02:00
2021-09-26 15:43:51 +02:00
2021-09-26 15:25:58 +02:00
Prints success message
### deploy:failed
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L174)
2021-09-26 15:25:58 +02:00
2021-09-26 15:43:51 +02:00
2021-09-26 15:25:58 +02:00
Hook on deploy failure.
2021-10-11 22:06:22 +02:00
### logs:app
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L184)
2021-09-26 15:25:58 +02:00
2021-11-08 22:59:39 +01:00
Shows application logs.
2021-09-26 15:25:58 +02:00
2021-11-08 22:59:39 +01:00
Follows latest application logs.
2021-09-26 15:25:58 +02:00