Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed bin/console calls in shopware recipe #3512

Merged
merged 2 commits into from
Feb 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 25 additions & 15 deletions docs/recipe/shopware.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,18 @@ Please remember that the installation must be modified so that it can be


## Configuration
### bin/console
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L22)



```php title="Default value"
'{{bin/php}} {{release_or_current_path}}/bin/console'
```


### default_timeout
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L23)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L24)

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

Expand All @@ -80,7 +90,7 @@ Overrides [default_timeout](/docs/recipe/common.md#default_timeout) from `recipe


### shared_files
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L26)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L27)

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

Expand All @@ -97,7 +107,7 @@ These files are shared among all releases.


### shared_dirs
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L34)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L35)

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

Expand All @@ -116,7 +126,7 @@ These directories are shared among all releases.


### writable_dirs
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L45)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L46)

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

Expand Down Expand Up @@ -145,15 +155,15 @@ Please note that the files in `config/jwt/*` receive special attention in the `s
## Tasks

### sw:cache:clear
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L61)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L62)



This task remotely executes the `cache:clear` console command on the target server.


### sw:cache:warmup
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L67)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L68)



Expand All @@ -162,39 +172,39 @@ visits the website, doesn't have to wait for the cache to be built up.


### sw:database:migrate
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L73)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L74)



This task remotely executes the `database:migrate` console command on the target server.


### sw:plugin:refresh
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L77)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L78)






### sw:plugin:update:all
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L113)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L114)






### sw:writable:jwt
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L123)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L124)






### sw:deploy
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L130)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L131)



Expand All @@ -210,7 +220,7 @@ This task is group task which contains next tasks:


### deploy
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L139)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L140)

Deploys your project.

Expand All @@ -227,23 +237,23 @@ This task is group task which contains next tasks:


### sw-build-without-db:get-remote-config
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L149)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L150)






### sw-build-without-db:build
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L162)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L163)






### sw-build-without-db
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L166)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L167)



Expand Down
19 changes: 10 additions & 9 deletions recipe/shopware.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

add('recipes', ['shopware']);

set('bin/console', '{{bin/php}} {{release_or_current_path}}/bin/console');

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

Expand Down Expand Up @@ -59,28 +60,28 @@

// This task remotely executes the `cache:clear` console command on the target server.
task('sw:cache:clear', static function () {
run('cd {{release_path}} && bin/console cache:clear');
run('cd {{release_path}} && {{bin/console}} cache:clear');
});

// 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.
task('sw:cache:warmup', static function () {
run('cd {{release_path}} && bin/console cache:warmup');
run('cd {{release_path}} && bin/console http:cache:warm:up');
run('cd {{release_path}} && {{bin/console}} cache:warmup');
run('cd {{release_path}} && {{bin/console}} http:cache:warm:up');
});

// This task remotely executes the `database:migrate` console command on the target server.
task('sw:database:migrate', static function () {
run('cd {{release_path}} && bin/console database:migrate --all');
run('cd {{release_path}} && {{bin/console}} database:migrate --all');
});

task('sw:plugin:refresh', function () {
run('cd {{release_path}} && bin/console plugin:refresh');
run('cd {{release_path}} && {{bin/console}} plugin:refresh');
});

function getPlugins(): array
{
$output = explode("\n", run('cd {{release_path}} && bin/console plugin:list'));
$output = explode("\n", run('cd {{release_path}} && {{bin/console}} plugin:list'));

// Take line over headlines and count "-" to get the size of the cells.
$lengths = array_filter(array_map('strlen', explode(' ', $output[4])));
Expand Down Expand Up @@ -115,7 +116,7 @@ function getPlugins(): array
foreach ($plugins as $plugin) {
if ($plugin['Installed'] === 'Yes') {
writeln("<info>Running plugin update for " . $plugin['Plugin'] . "</info>\n");
run("cd {{release_path}} && bin/console plugin:update " . $plugin['Plugin']);
run("cd {{release_path}} && {{bin/console}} plugin:update " . $plugin['Plugin']);
}
}
});
Expand Down Expand Up @@ -151,10 +152,10 @@ function getPlugins(): array
return;
}
within('{{deploy_path}}/current', function () {
run('./bin/console bundle:dump');
run('{{bin/php}} ./bin/console bundle:dump');
download('{{deploy_path}}/current/var/plugins.json', './var/');

run('./bin/console theme:dump');
run('{{bin/php}} ./bin/console theme:dump');
download('{{deploy_path}}/current/files/theme-config', './files/');
});
});
Expand Down