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

Updating instructions for Flysystem 3 #827

Merged
merged 1 commit into from
Dec 18, 2024
Merged
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
79 changes: 5 additions & 74 deletions cookbook/external-media-storage.rst
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
Store Media in an external Storage
==================================

Sulu is able to upload newly created media files directly to an external storage provider (such as AWS S3 or
Google Cloud Storage).
Sulu stores its media with the `flysystem file system abstraction`_. This allows you to configure different storage backends easily.

AWS-S3
------
By default this uses the local file system storage. A list of other supported storage backends and their installation instructions
can be found here: https://github.com/thephpleague/flysystem-bundle/blob/3.x/docs/2-cloud-storage-providers.md

First install dependencies.

.. code-block:: bash

composer require "league/flysystem:^1.0" "league/flysystem-aws-s3-v3:^1.0.1"

Configure the storage with following yaml-snippet:
If you want to set up multiple storage backends you have to configure which of those to use for sulu media which can be done like this:

.. code-block:: yaml

Expand All @@ -30,66 +23,4 @@ Configure the storage with following yaml-snippet:
If you use s3 compatible services (e.g. minio) you can pass additional ``arguments`` and ``endpoint`` to the
configuration.

Google Cloud-Storage
--------------------

First follow this the `Google Cloud Documentation`_ to setup a System-Account and download the json-key.

.. code-block:: json

{
"type": "service_account",
"project_id": "project-id",
"private_key_id": "some_number",
"private_key": "-----BEGIN PRIVATE KEY-----\n....
=\n-----END PRIVATE KEY-----\n",
"client_email": "<api-name>api@project-id.iam.gserviceaccount.com",
"client_id": "...",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://accounts.google.com/o/oauth2/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/...<api-name>api%40project-id.iam.gserviceaccount.com"
}

Install the dependencies:

.. code-block:: bash

composer require "league/flysystem:^1.0" "superbalist/flysystem-google-storage:^7.1"

Dump this file to a readable folder on your machine and configure the storage with following yaml-snippet:

.. code-block:: yaml

sulu_media:
storage: google_cloud
storages:
google_cloud:
key_file_path: '/path/to/key.json'
bucket_name: 'sulu-bucket'
path_prefix: 'optional path prefix'

.. _Google Cloud Documentation: https://cloud.google.com/video-intelligence/docs/common/auth#set_up_a_service_account


Azure Blob Storage
------------------

First install dependencies.

.. code-block:: bash

composer require "league/flysystem:^1.0" "league/flysystem-azure-blob-storage:^0.1"

Configure the storage with following yaml-snippet:

.. code-block:: yaml

sulu_media:
storage: azure_blob
storages:
azure_blob:
connection_string: 'DefaultEndpointsProtocol=https;AccountName={YOUR_ACCOUNT_NAME};AccountKey={YOUR_ACCOUNT_KEY};'
container_name: 'container-name'
path_prefix: 'optional path prefix'

.. _flysystem file system abstraction: https://github.com/thephpleague/flysystem
Loading