Skip to content

Commit

Permalink
Updating instructions for Flysystem 3 (#827)
Browse files Browse the repository at this point in the history
  • Loading branch information
mamazu authored Dec 18, 2024
1 parent 7d4b09d commit 82a5794
Showing 1 changed file with 5 additions and 74 deletions.
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>[email protected]",
"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

0 comments on commit 82a5794

Please sign in to comment.