deployphp/deployer

View on GitHub
docs/recipe/craftcms.md

Summary

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

# How to Deploy a Craftcms Project

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

[Source](/recipe/craftcms.php)

Deployer is a free and open source deployment tool written in PHP. 
It helps you to deploy your Craftcms application to a server. 
It is very easy to use and has a lot of features. 

Three main features of Deployer are:
- **Provisioning** - provision your server for you.
- **Zero downtime deployment** - deploy your application without a downtime.
- **Rollbacks** - rollback your application to a previous version, if something goes wrong.

Additionally, Deployer has a lot of other features, like:
- **Easy to use** - Deployer is very easy to use. It has a simple and intuitive syntax.
- **Fast** - Deployer is very fast. It uses parallel connections to deploy your application.
- **Secure** - Deployer uses SSH to connect to your server.
- **Supports all major PHP frameworks** - Deployer supports all major PHP frameworks.

You can read more about Deployer in [Getting Started](/docs/getting-started.md).

The [deploy](#deploy) task of **Craftcms** consists of:
* [deploy:prepare](/docs/recipe/common.md#deployprepare) – Prepares a new release
  * [deploy:info](/docs/recipe/deploy/info.md#deployinfo) – Displays info about deployment
  * [deploy:setup](/docs/recipe/deploy/setup.md#deploysetup) – Prepares host for deploy
  * [deploy:lock](/docs/recipe/deploy/lock.md#deploylock) – Locks deploy
  * [deploy:release](/docs/recipe/deploy/release.md#deployrelease) – Prepares release
  * [deploy:update_code](/docs/recipe/deploy/update_code.md#deployupdate_code) – Updates code
  * [deploy:shared](/docs/recipe/deploy/shared.md#deployshared) – Creates symlinks for shared files and dirs
  * [deploy:writable](/docs/recipe/deploy/writable.md#deploywritable) – Makes writable dirs
* [deploy:vendors](/docs/recipe/deploy/vendors.md#deployvendors) – Installs vendors


The craftcms recipe is based on the [common](/docs/recipe/common.md) recipe.

## Configuration
### log_files
[Source](https://github.com/deployphp/deployer/blob/master/recipe/craftcms.php#L9)



```php title="Default value"
'storage/logs/*.log'
```


### shared_dirs
[Source](https://github.com/deployphp/deployer/blob/master/recipe/craftcms.php#L11)

Overrides [shared_dirs](/docs/recipe/deploy/shared.md#shared_dirs) from `recipe/deploy/shared.php`.



```php title="Default value"
[
    'storage',
    'web/assets',
]
```


### shared_files
[Source](https://github.com/deployphp/deployer/blob/master/recipe/craftcms.php#L16)

Overrides [shared_files](/docs/recipe/deploy/shared.md#shared_files) from `recipe/deploy/shared.php`.



```php title="Default value"
['.env']
```


### writable_dirs
[Source](https://github.com/deployphp/deployer/blob/master/recipe/craftcms.php#L18)

Overrides [writable_dirs](/docs/recipe/deploy/writable.md#writable_dirs) from `recipe/deploy/writable.php`.



```php title="Default value"
[
    'config/project',
    'storage',
    'web/assets',
    'web/cpresources',
]
```



## Tasks

### craft:gc
[Source](https://github.com/deployphp/deployer/blob/master/recipe/craftcms.php#L120)

Runs garbage collection.




### deploy
[Source](https://github.com/deployphp/deployer/blob/master/recipe/craftcms.php#L127)

Deploys Craft CMS.




This task is group task which contains next tasks:
* [deploy:prepare](/docs/recipe/common.md#deployprepare)
* [deploy:vendors](/docs/recipe/deploy/vendors.md#deployvendors)