deployphp/deployer

View on GitHub
docs/recipe/spiral.md

Summary

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

# How to Deploy a Spiral Project

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

[Source](/recipe/spiral.php)

Deployer is a free and open source deployment tool written in PHP. 
It helps you to deploy your Spiral 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 **Spiral** 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:environment](/docs/recipe/spiral.md#deployenvironment) – Create .env file if it doesn\'t exist
* [deploy:vendors](/docs/recipe/deploy/vendors.md#deployvendors) – Installs vendors
* [spiral:encrypt-key](/docs/recipe/spiral.md#spiralencrypt-key) – Generate new encryption key, if it doesn\'t exist
* [spiral:configure](/docs/recipe/spiral.md#spiralconfigure) – Configure project
* [deploy:download-rr](/docs/recipe/spiral.md#deploydownload-rr) – Download RoadRunner
* [deploy:publish](/docs/recipe/common.md#deploypublish) – Publishes the release
  * [deploy:symlink](/docs/recipe/deploy/symlink.md#deploysymlink) – Creates symlink to release
  * [deploy:unlock](/docs/recipe/deploy/lock.md#deployunlock) – Unlocks deploy
  * [deploy:cleanup](/docs/recipe/deploy/cleanup.md#deploycleanup) – Cleanup old releases
  * [deploy:success](/docs/recipe/common.md#deploysuccess) – 


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

## Configuration
### shared_dirs
[Source](https://github.com/deployphp/deployer/blob/master/recipe/spiral.php#L10)

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

Spiral shared dirs

```php title="Default value"
['runtime']
```


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

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

Spiral writable dirs

```php title="Default value"
['runtime', 'public']
```


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

Path to the RoadRunner server

```php title="Default value"
'{{release_or_current_path}}'
```



## Tasks

### deploy:environment
[Source](https://github.com/deployphp/deployer/blob/master/recipe/spiral.php#L19)

Create .env file if it doesn\'t exist.




### spiral:configure
[Source](https://github.com/deployphp/deployer/blob/master/recipe/spiral.php#L61)

Configure project.

Spiral Framework console commands


### spiral:cycle
[Source](https://github.com/deployphp/deployer/blob/master/recipe/spiral.php#L64)

Update (init) cycle schema from database and annotated classes.




### spiral:migrate
[Source](https://github.com/deployphp/deployer/blob/master/recipe/spiral.php#L67)

Perform all outstanding migrations.




### spiral:update
[Source](https://github.com/deployphp/deployer/blob/master/recipe/spiral.php#L70)

Update project state.




### spiral:cache:clean
[Source](https://github.com/deployphp/deployer/blob/master/recipe/spiral.php#L73)

Clean application runtime cache.




### spiral:i18n:reset
[Source](https://github.com/deployphp/deployer/blob/master/recipe/spiral.php#L76)

Reset translation cache.




### spiral:encrypt-key
[Source](https://github.com/deployphp/deployer/blob/master/recipe/spiral.php#L79)

Generate new encryption key, if it doesn\'t exist.




### spiral:views:compile
[Source](https://github.com/deployphp/deployer/blob/master/recipe/spiral.php#L82)

Warm-up view cache.




### spiral:views:reset
[Source](https://github.com/deployphp/deployer/blob/master/recipe/spiral.php#L85)

Clear view cache.




### cycle:migrate
[Source](https://github.com/deployphp/deployer/blob/master/recipe/spiral.php#L91)

Generate ORM schema migrations.

Cycle ORM and migrations console commands


### cycle:render
[Source](https://github.com/deployphp/deployer/blob/master/recipe/spiral.php#L94)

Render available CycleORM schemas.




### cycle:sync
[Source](https://github.com/deployphp/deployer/blob/master/recipe/spiral.php#L97)

Sync Cycle ORM schema with database without intermediate migration (risk operation).




### migrate:init
[Source](https://github.com/deployphp/deployer/blob/master/recipe/spiral.php#L100)

Init migrations component (create migrations table).




### migrate:replay
[Source](https://github.com/deployphp/deployer/blob/master/recipe/spiral.php#L103)

Replay (down, up) one or multiple migrations.




### migrate:rollback
[Source](https://github.com/deployphp/deployer/blob/master/recipe/spiral.php#L106)

Rollback one (default) or multiple migrations.




### migrate:status
[Source](https://github.com/deployphp/deployer/blob/master/recipe/spiral.php#L109)

Get list of all available migrations and their statuses.




### roadrunner:serve
[Source](https://github.com/deployphp/deployer/blob/master/recipe/spiral.php#L115)

Start RoadRunner server.

RoadRunner console commands


### roadrunner:stop
[Source](https://github.com/deployphp/deployer/blob/master/recipe/spiral.php#L120)

Stop RoadRunner server.




### roadrunner:reset
[Source](https://github.com/deployphp/deployer/blob/master/recipe/spiral.php#L123)

Reset workers of all services.




### deploy:download-rr
[Source](https://github.com/deployphp/deployer/blob/master/recipe/spiral.php#L129)

Download RoadRunner.

Download and restart RoadRunner


### deploy:restart-rr
[Source](https://github.com/deployphp/deployer/blob/master/recipe/spiral.php#L135)

Restart RoadRunner.




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

Deploys your project.

Main task


This task is group task which contains next tasks:
* [deploy:prepare](/docs/recipe/common.md#deployprepare)
* [deploy:environment](/docs/recipe/spiral.md#deployenvironment)
* [deploy:vendors](/docs/recipe/deploy/vendors.md#deployvendors)
* [spiral:encrypt-key](/docs/recipe/spiral.md#spiralencrypt-key)
* [spiral:configure](/docs/recipe/spiral.md#spiralconfigure)
* [deploy:download-rr](/docs/recipe/spiral.md#deploydownload-rr)
* [deploy:publish](/docs/recipe/common.md#deploypublish)