From 78b77d11310e58943ea26172c9d4f4e7f8369019 Mon Sep 17 00:00:00 2001 From: Muhammad Faraz Maqsood Date: Wed, 30 Oct 2024 19:33:55 +0500 Subject: [PATCH] feat: add new private bucket for openedx-learning - add a new bucket to handle private media for openedx-learning. - add changelog entry. --- ...ate_bucket_to_handle_private_media_for_openedx_learning.md | 1 + tutorminio/patches/openedx-common-settings | 4 ++++ tutorminio/plugin.py | 1 + tutorminio/templates/minio/tasks/minio/init.sh | 2 +- 4 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 changelog.d/20241010_164910_faraz.maqsood_add_private_bucket_to_handle_private_media_for_openedx_learning.md diff --git a/changelog.d/20241010_164910_faraz.maqsood_add_private_bucket_to_handle_private_media_for_openedx_learning.md b/changelog.d/20241010_164910_faraz.maqsood_add_private_bucket_to_handle_private_media_for_openedx_learning.md new file mode 100644 index 0000000..7fae714 --- /dev/null +++ b/changelog.d/20241010_164910_faraz.maqsood_add_private_bucket_to_handle_private_media_for_openedx_learning.md @@ -0,0 +1 @@ +- [Feature] Add a new bucket to handle private media for openedx-learning. (by @Faraz32123) diff --git a/tutorminio/patches/openedx-common-settings b/tutorminio/patches/openedx-common-settings index be605a5..7bc9c86 100644 --- a/tutorminio/patches/openedx-common-settings +++ b/tutorminio/patches/openedx-common-settings @@ -3,6 +3,10 @@ VIDEO_IMAGE_SETTINGS["STORAGE_KWARGS"]["location"] = VIDEO_IMAGE_SETTINGS["STORA VIDEO_TRANSCRIPTS_SETTINGS["STORAGE_KWARGS"]["location"] = VIDEO_TRANSCRIPTS_SETTINGS["STORAGE_KWARGS"]["location"].lstrip("/") GRADES_DOWNLOAD["STORAGE_KWARGS"] = {"location": GRADES_DOWNLOAD["STORAGE_KWARGS"]["location"].lstrip("/")} GRADES_DOWNLOAD["STORAGE_KWARGS"]["bucket_name"] = "{{ MINIO_GRADES_BUCKET_NAME }}" +OPENEDX_LEARNING["MEDIA"]["BACKEND"] = DEFAULT_FILE_STORAGE +OPENEDX_LEARNING["MEDIA"]["OPTIONS"] = { + 'bucket_name': "{{ MINIO_OPENEDX_LEARNING_BUCKET_NAME }}", +} # Ora2 setting ORA2_FILEUPLOAD_BACKEND = "s3" diff --git a/tutorminio/plugin.py b/tutorminio/plugin.py index 6225ea5..98cf09e 100644 --- a/tutorminio/plugin.py +++ b/tutorminio/plugin.py @@ -24,6 +24,7 @@ "VIDEO_UPLOAD_BUCKET_NAME": "openedxvideos", "HOST": "files.{{ LMS_HOST }}", "CONSOLE_HOST": "minio.{{ LMS_HOST }}", + "OPENEDX_LEARNING_BUCKET_NAME": "openedxlearning", "GRADES_BUCKET_NAME": "openedxgrades", "QUERYSTRING_AUTH": True, # https://hub.docker.com/r/minio/minio/tags diff --git a/tutorminio/templates/minio/tasks/minio/init.sh b/tutorminio/templates/minio/tasks/minio/init.sh index 2ccff20..a3946a6 100644 --- a/tutorminio/templates/minio/tasks/minio/init.sh +++ b/tutorminio/templates/minio/tasks/minio/init.sh @@ -1,5 +1,5 @@ mc config host add minio http://minio:9000 {{ OPENEDX_AWS_ACCESS_KEY }} {{ OPENEDX_AWS_SECRET_ACCESS_KEY }} --api s3v4 -mc mb --ignore-existing minio/{{ MINIO_BUCKET_NAME }} minio/{{ MINIO_FILE_UPLOAD_BUCKET_NAME }} minio/{{ MINIO_VIDEO_UPLOAD_BUCKET_NAME }} minio/{{ MINIO_GRADES_BUCKET_NAME }} +mc mb --ignore-existing minio/{{ MINIO_BUCKET_NAME }} minio/{{ MINIO_FILE_UPLOAD_BUCKET_NAME }} minio/{{ MINIO_VIDEO_UPLOAD_BUCKET_NAME }} minio/{{ MINIO_GRADES_BUCKET_NAME }} minio/{{ MINIO_OPENEDX_LEARNING_BUCKET_NAME }} {% if MINIO_GATEWAY != "azure" %} # Make common file upload bucket public (e.g: for forum image upload)