From 04efa2ece88789df4105b5d2ecbeccb81bc157f9 Mon Sep 17 00:00:00 2001
From: Oliver Walters <oliver.henry.walters@gmail.com>
Date: Fri, 12 Jul 2019 00:14:40 +1000
Subject: [PATCH] Add simple deployment documentation

---
 docs/deploy.rst | 52 +++++++++++++++++++++++++++++++++++++++++++++++++
 docs/index.rst  |  1 +
 2 files changed, 53 insertions(+)
 create mode 100644 docs/deploy.rst

diff --git a/docs/deploy.rst b/docs/deploy.rst
new file mode 100644
index 0000000000..3e12368986
--- /dev/null
+++ b/docs/deploy.rst
@@ -0,0 +1,52 @@
+Deploying InvenTree
+===================
+
+.. toctree::
+   :titlesonly:
+   :maxdepth: 2
+   :caption: Deployment
+   :hidden:
+
+The development server provided by the Django ecosystem may be fine for a testing environment or small contained setups. However special consideration must be given when deploying InvenTree in a real-world environment.
+
+Django apps provide multiple deployment methods - see the `Django documentation <https://docs.djangoproject.com/en/2.2/howto/deployment/>`_.
+
+There are also numerous online tutorials describing how to deploy a Django application either locally or on an online platform.
+
+Following is a simple tutorial on serving InvenTree using `Gunicorn <https://gunicorn.org/>`_. Gunicorn is a Python WSGI server which provides a multi-worker server which is much better suited to handling multiple simultaneous requests. 
+
+Install Gunicorn
+----------------
+
+Gunicorn can be installed using PIP:
+
+`pip3 install gunicorn`
+
+
+Configure Static Directories
+----------------------------
+
+Directories for storing *media* files and *static* files should be specified in the ``config.yaml`` configuration file. These directories are the ``MEDIA_ROOT`` and ``STATIC_ROOT`` paths required by the Django app.
+
+Collect Static Files
+--------------------
+
+The required static files must be collected into the specified ``STATIC_ROOT`` directory. Run ``python3 manage.py collectstatic``
+
+Configure Gunicorn
+------------------
+
+The Gunicorn server can be configured with a simple configuration file (e.g. python script). An example configuration file is provided in ``InvenTree/gunicorn.conf.py``
+
+.. literalinclude :: ../InvenTree/gunicorn.conf.py
+   :language: python
+   :linenos:
+
+This file can be used to configure the Gunicorn server to match particular requirements.
+
+Run Gunicorn
+------------
+
+From the directory where ``manage.py`` is located:
+
+Run ``gunicorn -c gunicorn.conf.py InvenTree.wsgi``
\ No newline at end of file
diff --git a/docs/index.rst b/docs/index.rst
index e7a4f52bad..c90ff2fe25 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -9,6 +9,7 @@ InvenTree Source Documentation
 
    Getting Started<start>
    Configuration<config>
+   Deployment<deploy>
    Modal Forms<forms>
    Tables<tables>
    REST API<rest>