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 22, 2020
0 parents commit ffda640
Show file tree
Hide file tree
Showing 27 changed files with 763 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)
23 changes: 23 additions & 0 deletions docs/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.. role:: raw-html-m2r(raw)
:format: html

Introduction
============

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 using cloud infrastructure.

Using cloud storage like Amazon S3 Storage, Azure Blob Storage, or Google Cloud Storage should be easy to configure and use.

See bellow 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
============

* https://aws.amazon.com/s3/

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.
29 changes: 29 additions & 0 deletions docs/source/architecture/architecture.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

*******************************************
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
:target: ../_images/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.

.. warning::
Features: :term:`WOOB`

.. raw:: html
:file: ./../_static/analytics.html
134 changes: 134 additions & 0 deletions docs/source/architecture/static/logo-wordmark-light.svg
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/architecture/static/upload-image.jpg
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/architecture/static/upload-image.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions docs/source/changelog.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
*********
Changelog
*********

master
======

New Features
-------------

Fixes
-----

Other Changes
--------------

v0.0.1
======
* This version contain only minimum code base to prove that Cloud storage service could easily and fully integrate in Magento 2 without any need for disk storage on application server.

New Features
-------------
* Media storage driver for Amazon S3
* Magento core changes to improve filesystem abstraction

Other Changes
--------------
* Documentation created


.. raw:: html
:file: _static/analytics.html

124 changes: 124 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
# -*- coding: utf-8 -*-

import sys
import os
import re

if not 'READTHEDOCS' in os.environ:
sys.path.insert(0, os.path.abspath('..'))
sys.path.append(os.path.abspath('./customization/'))

from sphinx.locale import _
from sphinx_rtd_theme import __version__
import recommonmark
from recommonmark.transform import AutoStructify

project = u'Magento 2 Filesystem Storage'
slug = re.sub(r'\W+', '-', project.lower())
version = __version__
release = __version__
author = u'George Babarus'
copyright = author
language = 'en'

extensions = [
'sphinx.ext.intersphinx',
'sphinx.ext.autodoc',
'sphinx.ext.mathjax',
'sphinx.ext.viewcode',
'sphinxcontrib.httpdomain',
'sphinx_rtd_theme',
'recommonmark'
]
images_config = {

}
autosectionlabel_prefix_document = True

templates_path = ['_templates']
html_static_path = ['_static']

source_suffix = {
'.rst': 'restructuredtext',
'.txt': 'markdown',
'.md': 'markdown',
}

source_parsers = {
}

exclude_patterns = [
'requirements.txt'
]
locale_dirs = ['locale/']
gettext_compact = False

master_doc = 'index'
suppress_warnings = ['image.nonlocal_uri']
pygments_style = 'default'

intersphinx_mapping = {
'rtd': ('https://docs.readthedocs.io/en/latest/', None),
'sphinx': ('http://www.sphinx-doc.org/en/stable/', None),
}

html_theme = 'sphinx_rtd_theme'
html_theme_options = {
'logo_only': True,
'navigation_depth': 5,
'analytics_id': 'UA-54395432-3'
}
html_theme_path = ["../.."]
html_logo = "customization/static/logo-wordmark-light.svg"
html_show_sourcelink = True

htmlhelp_basename = slug


latex_documents = [
('index', '{0}.tex'.format(slug), project, author, 'manual'),
]

man_pages = [
('index', slug, project, [author], 1)
]

texinfo_documents = [
('index', slug, project, author, slug, project, 'Miscellaneous'),
]


# Extensions to theme docs
def setup(app):
from sphinx.domains.python import PyField
from sphinx.util.docfields import Field

app.add_object_type(
'confval',
'confval',
objname='configuration value',
indextemplate='pair: %s; configuration value',
doc_field_types=[
PyField(
'type',
label=_('Type'),
has_arg=False,
names=('type',),
bodyrolename='class'
),
Field(
'default',
label=_('Default'),
has_arg=False,
names=('default',),
),
]
)
app.add_config_value('recommonmark_config', {
# 'url_resolver': lambda url: github_doc_root + url,
'auto_toc_tree_section': 'Contents',
'enable_math': False,
'enable_inline_math': False,
'enable_eval_rst': True,
}, True)
app.add_transform(AutoStructify)
12 changes: 12 additions & 0 deletions docs/source/configuration.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
*************
Configuration
*************

.. contents:: Table of Contents


Configuration files
===================

.. raw:: html
:file: _static/analytics.html
13 changes: 13 additions & 0 deletions docs/source/customization/extendable.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

*******************************************
Extend filesystem to achieve more from shop
*******************************************

.. contents:: Table of Contents

Built with extensibility in mind
================================


.. raw:: html
:file: ./../_static/analytics.html

0 comments on commit ffda640

Please sign in to comment.