6
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-12-13 14:43:03 +00:00

feat: allow to specify extra pip packages in config

Added OPENEDX_EXTRA_PIP_REQUIREMENTS setting, which allows to specify
extra pip packages that should be installed.

Moved "openedx-scorm-xblock" package from Dockerfile to the new setting
in the config.yml.
This commit is contained in:
Maxim Beder 2021-11-17 19:37:35 +01:00 committed by Régis Behmo
parent 5604cd4bf8
commit 19157d94bc
4 changed files with 31 additions and 4 deletions

View File

@ -5,6 +5,7 @@ Note: Breaking changes between versions are indicated by "💥".
## Unreleased
- [Bugfix] Remove trailing slashes in docker-compose files for [compatibility with docker-compose v2 in WSL](https://github.com/docker/compose/issues/8558).
- [Improvement] `settheme` now works with preview domain.
- [Feature] Allow specifying extra pip packages through config.yml.
## v12.1.7 (2021-11-18)

View File

@ -93,6 +93,12 @@ By default there are 2 `uwsgi worker processes <https://uwsgi-docs.readthedocs.i
These two configuration parameters define which redis database to use for Open edX cache and celery task.
.. _openedx_extra_pip_requirements:
- ``OPENEDX_EXTRA_PIP_REQUIREMENTS`` (default: ``openedx-scorm-xblock<13.0.0,>=12.0.0``)
This defines extra pip packages that are going to be installed for Open edX.
Vendor services
~~~~~~~~~~~~~~~
@ -237,14 +243,32 @@ See :ref:`the corresponding tutorial <theming>`.
Installing extra xblocks and requirements
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Would you like to include custom xblocks, or extra requirements to your Open edX platform? Additional requirements can be added to the ``env/build/openedx/requirements/private.txt`` file. For instance, to include the `polling xblock from Opencraft <https://github.com/open-craft/xblock-poll/>`_::
Would you like to include custom xblocks, or extra requirements to your Open edX platform? Additional requirements can be added to the ``OPENEDX_EXTRA_PIP_REQUIREMENTS`` parameter in the :ref:`config file <configuration>` or to the ``env/build/openedx/requirements/private.txt`` file. The difference between them, is that ``private.txt`` file, even though it could be used for both, :ref:`should be used for installing extra xblocks or requirements from private repositories <extra_private_xblocks>`. For instance, to include the `polling xblock from Opencraft <https://github.com/open-craft/xblock-poll/>`_:
- add the following to the ``config.yml``::
OPENEDX_EXTRA_PIP_REQUIREMENTS:
- "git+https://github.com/open-craft/xblock-poll.git"
.. warning::
Specifying extra requirements through ``config.yml`` overwrites :ref:`the default extra requirements<openedx_extra_pip_requirements>`. You might need to add them to the list, if your configuration depends on them.
- or add the dependency to ``private.txt``::
echo "git+https://github.com/open-craft/xblock-poll.git" >> "$(tutor config printroot)/env/build/openedx/requirements/private.txt"
Then, the ``openedx`` docker image must be rebuilt::
tutor images build openedx
.. _extra_private_xblocks:
Installing extra requirements from private repositories
*******************************************************
When installing extra xblock or requirements from private repositories, ``private.txt`` file should be used, because it allows to install dependencies without adding git credentials to the Docker image. By adding your git credentials to the Docker image, you're risking leaking your git credentials, if you were to publish (intentionally or unintentionally) the Docker image in a public place.
To install xblocks from a private repository that requires authentication, you must first clone the repository inside the ``openedx/requirements`` folder on the host::
git clone git@github.com:me/myprivaterepo.git "$(tutor config printroot)/env/build/openedx/requirements/myprivaterepo"

View File

@ -81,9 +81,6 @@ RUN pip install setuptools==44.1.0 pip==20.0.2 wheel==0.34.2
# Install base requirements
RUN pip install -r ./requirements/edx/base.txt
# Install scorm xblock
RUN pip install "openedx-scorm-xblock<13.0.0,>=12.0.0"
# Install django-redis for using redis as a django cache
RUN pip install django-redis==4.12.1
@ -98,6 +95,9 @@ RUN cd /openedx/requirements/ \
&& touch ./private.txt \
&& pip install -r ./private.txt
{% for extra_requirements in OPENEDX_EXTRA_PIP_REQUIREMENTS %}RUN pip install '{{ extra_requirements }}'
{% endfor %}
###### Install nodejs with nodeenv in /openedx/nodeenv
FROM python as nodejs-requirements
ENV PATH /openedx/nodeenv/bin:/openedx/venv/bin:${PATH}

View File

@ -62,6 +62,8 @@ OPENEDX_MYSQL_DATABASE: "openedx"
OPENEDX_CSMH_MYSQL_DATABASE: "{{ OPENEDX_MYSQL_DATABASE }}_csmh"
OPENEDX_MYSQL_USERNAME: "openedx"
OPENEDX_COMMON_VERSION: "open-release/lilac.3"
OPENEDX_EXTRA_PIP_REQUIREMENTS:
- "openedx-scorm-xblock<13.0.0,>=12.0.0"
MYSQL_HOST: "mysql"
MYSQL_PORT: 3306
MYSQL_ROOT_USERNAME: "root"