Skip to content
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
1 change: 1 addition & 0 deletions .wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ AppSystem
Archlinux
ArrayFacade
AssociationField
AsyncAws
AsyncPaymentTransactionStruct
AsynchronousPaymentHandlerInterface
AudienceContext
Expand Down
124 changes: 118 additions & 6 deletions guides/hosting/infrastructure/filesystem.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@

### Fallback adapter configuration

By default, the configuration for the theme, asset and sitemap filesystem will use the configuration from the `public` filesystem if they are not specifically configured.
By default, the configuration for the theme, asset, and sitemap filesystem will use the configuration from the `public` filesystem if they are not specifically configured.
This means when you want to change the configuration used for the public filesystem, but the others should use the old configuration you have to set them explicitly.

E.g. before you had the following configuration:
E.g., before you had the following configuration:

```yaml
shopware:
Expand All @@ -104,7 +104,7 @@

```

Now you want to change the public filesystem to use an S3 adapter, but the theme, asset and sitemap filesystem should still use the local adapter. You have to set them explicitly:
Now you want to change the public filesystem to use an S3 adapter, but the theme, asset, and sitemap filesystem should still use the local adapter. You have to set them explicitly:

```yaml
shopware:
Expand Down Expand Up @@ -221,9 +221,121 @@

If your S3 provider does not use buckets as subdomain like Minio in default configuration, you need to set `use_path_style_endpoint` to `true` inside `config`.

#### Custom HTTP client for S3

:::info
Since Shopware 6.7.9.0, you can register a custom HTTP client for S3 operations.
:::

By default, the underlying AsyncAws S3 client creates its own HTTP client internally, which includes a `RetryableHttpClient` with an AWS-specific retry strategy. This handles transient errors like throttling (HTTP 429), server errors (HTTP 5xx), and other AWS-specific error codes automatically.
Comment thread
lankhaar marked this conversation as resolved.
Comment thread
lankhaar marked this conversation as resolved.

If you need to customize the HTTP behavior for S3 operations (e.g., timeouts, HTTP protocol version, or proxy settings), you can register a service with the ID `shopware.filesystem.s3.client`. When this service exists, Shopware injects it into both the filesystem adapter and pre-signed URL generation.

::: info
When you provide a custom HTTP client, AsyncAws will **not** wrap it in its own `RetryableHttpClient`. If you need retry behavior, you must configure it yourself as shown below.
:::

**Simple configuration** (custom timeouts, no retry handling):

```yaml
# config/packages/framework.yaml
framework:
http_client:
scoped_clients:
s3.http_client:
base_uri: '{your-s3-endpoint}'
timeout: 30.0
http_version: '1.1'

Check warning on line 248 in guides/hosting/infrastructure/filesystem.md

View workflow job for this annotation

GitHub Actions / Runner

[LanguageTool] reported by reviewdog 🐶 File types are normally capitalized. (FILE_EXTENSIONS_CASE[1]) Suggestions: `PHP` URL: https://languagetool.org/insights/post/spelling-capital-letters/ Rule: https://community.languagetool.org/rule/show/FILE_EXTENSIONS_CASE?lang=en-US&subId=1 Category: CASING Raw Output: guides/hosting/infrastructure/filesystem.md:248:26: File types are normally capitalized. (FILE_EXTENSIONS_CASE[1]) Suggestions: `PHP` URL: https://languagetool.org/insights/post/spelling-capital-letters/ Rule: https://community.languagetool.org/rule/show/FILE_EXTENSIONS_CASE?lang=en-US&subId=1 Category: CASING
```

```php
// config/services.php
Comment thread
umutdogan4291 marked this conversation as resolved.
<?php declare(strict_types=1);

use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $configurator): void {
$services = $configurator->services();

$services->alias('shopware.filesystem.s3.client', 's3.http_client');
};
```

**Recommended configuration** (custom settings with AWS retry support):

```yaml
# config/packages/framework.yaml
framework:
http_client:
scoped_clients:
s3.http_client:
base_uri: '{your-s3-endpoint}'
timeout: 30.0
http_version: '1.1'

Check warning on line 274 in guides/hosting/infrastructure/filesystem.md

View workflow job for this annotation

GitHub Actions / Runner

[LanguageTool] reported by reviewdog 🐶 File types are normally capitalized. (FILE_EXTENSIONS_CASE[1]) Suggestions: `PHP` URL: https://languagetool.org/insights/post/spelling-capital-letters/ Rule: https://community.languagetool.org/rule/show/FILE_EXTENSIONS_CASE?lang=en-US&subId=1 Category: CASING Raw Output: guides/hosting/infrastructure/filesystem.md:274:26: File types are normally capitalized. (FILE_EXTENSIONS_CASE[1]) Suggestions: `PHP` URL: https://languagetool.org/insights/post/spelling-capital-letters/ Rule: https://community.languagetool.org/rule/show/FILE_EXTENSIONS_CASE?lang=en-US&subId=1 Category: CASING
```

```php
// config/services.php
Comment thread
umutdogan4291 marked this conversation as resolved.
<?php declare(strict_types=1);

use AsyncAws\Core\HttpClient\AwsRetryStrategy;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symfony\Component\HttpClient\RetryableHttpClient;

use function Symfony\Component\DependencyInjection\Loader\Configurator\service;

return static function (ContainerConfigurator $configurator): void {
$services = $configurator->services();

$services->set(AwsRetryStrategy::class);

$services->set('shopware.filesystem.s3.client', RetryableHttpClient::class)
->args([
service('s3.http_client'),
service(AwsRetryStrategy::class),
3, // max retries
]);
};
```

This wraps your scoped client in a `RetryableHttpClient` with the same `AwsRetryStrategy` that AsyncAws uses by default, preserving retry behavior for AWS-specific transient errors while allowing you to control timeouts, HTTP version, and other transport-level settings.

**Without scoped clients** (standalone service definition with retry support):

Check warning on line 303 in guides/hosting/infrastructure/filesystem.md

View workflow job for this annotation

GitHub Actions / Runner

[LanguageTool] reported by reviewdog 🐶 File types are normally capitalized. (FILE_EXTENSIONS_CASE[1]) Suggestions: `PHP` URL: https://languagetool.org/insights/post/spelling-capital-letters/ Rule: https://community.languagetool.org/rule/show/FILE_EXTENSIONS_CASE?lang=en-US&subId=1 Category: CASING Raw Output: guides/hosting/infrastructure/filesystem.md:303:65: File types are normally capitalized. (FILE_EXTENSIONS_CASE[1]) Suggestions: `PHP` URL: https://languagetool.org/insights/post/spelling-capital-letters/ Rule: https://community.languagetool.org/rule/show/FILE_EXTENSIONS_CASE?lang=en-US&subId=1 Category: CASING

```php
// config/services.php
<?php declare(strict_types=1);

use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symfony\Component\HttpClient\HttpClient;
use Symfony\Component\HttpClient\RetryableHttpClient;
use Symfony\Contracts\HttpClient\HttpClientInterface;

use function Symfony\Component\DependencyInjection\Loader\Configurator\service;

return static function (ContainerConfigurator $configurator): void {
$services = $configurator->services();

$services->set('s3.http_client', HttpClientInterface::class)
->factory([HttpClient::class, 'create'])
->args([
['timeout' => 30],
]);

$services->set('shopware.filesystem.s3.client', RetryableHttpClient::class)
->args([
service('s3.http_client'),
null, // default retry strategy
3, // max retries
]);
};
```

This creates a plain HTTP client via `HttpClient::create()` with custom options and wraps it in a `RetryableHttpClient` with the default retry strategy.

### Google Cloud Platform

In order to use the Google Cloud Platform adapter you need to install the `league/flysystem-google-cloud-storage` package.
To use the Google Cloud Platform adapter, you need to install the `league/flysystem-google-cloud-storage` package.

```bash
composer require league/flysystem-google-cloud-storage
Expand Down Expand Up @@ -262,12 +374,12 @@
{
public function getType(): string
{
return 'my-adapter-prefix'; // This must match with the type in the yaml file
return 'my-adapter-prefix'; // This must match with the type in the YAML file
}

public function create(array $config): AdapterInterface
{
// $config contains the given config from the yaml
// $config contains the given config from the YAML
return new MyFlysystemAdapter($config);
}
}
Expand Down
Loading