Skip to content

Commit

Permalink
fix comment
Browse files Browse the repository at this point in the history
  • Loading branch information
jrief committed Mar 17, 2018
1 parent 57c8d3a commit 089ad31
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 16 deletions.
4 changes: 3 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ Reference to classes and concepts used in **django-SHOP**
reference/filters
reference/cascade-plugins
reference/cart-checkout
reference/cart-icon
reference/payment-providers
reference/order
reference/delivery
Expand All @@ -64,8 +65,9 @@ Reference to classes and concepts used in **django-SHOP**
reference/configuration
reference/shipping-providers
reference/special-cms-pages
reference/cart-icon
reference/settings
reference/worker
reference/docker


How To's
Expand Down
32 changes: 18 additions & 14 deletions docs/reference/docker.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ installation becomes really simple. We make use of this in the demos, but these
are intended to run on a local docker machine, hence there we use the internal web server
provided by uWSGI_. In a productive environment, we usually use a web server to dispatch
HTTP requests onto a backend application server. This setup has been tested with NGiNX_,
which allows us to dispatch multiple server names using the same IP address. Moreover it
which allows us to dispatch multiple server names using the same IP address. Moreover, it
also terminates all https connections.


Expand All @@ -16,7 +16,7 @@ Get started with the django-SHOP container composition

Each instance of a **django-SHOP** installation consists of at least 3 Docker containers. Some of
them, such as ``postgres``, ``redis`` and ``elasticsearch`` are build from the standard images as
provided by Docker-Hub. The do not require customized Docker files.
provided by Docker-Hub. They do not require customized Docker files.

Only the one providing the merchant implementation must be built using a project specific
``Dockerfile``.
Expand Down Expand Up @@ -64,9 +64,9 @@ The latter is useful for testing the uWSGI application server, without having to
frontend. For example, this setup is used by the tutorial.

The directive ``exec-pre-app`` performs a database migration whenever a new version of the built
containers is started. This means that we can only perform forward migrations, which is the usually
case anyway. In the rare occasion we have to perform a backward migration, we have to do that
manually by entering into the running container.
containers is started. This means that we can only perform forward migrations, which is the usual
case anyway. In the rare occasion, when we have to perform a backward migration, we have to do that
manually by entering into the running container, using ``docker exec -ti containername /bin/bash``.

The directives ``static-map`` point onto the folders containing the collected static- and
media-files. These folders are referenced by the configuration directives ``STATIC_ROOT`` and
Expand Down Expand Up @@ -343,8 +343,8 @@ Check if everything is up and running:
nginxproxy_letsencrypt-nginx-proxy-companion_1 /bin/bash /app/entrypoint. ... Up
nginxproxy_nginx-proxy_1 /app/docker-entrypoint.sh ... Up 10.9.8.7:443->443/tcp, 10.9.8.7:80->80/tcp
Point a browser onto the IP address of our docker-machine will raise a Gateway error. This is
because our NGiNX yet does not know where to route incoming requests.
Pointing a browser onto the IP address of our docker-machine will raise a Gateway error. This is
intended behaviour, because our NGiNX yet does not know where to route incoming requests.


Provide django-SHOP behind NGiNX
Expand All @@ -355,11 +355,13 @@ For this we have to edit the file ``docker-compose.yml`` from above.

First locate the section ``wsgiapps``. There

* Add the environment variables ``VIRTUAL_HOST``, ``VIRTUAL_PROTO``, ``LETSENCRYPT_HOST``
and ``LETSENCRYPT_EMAIL`` to the subsection ``environment`` as shown below.
* Add network ``nginx-proxy`` to the networks configurations in subsection ``wsgiapp``
and globally, as shown below.
* Remove the ``ports`` configuration from subsection ``wsgiapp``.
* In section ``wsgiapp``, add the environment variables ``VIRTUAL_HOST``, ``VIRTUAL_PROTO``,
``LETSENCRYPT_HOST`` and ``LETSENCRYPT_EMAIL`` to subsection ``environment``, as shown below.
They are used to configure the NGiNX-Proxy.
* In section ``wsgiapp``, add ``nginx-proxy`` to subsection ``networks`` and to the global
section ``networks``, as shown below.
* Since we don't need to access our WSGI application via an externally reachable port, we can
remove the ``ports`` configuration from section ``wsgiapp``.

.. code-block:: yaml
:caption: docker-compose.yml
Expand Down Expand Up @@ -388,7 +390,7 @@ Re-create and run the Docker containers using:
$ docker-compose up --build -d
The container ``wsgiapp`` then starts to communicate with the container ``nginx-proxy`` and
reconfigures its virtual hosts settings without requiring any manual intervention. The same also
reconfigures its virtual hosts settings without requiring any other intervention. The same also
applies for the container ``letsencrypt-nginx-proxy-companion``, which then issues a certificate
from the Let's Encrypt Certification Authority. This may take a few minutes.

Expand All @@ -414,6 +416,8 @@ invoking:

$ docker container logs my_shop_webapp_1


.. _Docker: https://docs.docker.com/get-started/
.. _docker-compose: https://docs.docker.com/compose/overview/
.. _uWSGI: http://uwsgi.readthedocs.org/
.. _Let's Encrypt: https://letsencrypt.org/
.. _NGiNX: https://www.nginx.com/
2 changes: 1 addition & 1 deletion example/docker-files/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ RUN chown -R django.django $DJANGO_WORKDIR
#RUN git clone -b releases/0.13.x https://github.com/awesto/django-shop.git
#RUN cd django-shop/docs && make fragments

# expose service and volume to our internal Docker network
# keep media files in external volume
VOLUME $DJANGO_WORKDIR
1 change: 1 addition & 0 deletions shop/views/sitemap.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.contrib.sitemaps import Sitemap
from shop.models.product import ProductModel

Expand Down

0 comments on commit 089ad31

Please sign in to comment.