Skip to content

Commit 7f905c2

Browse files
Improve recipe
1 parent 003b4e5 commit 7f905c2

File tree

2 files changed

+27
-26
lines changed

2 files changed

+27
-26
lines changed

docs/recipe/shopware.md

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,18 @@ You can read more about Deployer in [Getting Started](/docs/getting-started.md).
2929

3030
The [deploy](#deploy) task of **Shopware** consists of:
3131
* [deploy:prepare](/docs/recipe/common.md#deployprepare) – Prepares a new release
32-
* [deploy:info](/docs/recipe/typo3.md#deployinfo)
32+
* [deploy:info](/docs/recipe/deploy/info.md#deployinfo)Displays info about deployment
3333
* [deploy:setup](/docs/recipe/deploy/setup.md#deploysetup) – Prepares host for deploy
3434
* [deploy:lock](/docs/recipe/deploy/lock.md#deploylock) – Locks deploy
3535
* [deploy:release](/docs/recipe/deploy/release.md#deployrelease) – Prepares release
36-
* [deploy:update_code](/docs/recipe/typo3.md#deployupdate_code)
36+
* [deploy:update_code](/docs/recipe/deploy/update_code.md#deployupdate_code)Updates code
3737
* [deploy:shared](/docs/recipe/deploy/shared.md#deployshared) – Creates symlinks for shared files and dirs
3838
* [deploy:writable](/docs/recipe/deploy/writable.md#deploywritable) – Makes writable dirs
3939
* [sw:deploy](/docs/recipe/shopware.md#swdeploy)
4040
* [sw:database:migrate](/docs/recipe/shopware.md#swdatabasemigrate)
4141
* [sw:plugin:refresh](/docs/recipe/shopware.md#swpluginrefresh)
4242
* [sw:theme:refresh](/docs/recipe/shopware.md#swthemerefresh)
4343
* [sw:scheduled-task:register](/docs/recipe/shopware.md#swscheduled-taskregister)
44-
* [sw:theme:compile](/docs/recipe/shopware.md#swthemecompile)
4544
* [sw:cache:clear](/docs/recipe/shopware.md#swcacheclear)
4645
* [sw:plugin:update:all](/docs/recipe/shopware.md#swpluginupdateall)
4746
* [sw:cache:clear](/docs/recipe/shopware.md#swcacheclear)
@@ -68,10 +67,13 @@ set('repository', 'git@github.com:shopware/production.git');
6867

6968
configure host:
7069
host('SSH-HOSTNAME')
71-
->setRemoteUser('SSH-USER')
70+
->set('remote_user', 'SSH-USER')
7271
->set('deploy_path', '/var/www/shopware') // This is the path, where deployer will create its directory structure
73-
->set('http_user', 'www-data') // Not needed, if the `user` is the same user, the webserver is running with
74-
->set('writable_mode', 'chmod');
72+
->set('http_user', 'www-data') // Not needed, if the `user` is the same user, the webserver is running with
73+
->set('http_group', 'www-data')
74+
->set('writable_mode', 'chmod')
75+
->set('writable_recursive', true)
76+
->set('become', 'www-data'); // You might want to change user to execute remote tasks because of access rights of created cache files
7577

7678
:::note
7779
Please remember that the installation must be modified so that it can be
@@ -81,7 +83,7 @@ Please remember that the installation must be modified so that it can be
8183

8284
## Configuration
8385
### bin/console
84-
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L30)
86+
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L32)
8587

8688

8789

@@ -91,7 +93,7 @@ Please remember that the installation must be modified so that it can be
9193

9294

9395
### default_timeout
94-
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L32)
96+
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L34)
9597

9698
Overrides [default_timeout](/docs/recipe/common.md#default_timeout) from `recipe/common.php`.
9799

@@ -214,43 +216,43 @@ This task remotely executes the `database:migrate` console command on the target
214216

215217

216218
### sw:theme:compile
217-
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L100)
218-
219+
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L102)
219220

220221

221222

223+
This task is not used per default, but can be used, e.g. in combination with `SHOPWARE_SKIP_THEME_COMPILE=1`,
224+
to build the theme remotely instead of locally.
222225

223226

224227
### sw:plugin:update:all
225-
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L136)
228+
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L138)
226229

227230

228231

229232

230233

231234

232235
### sw:writable:jwt
233-
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L146)
236+
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L148)
234237

235238

236239

237240

238241

239242

240243
### sw:deploy
241-
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L154)
242-
244+
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L155)
243245

244246

245247

248+
Grouped SW deploy tasks.
246249

247250

248251
This task is group task which contains next tasks:
249252
* [sw:database:migrate](/docs/recipe/shopware.md#swdatabasemigrate)
250253
* [sw:plugin:refresh](/docs/recipe/shopware.md#swpluginrefresh)
251254
* [sw:theme:refresh](/docs/recipe/shopware.md#swthemerefresh)
252255
* [sw:scheduled-task:register](/docs/recipe/shopware.md#swscheduled-taskregister)
253-
* [sw:theme:compile](/docs/recipe/shopware.md#swthemecompile)
254256
* [sw:cache:clear](/docs/recipe/shopware.md#swcacheclear)
255257
* [sw:plugin:update:all](/docs/recipe/shopware.md#swpluginupdateall)
256258
* [sw:cache:clear](/docs/recipe/shopware.md#swcacheclear)
@@ -290,7 +292,7 @@ This task is group task which contains next tasks:
290292

291293

292294
### sw-build-without-db
293-
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L193)
295+
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L192)
294296

295297

296298

recipe/shopware.php

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@
1010
*
1111
* configure host:
1212
* host('SSH-HOSTNAME')
13-
* ->setRemoteUser('SSH-USER')
13+
* ->set('remote_user', 'SSH-USER')
1414
* ->set('deploy_path', '/var/www/shopware') // This is the path, where deployer will create its directory structure
15-
* ->set('http_user', 'www-data') // Not needed, if the `user` is the same user, the webserver is running with
16-
* ->set('writable_mode', 'chmod');
15+
* ->set('http_user', 'www-data') // Not needed, if the `user` is the same user, the webserver is running with
16+
* ->set('http_group', 'www-data')
17+
* ->set('writable_mode', 'chmod')
18+
* ->set('writable_recursive', true)
19+
* ->set('become', 'www-data'); // You might want to change user to execute remote tasks because of access rights of created cache files
1720
*
1821
* :::note
1922
* Please remember that the installation must be modified so that it can be
@@ -22,7 +25,6 @@
2225
*/
2326
namespace Deployer;
2427

25-
2628
require_once __DIR__ . '/common.php';
2729

2830
add('recipes', ['shopware']);
@@ -31,8 +33,6 @@
3133

3234
set('default_timeout', 3600); // Increase when tasks take longer than that.
3335

34-
//set host configuration and repository here
35-
3636
// These files are shared among all releases.
3737
set('shared_files', [
3838
'.env',
@@ -97,6 +97,8 @@
9797
run('cd {{release_path}} && {{bin/console}} theme:refresh');
9898
});
9999

100+
// This task is not used per default, but can be used, e.g. in combination with `SHOPWARE_SKIP_THEME_COMPILE=1`,
101+
// to build the theme remotely instead of locally.
100102
task('sw:theme:compile', function () {
101103
run('cd {{release_path}} && {{bin/console}} theme:compile');
102104
});
@@ -150,13 +152,11 @@ function getPlugins(): array
150152
/**
151153
* Grouped SW deploy tasks.
152154
*/
153-
154155
task('sw:deploy', [
155156
'sw:database:migrate',
156157
'sw:plugin:refresh',
157158
'sw:theme:refresh',
158159
'sw:scheduled-task:register',
159-
'sw:theme:compile',
160160
'sw:cache:clear',
161161
'sw:plugin:update:all',
162162
'sw:cache:clear',
@@ -186,10 +186,9 @@ function getPlugins(): array
186186
});
187187

188188
task('sw-build-without-db:build', static function () {
189-
runLocally('CI=1 SHOPWARE_SKIP_BUNDLE_DUMP=1 SHOPWARE_SKIP_THEME_COMPILE=1 bin/build-js.sh');
189+
runLocally('CI=1 SHOPWARE_SKIP_BUNDLE_DUMP=1 ./bin/build-js.sh');
190190
});
191191

192-
193192
task('sw-build-without-db', [
194193
'sw-build-without-db:get-remote-config',
195194
'sw-build-without-db:build',

0 commit comments

Comments
 (0)