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
2023-10-27 12:32:05 +00:00
* [deploy:info ](/docs/recipe/deploy/info.md#deployinfo ) – Displays info about deployment
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
2024-04-18 15:25:17 +00:00
* [deploy:update_code ](/docs/recipe/shopware.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
* [sw:deploy ](/docs/recipe/shopware.md#swdeploy ) –
* [sw:database:migrate ](/docs/recipe/shopware.md#swdatabasemigrate ) –
* [sw:plugin:refresh ](/docs/recipe/shopware.md#swpluginrefresh ) –
2023-09-07 23:12:26 +02:00
* [sw:theme:refresh ](/docs/recipe/shopware.md#swthemerefresh ) –
* [sw:scheduled-task:register ](/docs/recipe/shopware.md#swscheduled-taskregister ) –
2022-09-12 11:40:11 +02:00
* [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');
```
2023-04-29 10:48:06 +00:00
configure host:
host('SSH-HOSTNAME')
2023-10-24 17:06:56 +02:00
->set('remote_user', 'SSH-USER')
2023-04-29 10:48:06 +00:00
->set('deploy_path', '/var/www/shopware') // This is the path, where deployer will create its directory structure
2023-10-24 17:06:56 +02:00
->set('http_user', 'www-data') // Not needed, if the `user` is the same user, the webserver is running with
->set('http_group', 'www-data')
->set('writable_mode', 'chmod')
->set('writable_recursive', true)
->set('become', 'www-data'); // You might want to change user to execute remote tasks because of access rights of created cache files
2023-04-29 10:48:06 +00:00
2021-11-06 19:02:51 +01:00
:::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
2023-02-24 18:22:55 +01:00
### bin/console
2023-10-24 17:06:56 +02:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L32 )
2023-02-24 18:22:55 +01:00
```php title="Default value"
'{{bin/php}} {{release_or_current_path}}/bin/console'
```
2021-11-05 15:33:35 +01:00
### default_timeout
2023-10-24 17:06:56 +02:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L34 )
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
2023-04-29 10:48:06 +00:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L37 )
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"
[
2024-04-16 09:18:32 +00:00
'.env.local',
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
2023-04-29 10:48:06 +00:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L45 )
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
2023-04-29 10:48:06 +00:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L56 )
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
2023-04-29 10:48:06 +00:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L72 )
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
2023-04-29 10:48:06 +00:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L78 )
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
2023-04-29 10:48:06 +00:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L84 )
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
2023-04-29 10:48:06 +00:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L88 )
2021-09-26 15:25:58 +02:00
2021-09-26 15:43:51 +02:00
2021-09-26 15:25:58 +02:00
2023-09-07 23:12:26 +02:00
### sw:scheduled-task:register
2023-04-29 10:48:06 +00:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L92 )
2023-09-07 23:12:26 +02:00
### sw:theme:refresh
2023-04-29 10:48:06 +00:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L96 )
2023-03-07 23:23:14 +01:00
2023-09-07 23:12:26 +02:00
### sw:theme:compile
2023-10-24 17:06:56 +02:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L102 )
2023-09-07 23:12:26 +02:00
2023-10-24 17:06:56 +02:00
This task is not used per default, but can be used, e.g. in combination with `SHOPWARE_SKIP_THEME_COMPILE=1` ,
to build the theme remotely instead of locally.
2023-09-07 23:12:26 +02:00
2021-11-05 15:33:35 +01:00
### sw:plugin:update:all
2024-02-16 12:51:35 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L114 )
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
2024-02-16 12:51:35 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L124 )
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
2024-02-16 12:51:35 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L131 )
2021-09-26 15:25:58 +02:00
2023-10-24 17:06:56 +02: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 )
2023-09-07 23:12:26 +02:00
* [sw:theme:refresh ](/docs/recipe/shopware.md#swthemerefresh )
* [sw:scheduled-task:register ](/docs/recipe/shopware.md#swscheduled-taskregister )
2021-11-05 15:33:35 +01:00
* [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
2024-02-16 12:51:35 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L142 )
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
2024-04-18 15:25:17 +00:00
### deploy:update_code
2024-02-16 12:51:35 +01:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L151 )
2021-09-26 15:25:58 +02:00
2021-09-26 15:43:51 +02:00
2021-09-26 15:25:58 +02:00
2024-04-18 15:25:17 +00:00
### sw-build-without-db:get-remote-config
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L161 )
2022-03-12 16:42:27 +00:00
### sw-build-without-db:build
2024-04-18 15:25:17 +00:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L174 )
2022-03-12 16:42:27 +00:00
### sw-build-without-db
2024-04-18 15:25:17 +00:00
[Source ](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L178 )
2022-03-12 16:42:27 +00:00
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