deployphp/deployer

View on GitHub
docs/recipe/common.md

Summary

Maintainability
Test Coverage
<!-- DO NOT EDIT THIS FILE! -->
<!-- Instead edit recipe/common.php -->
<!-- Then run bin/docgen -->

# Common Recipe

```php
require 'recipe/common.php';
```

[Source](/recipe/common.php)

* Requires
  * [provision](/docs/recipe/provision.md)
  * [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)

Name of current user who is running deploy.
If not set will try automatically get git user name,
otherwise output of `whoami` command.
:::info Autogenerated
The value of this configuration is autogenerated on access.
:::




### keep_releases
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L46)

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)

Repository to deploy.



### default_timeout
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L54)

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)

Remote environment variables.
```php
set('env', [
    'KEY' => 'something',
]);
```

It is possible to override it per `run()` call.

```php
run('echo $KEY', env: ['KEY' => 'over']);
```



### dotenv
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L79)

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
```


### deploy_path
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L89)

The deploy path.

For example can be set for a bunch of host once as:
```php
set('deploy_path', '~/{{alias}}');
```
:::info Required
Throws exception if not set.
:::




### current_path
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L99)

Return current release path. Default to [deploy_path](/docs/recipe/common.md#deploy_path)/`current`.
```php
set('current_path', '/var/public_html');
```

```php title="Default value"
'{{deploy_path}}/current'
```


### bin/php
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L102)

Path to the `php` bin.

```php title="Default value"
if (currentHost()->hasOwn('php_version')) {
return '/usr/bin/php{{php_version}}';
}
return which('php');
```


### bin/git
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L110)

Path to the `git` bin.

```php title="Default value"
return which('git');
```


### use_relative_symlink
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L116)

Should [bin/symlink](/docs/recipe/common.md#bin/symlink) use `--relative` option or not. Will detect
automatically.

```php title="Default value"
return commandSupportsOption('ln', '--relative');
```


### bin/symlink
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L121)

Path to the `ln` bin. With predefined options `-nfs`.

```php title="Default value"
return get('use_relative_symlink') ? 'ln -nfs --relative' : 'ln -nfs';
```


### sudo_askpass
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L128)

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.
:::info Autogenerated
The value of this configuration is autogenerated on access.
:::





## Tasks

### deploy:prepare
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L137)

Prepares a new release.




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)

Publishes the release.




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)


### deploy:success
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L165)



Prints success message


### deploy:failed
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L174)



Hook on deploy failure.


### logs:app
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L184)

Shows application logs.

Follows latest application logs.