diff --git a/CHANGELOG.md b/CHANGELOG.md index 5af6cca..6291864 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ Note: Breaking changes between versions are indicated by "💥". ## Latest +- [Bugfix] Fix missing video transcripts in LMS (#229) - [Improvement] Make it possible to enable/disable multiple plugins at once - [Improvement] Add 'local-docker-compose-nginx-volumes' patch diff --git a/tutor/templates/apps/nginx/cms.conf b/tutor/templates/apps/nginx/cms.conf index cacb778..4a82a6c 100644 --- a/tutor/templates/apps/nginx/cms.conf +++ b/tutor/templates/apps/nginx/cms.conf @@ -40,7 +40,7 @@ server { } location ~ ^/media/(?P.*) { - root /openedx/data/cms/uploads; + root /var/www/openedx-media; try_files /$file =404; expires 31536000s; } diff --git a/tutor/templates/apps/nginx/lms.conf b/tutor/templates/apps/nginx/lms.conf index 59e0dfc..1a22908 100644 --- a/tutor/templates/apps/nginx/lms.conf +++ b/tutor/templates/apps/nginx/lms.conf @@ -56,7 +56,7 @@ server { } location ~ ^/media/(?P.*) { - root /openedx/data/lms/uploads; + root /var/www/openedx-media; try_files /$file =404; expires 31536000s; } diff --git a/tutor/templates/apps/openedx/config/cms.env.json b/tutor/templates/apps/openedx/config/cms.env.json index 9c9aa1c..80a9e96 100644 --- a/tutor/templates/apps/openedx/config/cms.env.json +++ b/tutor/templates/apps/openedx/config/cms.env.json @@ -22,7 +22,6 @@ "CELERY_BROKER_USER": "{{ RABBITMQ_USERNAME }}", "CELERY_BROKER_PASSWORD": "{{ RABBITMQ_PASSWORD }}", "COMPREHENSIVE_THEME_DIRS": ["/openedx/themes"], - "MEDIA_ROOT": "/openedx/data/uploads/", "STATIC_ROOT_BASE": "/openedx/staticfiles", "ELASTIC_SEARCH_CONFIG": [{ "host": "{{ ELASTICSEARCH_HOST }}", diff --git a/tutor/templates/apps/openedx/config/lms.env.json b/tutor/templates/apps/openedx/config/lms.env.json index 0fbf2de..82fa71c 100644 --- a/tutor/templates/apps/openedx/config/lms.env.json +++ b/tutor/templates/apps/openedx/config/lms.env.json @@ -28,7 +28,6 @@ "COMMENTS_SERVICE_URL": "http://{{ FORUM_HOST }}:4567", "COMMENTS_SERVICE_KEY": "forumapikey", "COMPREHENSIVE_THEME_DIRS": ["/openedx/themes"], - "MEDIA_ROOT": "/openedx/data/uploads/", "STATIC_ROOT_BASE": "/openedx/staticfiles", "ELASTIC_SEARCH_CONFIG": [{ "host": "{{ ELASTICSEARCH_HOST }}", diff --git a/tutor/templates/apps/openedx/settings/cms/common.py b/tutor/templates/apps/openedx/settings/cms/common.py index 4353dda..71629db 100644 --- a/tutor/templates/apps/openedx/settings/cms/common.py +++ b/tutor/templates/apps/openedx/settings/cms/common.py @@ -2,7 +2,7 @@ update_module_store_settings(MODULESTORE, doc_store_settings=DOC_STORE_CONFIG) # Set uploaded media file path -MEDIA_ROOT = "/openedx/data/uploads/" +MEDIA_ROOT = "/openedx/media/" # Video settings VIDEO_IMAGE_SETTINGS["STORAGE_KWARGS"]["location"] = MEDIA_ROOT diff --git a/tutor/templates/apps/openedx/settings/lms/common.py b/tutor/templates/apps/openedx/settings/lms/common.py index 8d61d98..37b320d 100644 --- a/tutor/templates/apps/openedx/settings/lms/common.py +++ b/tutor/templates/apps/openedx/settings/lms/common.py @@ -4,7 +4,7 @@ update_module_store_settings(MODULESTORE, doc_store_settings=DOC_STORE_CONFIG) # Set uploaded media file path -MEDIA_ROOT = "/openedx/data/uploads/" +MEDIA_ROOT = "/openedx/media/" # Video settings VIDEO_IMAGE_SETTINGS["STORAGE_KWARGS"]["location"] = MEDIA_ROOT @@ -31,7 +31,6 @@ PROFILE_IMAGE_BACKEND["options"]["location"] = os.path.join( MEDIA_ROOT, "profile-images/" ) - ORA2_FILEUPLOAD_BACKEND = "filesystem" ORA2_FILEUPLOAD_ROOT = "/openedx/data/ora2" ORA2_FILEUPLOAD_CACHE_NAME = "ora2-storage" @@ -40,7 +39,7 @@ GRADES_DOWNLOAD = { "STORAGE_TYPE": "", "STORAGE_KWARGS": { "base_url": "/media/grades/", - "location": os.path.join(MEDIA_ROOT, "grades"), + "location": "/openedx/media/grades", }, } diff --git a/tutor/templates/hooks/cms/init b/tutor/templates/hooks/cms/init index 66b266c..d21c0a4 100644 --- a/tutor/templates/hooks/cms/init +++ b/tutor/templates/hooks/cms/init @@ -1 +1,10 @@ dockerize -wait tcp://{{ MYSQL_HOST }}:{{ MYSQL_PORT }} -timeout 20s && ./manage.py cms migrate + +# Fix incorrect uploaded file path +if [ -d /openedx/data/uploads/ ]; then + if [ -n "$(ls -A /openedx/data/uploads/)" ]; then + echo "Migrating CMS uploaded files to shared directory" + mv /openedx/data/uploads/* /openedx/media/ + rm -rf /openedx/data/uploads/ + fi +fi \ No newline at end of file diff --git a/tutor/templates/hooks/lms/init b/tutor/templates/hooks/lms/init index b4f1e78..b583fb9 100644 --- a/tutor/templates/hooks/lms/init +++ b/tutor/templates/hooks/lms/init @@ -4,4 +4,13 @@ dockerize -wait tcp://{{ MYSQL_HOST }}:{{ MYSQL_PORT }} -timeout 20s ./manage.py lms --settings=tutor.production create_oauth2_client \ "http://androidapp.com" "http://androidapp.com/redirect" public \ --client_id android --client_secret {{ ANDROID_OAUTH2_SECRET }} \ - --trusted \ No newline at end of file + --trusted + +# Fix incorrect uploaded file path +if [ -d /openedx/data/uploads/ ]; then + if [ -n "$(ls -A /openedx/data/uploads/)" ]; then + echo "Migrating LMS uploaded files to shared directory" + mv /openedx/data/uploads/* /openedx/media/ + rm -rf /openedx/data/uploads/ + fi +fi \ No newline at end of file diff --git a/tutor/templates/local/docker-compose.yml b/tutor/templates/local/docker-compose.yml index f07aaf3..75bb9ec 100644 --- a/tutor/templates/local/docker-compose.yml +++ b/tutor/templates/local/docker-compose.yml @@ -69,8 +69,7 @@ services: volumes: - ../apps/nginx:/etc/nginx/conf.d/:ro - ../../data/openedx:/var/www/openedx:ro - {% if ACTIVATE_CMS %}- ../../data/cms:/openedx/data/cms/:ro{% endif %} - {% if ACTIVATE_LMS %}- ../../data/lms:/openedx/data/lms/:ro{% endif %} + - ../../data/openedx-media:/var/www/openedx-media:ro {% if ACTIVATE_HTTPS %}- ../../data/letsencrypt:/etc/letsencrypt/:ro{% endif %} {{ patch("local-docker-compose-nginx-volumes")|indent(6) }} depends_on: @@ -121,6 +120,7 @@ services: - ../apps/openedx/settings/cms/:/openedx/edx-platform/cms/envs/tutor/ - ../apps/openedx/config/:/openedx/config/ - ../../data/lms:/openedx/data + - ../../data/openedx-media:/openedx/media depends_on: {% if ACTIVATE_ELASTICSEARCH %}- elasticsearch{% endif %} {% if ACTIVATE_FORUM %}- forum{% endif %} @@ -143,6 +143,7 @@ services: - ../apps/openedx/settings/cms/:/openedx/edx-platform/cms/envs/tutor/ - ../apps/openedx/config/:/openedx/config/ - ../../data/cms:/openedx/data + - ../../data/openedx-media:/openedx/media depends_on: {% if ACTIVATE_ELASTICSEARCH %}- elasticsearch{% endif %} {% if ACTIVATE_MEMCACHED %}- memcached{% endif %} @@ -168,6 +169,7 @@ services: - ../apps/openedx/settings/cms/:/openedx/edx-platform/cms/envs/tutor/ - ../apps/openedx/config/:/openedx/config/ - ../../data/lms:/openedx/data + - ../../data/openedx-media:/openedx/media depends_on: - lms {% endif %} @@ -186,6 +188,7 @@ services: - ../apps/openedx/settings/cms/:/openedx/edx-platform/cms/envs/tutor/ - ../apps/openedx/config/:/openedx/config/ - ../../data/cms:/openedx/data + - ../../data/openedx-media:/openedx/media depends_on: - cms {% endif %}