deployer/docs/recipe/symfony.md

194 lines
5.1 KiB
Markdown
Raw Normal View History

2021-09-26 15:25:58 +02:00
<!-- DO NOT EDIT THIS FILE! -->
<!-- Instead edit recipe/symfony.php -->
<!-- Then run bin/docgen -->
2022-09-12 11:40:11 +02:00
# How to Deploy a Symfony Application
2021-09-26 15:25:58 +02:00
2022-09-12 12:29:44 +02:00
```php
require 'recipe/symfony.php';
```
2021-09-26 15:25:58 +02:00
[Source](/recipe/symfony.php)
2022-09-12 11:40:11 +02:00
Deployer is a free and open source deployment tool written in PHP.
It helps you to deploy your Symfony 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 **Symfony** consists of:
* [deploy:prepare](/docs/recipe/common.md#deployprepare) Prepares a new release
* [deploy:info](/docs/recipe/typo3.md#deployinfo)
2022-09-12 11:40:11 +02:00
* [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/typo3.md#deployupdate_code)
2022-09-12 11:40:11 +02:00
* [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
* [deploy:cache:clear](/docs/recipe/symfony.md#deploycacheclear) Clears cache
* [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)
2022-07-26 09:18:44 +02:00
2022-07-26 00:19:14 +02:00
The symfony recipe is based on the [common](/docs/recipe/common.md) recipe.
2021-09-26 15:25:58 +02:00
## Configuration
### symfony_version
[Source](https://github.com/deployphp/deployer/blob/master/recipe/symfony.php#L8)
2022-09-12 12:53:42 +02:00
```php title="Default value"
$result = run('{{bin/console}} --version');
preg_match_all('/(\d+\.?)+/', $result, $matches);
return $matches[0][0] ?? 5.0;
```
2021-09-26 15:25:58 +02:00
### shared_dirs
[Source](https://github.com/deployphp/deployer/blob/master/recipe/symfony.php#L14)
2021-10-18 18:29:14 +02:00
Overrides [shared_dirs](/docs/recipe/deploy/shared.md#shared_dirs) from `recipe/deploy/shared.php`.
2021-09-26 15:25:58 +02:00
```php title="Default value"
[
'var/log',
]
```
### shared_files
[Source](https://github.com/deployphp/deployer/blob/master/recipe/symfony.php#L18)
2021-09-26 15:25:58 +02:00
2021-10-18 18:29:14 +02:00
Overrides [shared_files](/docs/recipe/deploy/shared.md#shared_files) from `recipe/deploy/shared.php`.
2021-09-26 15:25:58 +02:00
```php title="Default value"
[
'.env.local'
]
```
### writable_dirs
[Source](https://github.com/deployphp/deployer/blob/master/recipe/symfony.php#L22)
2021-09-26 15:25:58 +02:00
Overrides [writable_dirs](/docs/recipe/deploy/writable.md#writable_dirs) from `recipe/deploy/writable.php`.
```php title="Default value"
[
'var',
'var/cache',
'var/log',
'var/sessions',
2021-09-26 15:25:58 +02:00
]
```
### log_files
[Source](https://github.com/deployphp/deployer/blob/master/recipe/symfony.php#L29)
2021-09-26 15:25:58 +02:00
```php title="Default value"
'var/log/*.log'
```
2021-09-26 15:25:58 +02:00
### migrations_config
[Source](https://github.com/deployphp/deployer/blob/master/recipe/symfony.php#L31)
2021-10-18 18:29:14 +02:00
### doctrine_schema_validate_config
[Source](https://github.com/deployphp/deployer/blob/master/recipe/symfony.php#L33)
### bin/console
[Source](https://github.com/deployphp/deployer/blob/master/recipe/symfony.php#L35)
2021-10-18 18:29:14 +02:00
```php title="Default value"
'{{bin/php}} {{release_or_current_path}}/bin/console'
```
2021-09-26 15:25:58 +02:00
### console_options
[Source](https://github.com/deployphp/deployer/blob/master/recipe/symfony.php#L37)
2021-09-26 15:25:58 +02:00
2022-09-12 12:53:42 +02:00
```php title="Default value"
return '--no-interaction';
```
2021-09-26 15:25:58 +02:00
## Tasks
### database:migrate
[Source](https://github.com/deployphp/deployer/blob/master/recipe/symfony.php#L42)
2021-09-26 15:25:58 +02:00
2021-11-08 22:59:39 +01:00
Migrates database.
2021-09-26 15:25:58 +02:00
### doctrine:schema:validate
[Source](https://github.com/deployphp/deployer/blob/master/recipe/symfony.php#L52)
Validate the Doctrine mapping files.
2021-09-26 15:25:58 +02:00
### deploy:cache:clear
[Source](https://github.com/deployphp/deployer/blob/master/recipe/symfony.php#L57)
2021-09-26 15:25:58 +02:00
2021-11-08 22:59:39 +01:00
Clears cache.
2021-09-26 15:25:58 +02:00
### deploy
[Source](https://github.com/deployphp/deployer/blob/master/recipe/symfony.php#L66)
2021-09-26 15:25:58 +02:00
2021-11-08 22:59:39 +01:00
Deploys project.
2021-09-26 15:25:58 +02:00
This task is group task which contains next tasks:
* [deploy:prepare](/docs/recipe/common.md#deployprepare)
* [deploy:vendors](/docs/recipe/deploy/vendors.md#deployvendors)
* [deploy:cache:clear](/docs/recipe/symfony.md#deploycacheclear)
* [deploy:publish](/docs/recipe/common.md#deploypublish)