Skip to content

Commit

Permalink
feat: create volume for private LMS/CMS media assets (#1124)
Browse files Browse the repository at this point in the history
Content Libraries will store asset files like images, transcripts, and
PDFs using Learning Core–which in turn uses django-storages and expects
some backing file store. These files should NOT be directly accessible
via the browser, both because of access policies and the fact that the
filenames will not be meaningful by themselves and must be translated by
app logic. For details see:

* https://github.com/openedx/openedx-learning/blob/main/docs/decisions/0015-serving-static-assets.rst
* https://github.com/openedx/openedx-learning/blob/main/openedx_learning/apps/authoring/contents/models.py
* https://github.com/openedx/openedx-learning/blob/main/openedx_learning/apps/authoring/components/models.py

The existing /data/openedx-media -> /openedx/media mount is publicly
accessible by browser, and so is not appropriate for this purpose. This
commit creates a parallel /data/openedx-media-private ->
/openedx/media-private volume mapping instead.

This commit also creates configuration needed for openedx-learning to
point to this new directory.

This commit does NOT currently add support for this in k8s, as that will
require changes to the minio plugin.
  • Loading branch information
ormsbee authored Oct 2, 2024
1 parent c7b8cef commit 6843f14
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.d/20240926_151223_dave_private_media.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- [Feature] Create a new /data/openedx-media-private volume to store media files that are not publicly accessible via the browser, and create configuration that Learning Core (openedx-learning) will use to access this storage space. Learning Core will use a sub-directory of /data/openedx-media-private to store Content Library file uploads, but other apps can create their own sub-directories for their own use. (by @ormsbee)
9 changes: 9 additions & 0 deletions tutor/templates/apps/openedx/settings/partials/common_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,5 +246,14 @@
"user": None,
}

OPENEDX_LEARNING = {
'MEDIA': {
"BACKEND": "django.core.files.storage.FileSystemStorage",
"OPTIONS": {
"location": "/openedx/media-private/openedx-learning",
}
}
}

{{ patch("openedx-common-settings") }}
######## End of settings common to LMS and CMS
5 changes: 5 additions & 0 deletions tutor/templates/local/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ services:
- ../../data/lms:/mounts/lms
- ../../data/cms:/mounts/cms
- ../../data/openedx-media:/mounts/openedx
- ../../data/openedx-media-private:/mounts/openedx-private
{% if RUN_MONGODB %}- ../../data/mongodb:/mounts/mongodb{% endif %}
{% if RUN_MYSQL %}- ../../data/mysql:/mounts/mysql{% endif %}
{% if RUN_ELASTICSEARCH %}- ../../data/elasticsearch:/mounts/elasticsearch{% endif %}
Expand Down Expand Up @@ -112,6 +113,7 @@ services:
- ../apps/openedx/uwsgi.ini:/openedx/uwsgi.ini:ro
- ../../data/lms:/openedx/data
- ../../data/openedx-media:/openedx/media
- ../../data/openedx-media-private:/openedx/media-private
{%- for mount in iter_mounts(MOUNTS, "openedx", "lms") %}
- {{ mount }}
{%- endfor %}
Expand All @@ -138,6 +140,7 @@ services:
- ../apps/openedx/uwsgi.ini:/openedx/uwsgi.ini:ro
- ../../data/cms:/openedx/data
- ../../data/openedx-media:/openedx/media
- ../../data/openedx-media-private:/openedx/media-private
{%- for mount in iter_mounts(MOUNTS, "openedx", "cms") %}
- {{ mount }}
{%- endfor %}
Expand Down Expand Up @@ -166,6 +169,7 @@ services:
- ../apps/openedx/config:/openedx/config:ro
- ../../data/lms:/openedx/data
- ../../data/openedx-media:/openedx/media
- ../../data/openedx-media-private:/openedx/media-private
{%- for mount in iter_mounts(MOUNTS, "openedx", "lms-worker") %}
- {{ mount }}
{%- endfor %}
Expand All @@ -185,6 +189,7 @@ services:
- ../apps/openedx/config:/openedx/config:ro
- ../../data/cms:/openedx/data
- ../../data/openedx-media:/openedx/media
- ../../data/openedx-media-private:/openedx/media-private
{%- for mount in iter_mounts(MOUNTS, "openedx", "cms-worker") %}
- {{ mount }}
{%- endfor %}
Expand Down

0 comments on commit 6843f14

Please sign in to comment.