Skip to content

Commit

Permalink
Finish the documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
porduna committed Aug 26, 2017
1 parent 262ad13 commit a2a69e3
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 8 deletions.
32 changes: 32 additions & 0 deletions docs/source/advanced.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,38 @@ user will be assigned until the task is finished. So make sure that your task en
so as to not consume time of other users, and avoid starting tasks when the
``weblab_user.time_left`` is too short.

Multiple laboratories in the same server
----------------------------------------

If you are running multiple laboratories in the same server, you should configure a different ``WEBLAB_REDIS_BASE`` value and/or ``WEBLAB_REDIS_URL``. **weblablib** relies on Redis to store the current status of the users and the laboratory, so if you run both in the default database with the default redis base name, there might be conflicts.

To avoid this, either you use a different database (by default in Redis there are 16 databases, so you can use ``redis://localhost:6379/1`` or ``redis://localhost:6379/2``), or you can use the same one but using ``WEBLAB_REDIS_BASE`` different (e.g., ``lab1`` and ``lab2`` ). This would be recommended so later if you need to debug what is in Redis you can clearly see that there are values starting by ``lab1:`` or by ``lab2:`` refering to one or the other.

Multiple laboratories through the same server
---------------------------------------------

If you have 3 Raspberry Pi with different laboratories running, and, at the same time, you have
a single server that proxies requests to all, you may face session problems. To avoid this, please
rely on the Flask session configuration variables, such as:

.. tabularcolumns:: |p{6.5cm}|p{8.5cm}|

================================= =========================================
``SESSION_COOKIE_NAME`` The name of the cookie. By default it's
``session``, so it's better to change it
in each laboratory to ``lab1sess`` and
``lab2sess`` or similar.
``SESSION_COOKIE_PATH`` The path of the cookie. By default the
session cookie is stored in ``/``, but
this way you can make sure that if you put
``/lab1``, when the user goes to ``/lab2``,
no problem will arise.
``SECRET_KEY`` It is also recommendable that each lab have
a different key. If everything else fails,
at least the session created by other
laboratory will not affect to the present
one.
================================= =========================================

Forbidden page
--------------
Expand Down
55 changes: 47 additions & 8 deletions docs/source/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,65 @@
Configuration
=============



The following are the configuration variables of **weblablib**:

.. tabularcolumns:: |p{6.5cm}|p{8.5cm}|

================================= =========================================
``WEBLAB_USERNAME`` WebLab-Deusto credentials. It is not the
username of the new user: it represents
username of the new user: it represents
the system itself (e.g., the WebLab-Deusto
system calling). **Mandatory**
``WEBLAB_PASSWORD`` WebLab-Deusto credentials. Read also
``WEBLAB_PASSWORD`` WebLab-Deusto credentials. Read also
``WEBLAB_USERNAME``. **Mandatory**
``WEBLAB_CALLBACK_URL`` **weblablib** creates a set or URLs for
receiving methods directly by the user.
``WEBLAB_CALLBACK_URL`` **weblablib** creates a set or URLs for
receiving methods directly by the user.
This methods must be publicly available by
the student. It can be ``/mylab/callback``.
**Mandatory** (unless you provide
**Mandatory** (unless you provide
``callback_url`` parameter to the ``WebLab``
constructor).
``WEBLAB_BASE_URL`` If you want to start /weblab/sessions
``WEBLAB_BASE_URL`` If you want to start /weblab/sessions
somewhere else (e.g., ``/mylab``), you can
configure it here.
``WEBLAB_REDIS_URL`` Url used for connecting to Redis. By
default it's the database 0 with localhost
and standard port, but you can configure it:
``redis://localhost:6379/``.
``WEBLAB_REDIS_BASE`` If you use multiple laboratories in the same
server, you should give different values to
this configuration so there is no conflict
in Redis. If one is ``lab1`` and the other
is ``lab2``, in Redis values will start by
``lab1:`` or ``lab2:``.
``WEBLAB_SESSION_ID_NAME`` The name that the **weblablib** session will
have in the Flask **session** object.
``WEBLAB_TIMEOUT`` Value in seconds taken by **weblablib** to
consider a user expired if s/he hasn't polled
in this time.
``WEBLAB_AUTOPOLL`` If ``True`` (default value), it will make
that every call to the server will call
``poll``.
``WEBLAB_UNAUTHORIZED_LINK`` When a user is not logged in (or the session
expired -after an hour-, by default finds an
``Access forbidden`` message. You can put
a link here to redirect him to a different
URL (such as your WebLab-Deusto system, so
the student is forced to log in).
``WEBLAB_UNAUTHORIZED_TEMPLATE`` Same as ``WEBLAB_UNAUTHORIZED_LINK``, but
instead of redirecting, it renders a template.
If you put ``forbidden.html``, it will render
whatever is in ``templates/forbidden.html``.
``WEBLAB_SCHEME`` If set to ``https``, forces using ``https`` in
the link sent to the user.
``WEBLAB_EXPIRED_USERS_TIMEOUT`` Once the user is expired, the information is
kept in Redis for some time. By default, this
is ``3600`` (seconds, which is one hour).
``WEBLAB_AUTOCLEAN_THREAD`` By default ``True``, it states whether there
will be a thread by process cleaning sessions
of expired users or not.
``WEBLAB_TASK_THREADS_PROCESS`` By default ``3``, it is the number of threads
in each **weblablib** process running tasks
submitted by user.
================================= =========================================

0 comments on commit a2a69e3

Please sign in to comment.