deployer/docs/recipe/shopware.md

258 lines
7.6 KiB
Markdown
Raw Normal View History

2021-09-26 15:25:58 +02:00
<!-- DO NOT EDIT THIS FILE! -->
<!-- Instead edit recipe/shopware.php -->
<!-- Then run bin/docgen -->
2022-09-12 11:40:11 +02:00
# How to Deploy a Shopware Project
2021-09-26 15:25:58 +02:00
2022-09-12 12:29:44 +02:00
```php
require 'recipe/shopware.php';
```
2021-09-26 15:25:58 +02:00
[Source](/recipe/shopware.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 Shopware 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 **Shopware** 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
* [sw:deploy](/docs/recipe/shopware.md#swdeploy)
* [sw:database:migrate](/docs/recipe/shopware.md#swdatabasemigrate)
* [sw:plugin:refresh](/docs/recipe/shopware.md#swpluginrefresh)
* [sw:cache:clear](/docs/recipe/shopware.md#swcacheclear)
* [sw:plugin:update:all](/docs/recipe/shopware.md#swpluginupdateall)
* [sw:cache:clear](/docs/recipe/shopware.md#swcacheclear)
* [deploy:clear_paths](/docs/recipe/deploy/clear_paths.md#deployclear_paths) Cleanup files and/or directories
* [sw:cache:warmup](/docs/recipe/shopware.md#swcachewarmup)
* [sw:writable:jwt](/docs/recipe/shopware.md#swwritablejwt)
* [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 shopware recipe is based on the [common](/docs/recipe/common.md) recipe.
2021-09-26 15:25:58 +02:00
2021-11-06 19:02:51 +01:00
## Usage
Add {{repository}} to your _deploy.php_ file:
```php
set('repository', 'git@github.com:shopware/production.git');
```
:::note
Please remember that the installation must be modified so that it can be
[build without database](https://developer.shopware.com/docs/guides/hosting/installation-updates/deployments/build-w-o-db#compiling-the-storefront-without-database).
:::
2021-09-26 15:25:58 +02:00
## Configuration
2021-11-05 15:33:35 +01:00
### default_timeout
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L23)
2021-09-26 15:25:58 +02:00
2021-11-05 15:33:35 +01:00
Overrides [default_timeout](/docs/recipe/common.md#default_timeout) from `recipe/common.php`.
2021-09-26 15:25:58 +02:00
### shared_files
2021-11-05 15:33:35 +01:00
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L26)
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
2021-11-05 15:33:35 +01:00
These files are shared among all releases.
2021-09-26 15:25:58 +02:00
```php title="Default value"
[
'.env',
2021-11-05 15:33:35 +01:00
'install.lock',
'public/.htaccess',
'public/.user.ini',
2021-09-26 15:25:58 +02:00
]
```
### shared_dirs
2021-11-05 15:33:35 +01:00
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L34)
2021-09-26 15:25:58 +02:00
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
2021-11-05 15:33:35 +01:00
These directories are shared among all releases.
2021-09-26 15:25:58 +02:00
```php title="Default value"
[
'config/jwt',
'files',
'var/log',
'public/media',
'public/thumbnail',
'public/sitemap',
]
```
### writable_dirs
2021-11-05 15:33:35 +01:00
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L45)
2021-09-26 15:25:58 +02:00
Overrides [writable_dirs](/docs/recipe/deploy/writable.md#writable_dirs) from `recipe/deploy/writable.php`.
2021-11-05 15:33:35 +01:00
These directories are made writable (the definition of "writable" requires attention).
Please note that the files in `config/jwt/*` receive special attention in the `sw:writable:jwt` task.
2021-09-26 15:25:58 +02:00
```php title="Default value"
[
2021-11-05 15:33:35 +01:00
'config/jwt',
2021-09-26 15:25:58 +02:00
'custom/plugins',
'files',
2021-11-05 15:33:35 +01:00
'public/bundles',
'public/css',
'public/fonts',
'public/js',
2021-09-26 15:25:58 +02:00
'public/media',
'public/sitemap',
2021-11-05 15:33:35 +01:00
'public/theme',
'public/thumbnail',
'var',
2021-09-26 15:25:58 +02:00
]
```
## Tasks
2021-11-05 15:33:35 +01:00
### sw:cache:clear
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L61)
2021-09-26 15:43:51 +02:00
2021-09-26 15:25:58 +02:00
2021-11-05 15:33:35 +01:00
This task remotely executes the `cache:clear` console command on the target server.
2021-09-26 15:25:58 +02:00
2021-11-05 15:33:35 +01:00
### sw:cache:warmup
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L67)
2021-09-26 15:25:58 +02:00
2021-09-26 15:43:51 +02:00
2021-09-26 15:25:58 +02:00
2021-11-05 15:33:35 +01:00
This task remotely executes the cache warmup console commands on the target server, so that the first user, who
visits the website, doesn't have to wait for the cache to be built up.
2021-09-26 15:25:58 +02:00
2021-11-05 15:33:35 +01:00
### sw:database:migrate
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L73)
2021-09-26 15:25:58 +02:00
2021-09-26 15:43:51 +02:00
2021-11-05 15:33:35 +01:00
This task remotely executes the `database:migrate` console command on the target server.
2021-09-26 15:25:58 +02:00
2021-11-05 15:33:35 +01:00
### sw:plugin:refresh
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L77)
2021-09-26 15:25:58 +02:00
2021-09-26 15:43:51 +02:00
2021-09-26 15:25:58 +02:00
2021-11-05 15:33:35 +01:00
### sw:plugin:update:all
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L113)
2021-09-26 15:25:58 +02:00
2021-09-26 15:43:51 +02:00
2021-09-26 15:25:58 +02:00
2021-11-05 15:33:35 +01:00
### sw:writable:jwt
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L123)
2021-09-26 15:25:58 +02:00
2021-09-26 15:43:51 +02:00
2021-09-26 15:25:58 +02:00
2021-11-05 15:33:35 +01:00
### sw:deploy
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L130)
2021-09-26 15:25:58 +02:00
2021-11-05 15:33:35 +01:00
Grouped SW deploy tasks.
2021-09-26 15:43:51 +02:00
2021-09-26 15:25:58 +02:00
2021-11-05 15:33:35 +01:00
This task is group task which contains next tasks:
* [sw:database:migrate](/docs/recipe/shopware.md#swdatabasemigrate)
* [sw:plugin:refresh](/docs/recipe/shopware.md#swpluginrefresh)
* [sw:cache:clear](/docs/recipe/shopware.md#swcacheclear)
* [sw:plugin:update:all](/docs/recipe/shopware.md#swpluginupdateall)
* [sw:cache:clear](/docs/recipe/shopware.md#swcacheclear)
2021-09-26 15:25:58 +02:00
2021-11-05 15:33:35 +01:00
### deploy
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L139)
2021-09-26 15:25:58 +02:00
2021-11-08 22:59:39 +01:00
Deploys your project.
2021-09-26 15:25:58 +02:00
2021-09-26 15:43:51 +02:00
2021-09-26 15:25:58 +02:00
2021-11-05 15:33:35 +01:00
This task is group task which contains next tasks:
* [deploy:prepare](/docs/recipe/common.md#deployprepare)
* [sw:deploy](/docs/recipe/shopware.md#swdeploy)
* [deploy:clear_paths](/docs/recipe/deploy/clear_paths.md#deployclear_paths)
* [sw:cache:warmup](/docs/recipe/shopware.md#swcachewarmup)
* [sw:writable:jwt](/docs/recipe/shopware.md#swwritablejwt)
* [deploy:publish](/docs/recipe/common.md#deploypublish)
2021-09-26 15:25:58 +02:00
2021-11-05 15:33:35 +01:00
### sw-build-without-db:get-remote-config
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L149)
2021-09-26 15:25:58 +02:00
2021-09-26 15:43:51 +02:00
2021-09-26 15:25:58 +02:00
### sw-build-without-db:build
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L162)
### sw-build-without-db
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L166)
2021-09-26 15:25:58 +02:00
This task is group task which contains next tasks:
2021-11-05 15:33:35 +01:00
* [sw-build-without-db:get-remote-config](/docs/recipe/shopware.md#sw-build-without-dbget-remote-config)
* [sw-build-without-db:build](/docs/recipe/shopware.md#sw-build-without-dbbuild)
2021-09-26 15:25:58 +02:00