Skip to content

Commit

Permalink
add documentation for media storage filesystem
Browse files Browse the repository at this point in the history
  • Loading branch information
George Babarus committed May 24, 2020
0 parents commit 8579c45
Show file tree
Hide file tree
Showing 32 changed files with 874 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
venv
.idea
1 change: 1 addition & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
52 changes: 52 additions & 0 deletions docs/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
.. role:: raw-html-m2r(raw)
:format: html

Magento file (cloud) storage systems integration for media files
===================================================================

Storing media files involve some work when you decide to scale horizontally.
Also having to care about disk space and disk mounting may be useless when you are already have a easy to use object storage service.

There are plenty of cloud static files storage services offered with various feature but most of them have same basic ideas:

* allow secure upload remotely of files
* deliver static file public or privately
* built in Content delivery network (CDN)

With this idea in mind you can identify a use-case for e-commerce website for storing images and video for products, categories or CMS pages and deliver them using a CDN. Or even storing private content like downloadable products.

Using cloud storage should be easy to configure and use, ans should not add additional complexity to the system but on contrary.

Reed the documentation https://magento-filesystem-extension-docs.readthedocs.io to see some of the key advantages of using this Magento 2 extension to integrate with various cloud file storage systems in a platform agnostic manner.


Useful links
============

Read more about Object Storage services online:

* Amazon Simple Storage Service S3
https://docs.aws.amazon.com/s3/index.html
* Azure Cloud File Storage/Blob storage
https://azure.microsoft.com/en-us/services/storage/blobs
* Google Cloud Storage
https://cloud.google.com/storage
* Digital Ocean Block Storage
https://www.digitalocean.com/products/block-storage/
* Linode Object storage
https://www.linode.com/products/object-storage/

Read more about CDN:

* Amazon CloudFront
https://aws.amazon.com/cloudfront/
* Azure CDN
https://docs.microsoft.com/en-us/azure/cdn/
* Akamai
https://www.akamai.com/


Author
======

`George Babarus <https://github.com/georgebabarus>`_
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

if "%1" == "" goto help

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
Binary file added docs/source/.DS_Store
Binary file not shown.
20 changes: 20 additions & 0 deletions docs/source/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SPHINXPROJ = ReadtheDocsSphinxTheme
SOURCEDIR = .
BUILDDIR = ./../build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
Empty file added docs/source/_static/.gitignore
Empty file.
9 changes: 9 additions & 0 deletions docs/source/_static/analytics.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-54395432-3"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'UA-54395432-3');
</script>
Binary file added docs/source/_static/migration-to-cloud.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/_static/on-premises-deployment.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
7 changes: 7 additions & 0 deletions docs/source/_templates/layout.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{% extends "!layout.html" %}


{% block extrahead %}
{{ super() }}
<meta name="google-site-verification" content="HFkKCMbj7JNJkz8cCQcdI-1wvQzt9G5yxqEGKhT9dW0" />
{% endblock %}
54 changes: 54 additions & 0 deletions docs/source/architecture/architecture.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@

*******************************************
Extension architecture
*******************************************

.. note::
Before going deeper into the development details, please note that the this Magento 2 module is extending core module interfaces, keeping in mind the backward compatibility and keeping the changes as low asa possible.

.. contents:: Table of Contents

Upload images in admin area
================================

Uploading files form user interfaces or programmatically at product should be compatible with any customization as log as is using Magento standard interfaces.

Nevertheless the business logic is not changed, and cloud storage services are added using regular/local filesystem interface.

.. image:: static/upload-image.jpg
:alt: Upload image for product or CMS blocks

.. note::
Uploading products attachments for downloadable products works just like uploading the product image showed in the above schema.

.. note::
Features: :term:`WOOB` :term:`v0.0.1`


Frontend resized image delivery
================================

Resized images could be delivered directly from storage system after creating the resized image in the main request or return a proxy url responsible to return the image if not exist.

The proxy can be implemented as follow:

* nginx config to request it from storage system and create a fallback request in case of error on Magento resize script
* in case you don't have access to a web server proxy configuration there is a option to return it directly from default Magento image resize script.

.. image:: static/frontend-image-delivery.jpg
:alt: Upload image for product or CMS blocks

.. note::
:term:`SWSCNO` :term:`v0.0.1`


Frontend image delivery for original images
============================================

Original images could be delivered directly from storage system, or the CDN in front of it, by configuring the base media url in admin configuration under Store -> Configuration.

.. note::
:term:`WOOB` :term:`v0.0.1`

.. raw:: html
:file: ./../_static/analytics.html
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8579c45

Please sign in to comment.