-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix STORAGE_KWARGS #70
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! I have a couple of questions; please see the inline comments.
@@ -1,8 +1,8 @@ | |||
DEFAULT_FILE_STORAGE = "storages.backends.s3boto3.S3Boto3Storage" | |||
VIDEO_IMAGE_SETTINGS["STORAGE_KWARGS"]["location"] = VIDEO_IMAGE_SETTINGS["STORAGE_KWARGS"]["location"].lstrip("/") | |||
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"] = "{{ S3_GRADE_BUCKET }}" | |||
GRADES_DOWNLOAD["STORAGE_KWARGS"] = {"location": GRADES_DOWNLOAD["STORAGE_KWARGS"]["location"].lstrip("/")} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I presume you are overriding the whole dictionary here, rather than just overriding the value of location
, in order to remove the problematic base_url
key. Is that correct?
If so, I'm curious as to why the tutor-minio
plugin does not fail in the same way. Because it appears to be doing the same thing that we do here, namely only override the location
key rather than the whole dictionary:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I presume you are overriding the whole dictionary here, rather than just overriding the value of location, in order to remove the problematic base_url key. Is that correct?
Exactly.
If so, I'm curious way why the tutor-minio plugin does not fail in the same way. Because it appears to be doing the same thing that we do here, namely only override the location key rather than the whole dictionary:
I am not really familiar with the tutor-minior
plugin. But please note that this problem occurs in Quince (3 months-ish ago?) and the last commit from that file dates back to 7 months ago. So they might have the same issue. I am not sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem. @regisb, just checking, does this ring a bell?
I ask because if setting base_url
breaks both tutor-minio
and tutor-contrib-s3
, then it should probably be fixed in both — or else, maybe we want to remove lines such as this from Tutor Core:
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. Thanks for the heads up Florian. @FahadKhalid210 could you please have a look and see if you can reproduce the issue described here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@regisb sure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@regisb The issue has been replicated locally by initiating Tutor with the Quince
version and the s3
plugin. Additionally, the problem was verified using Minio
, and it was reproduced in that environment as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @FahadKhalid210!
@regisb, at your convenience could you please advise whether the base_url
setting is even still necessary in Tutor Core? Because if it is not, then I'd suggest we remove it from there, and remove any reference to it from the s3
and minio
plugins.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't figure remember the reason I initially introduced a base_url
setting in GRADES_DOWNLOAD
. The most information I can find is from this commit, five years ago: overhangio/tutor@abfbf1c
Indeed, we should remove this base_url
attribute if it's causing errors.
@FahadKhalid210 can you please handle this? We should verify that grades download keeps working both with and wihout minio.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@FahadKhalid210: When you create a PR for such a change in either tutor
or tutor-minio
, would you mind adding a link to this issue in the discussion thread, so we get a backlink here and can coordinate the fix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure thing. Here it is: overhangio/tutor#999
EDIT: actually, here's the relevant PR overhangio/tutor-minio#35
"location": PROFILE_IMAGE_BACKEND["options"]["location"].lstrip("/"), | ||
{% if S3_PROFILE_IMAGE_CUSTOM_DOMAIN %}"custom_domain": "{{ S3_PROFILE_IMAGE_CUSTOM_DOMAIN }}",{% endif %} | ||
# A non empty base_url is necessary in development as it will be used | ||
# to build a static url for the profile images. | ||
"base_url": "dummyprofileimagebaseurl", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure I understand why it's necessary to remove this from here, and then reindroduce it in openedx-lms-development-settings
. Can you elaborate please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. The comment indicates that this is necessary for development and I thought it was cleaner to move this to the dev-specific patch.
This didn't cause an issue for me but I moved it for peace of mind.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, that makes sense. :)
285d227
to
5d4bf9e
Compare
Quince release came and with it a new django-storage version. New versions of django-storage have stricter checks for STORAGE_KWARGS. It is no longer allowed to have options from other storage classes. Notably, base_url which is irrelevant to the S3 storage class. The bucket option has also been deprecated and renamed to bucket_name.
5d4bf9e
to
fe7c758
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@CefBoud If I read overhangio/tutor#999 and overhangio/tutor-minio#35 correctly, then I would assume that we don't need to mess with base_url
at all anymore. So I'd suggest we drop it from openedx-lms-common-settings
, but we also don't introduce an openedx-lms-development-settings
patch. Would you agree?
Please check #71. |
Description
Quince release came and with it a new
django-storage
version. New versions ofdjango-storage
have stricter checks forSTORAGE_KWARGS
. It is no longer allowed to have options from other storage classes (notably, base_url which is irrelevant to the S3 storage class but is currently always set in Tutor as default).The
bucket
option has also been deprecated and renamed tobucket_name
.These changes cause errors when deploying the Quince release with the S3 plugin. This PR aims to address that.
Instructions to reproduce the error
s3
plugin.Data Downloads
section under theInstrutor
tab. Click theDownload profile information as a CSV
.django.core.exceptions.ImproperlyConfigured: Invalid setting 'base_url' for S3Storage
.Helpful
To access
GRADES_DOWNLOAD
storage settings: