Skip to content
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

PROFILE_IMAGE_BACKEND settings disappeared after v16.0.4 #46

Closed
dyudyunov opened this issue Aug 29, 2024 · 5 comments · Fixed by #50
Closed

PROFILE_IMAGE_BACKEND settings disappeared after v16.0.4 #46

dyudyunov opened this issue Aug 29, 2024 · 5 comments · Fixed by #50
Assignees

Comments

@dyudyunov
Copy link

The PROFILE_IMAGE_BACKEND settings were present from the v14 to v16.0.4 (latest before v17).

Here is the PR where it was added and the merge commit from it.

But they are absent starting from v17 and now I can reproduce the issue from the mentioned PR (an uploaded profile picture disappears after the redeploy because it is stored locally).

I checked the repo several times but don't know what I'm missing here. What happened? Why did the setting disappear?

Notes:

  • without updated PROFILE_IMAGE_BACKEND settings profile images will be stored locally and lost after the next deployment on k8s installations.
  • I tested it with redwood.2 release (tutor v18.1.3, minio v18.0.0)
@DawoudSheraz DawoudSheraz moved this from Pending Triage to Backlog in Tutor project management Aug 29, 2024
@DawoudSheraz
Copy link
Contributor

Hi. The setting was removed when upgrading to quince to fix an issue with profile photos. It seems some items might still be needed.

@dyudyunov
Copy link
Author

dyudyunov commented Aug 30, 2024

Just for history - here is my working profile image backend config:

PROFILE_IMAGE_BACKEND = {
    "class": DEFAULT_FILE_STORAGE,  # "storages.backends.s3boto3.S3Boto3Storage"
    "options": {
        # The bucket name value corresponds to default value of {{ MINIO_BUCKET_NAME }} - the only public bucket
        # https://github.com/overhangio/tutor-minio/blob/master/tutorminio/templates/minio/tasks/minio/init.sh#L6C31-L6C48 AFAIK
        "bucket_name": "openedx",  
        "querystring_auth": False,
        "location": PROFILE_IMAGE_BACKEND["options"]["location"].lstrip("/"),
    },
}

I was unable to use the private bucket + querystring_auth because of the SignatureDoesNotMatch error.

As I understood from the shallow investigation - querystring_auth doesn't work because _get_profile_image_urls appends additional querystring kwarg &v=.... If you remove it from the URL - signature works as expected.

@Faraz32123
Copy link
Collaborator

hello @dyudyunov, hope you are doing well.
Regarding the issue you have created, we have tested it on K8s locally, but we were unable to resolve the issue with below patch. Would you like to open a working PR?

# LMS-specific media storage
PROFILE_IMAGE_BACKEND = {
    "class": "storages.backends.s3boto3.S3Boto3Storage",
    "options": {
        "bucket_name": "{{ MINIO_BUCKET_NAME }}",
        "querystring_auth": False,
        "location": PROFILE_IMAGE_BACKEND["options"]["location"].lstrip("/"),
    },
}

The error we were facing:

 File "/openedx/venv/lib/python3.11/site-packages/botocore/httpsession.py", line 493, in send
    raise EndpointConnectionError(endpoint_url=request.url, error=e)
botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint URL: "http://files.local.edly.io/openedx/openedx/media/profile-images/f70cff94eafe7e44b9bfcef3698d14bb_500.jpg"

@dyudyunov
Copy link
Author

Hi @Faraz32123

Sure, I would like to propose the fix, but I have a lack of time now and can't project the due date.

Interesting, I didn't see the error you mentioned. Can you use any other uploads except the profile image? Maybe there are some global-level misconfigurations...

@Faraz32123
Copy link
Collaborator

Hi @Faraz32123

Sure, I would like to propose the fix, but I have a lack of time now and can't project the due date.

Interesting, I didn't see the error you mentioned. Can you use any other uploads except the profile image? Maybe there are some global-level misconfigurations...

Hello @dyudyunov, thanks for your reply!
We are currently investigating the issue 🔍 and will work on a fix soon.

@Faraz32123 Faraz32123 moved this from In review to In Progress in Tutor project management Oct 29, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in Tutor project management Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging a pull request may close this issue.

3 participants