edx-ora2 icon indicating copy to clipboard operation
edx-ora2 copied to clipboard

feat: add Google Cloud Storage support (GCS)

Open shadinaif opened this issue 11 months ago • 20 comments

TL;DR - This is to add support to GCS files backend by adding a new option (gcs) to ORA2_FILEUPLOAD_BACKEND

JIRA: ---

What changed?

  • ORA2_FILEUPLOAD_BACKEND environment variable accepts a new value gcs in addition to the existing options (s3, filesystem, swift, and django)
  • No changes to the requirements. It is assumed that you already installed django-storages[google] instead of the default django-storages which will include google-cloud-storages

Important to know! Using GSC with ORA means that edx-platform is already configured to use GCS instead of S3

  • It is assumed that you already installed django-storages[google] instead of the default django-storages which will include google-cloud-storages
  • It is assumed that DEFAULT_FILE_STORAGE is set to storages.backends.gcloud.GoogleCloudStorage in edx-platform. Other configurations might be needed too
  • It is assumed that edx-platform functions directly and seamlessly with GCS without a proxy like MinIO or boto3

Developer Checklist

Testing Instructions

Using tutor development:

  • Prepare your GSC storage, make sure to have a dedicated bucket for file upload
  • Configure edx-platform to use GCS, including the installation of django-storages[google]
  • Configure ORA2 to use GCS by setting ORA2_FILEUPLOAD_BACKEND to gcs
  • Configure the dedicated bucket by setting FILE_UPLOAD_STORAGE_BUCKET_NAME
  • Test uploading files from ORA2 and previewing them
  • Test previewing uploaded files in ora2 MFE
  • Verify that files exist in the dedicated storage
  • Test deleting files
  • Verify that files were deleted from the dedicated storage

Reviewer Checklist

Collectively, these should be completed by reviewers of this PR:

  • [ ] I've done a visual code review
  • [ ] I've tested the new functionality

FYI: @openedx/content-aurora

shadinaif avatar Mar 17 '24 07:03 shadinaif

Thanks for the pull request, @shadinaif!

What's next?

Please work through the following steps to get your changes ready for engineering review:

:radio_button: Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.

:radio_button: Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads

:radio_button: Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

:radio_button: Let us know that your PR is ready for review:

Who will review my changes?

This repository is currently maintained by @openedx/2u-aurora. Tag them in a comment and let them know that your changes are ready for review.

Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

:bulb: As a result it may take up to several weeks or months to complete a review and merge your PR.

openedx-webhooks avatar Mar 17 '24 07:03 openedx-webhooks

@shadinaif Thank you for this contribution! Let us know when the changes are ready for review.

itsjeyd avatar Mar 22 '24 09:03 itsjeyd

Hey @shadinaif, just checking in to see if you're still planning to continue working on this PR?

itsjeyd avatar Apr 22 '24 07:04 itsjeyd

Thank you for the reminder @itsjeyd . Yes, it's on production and working fine. I'll rebase and set to review soon

shadinaif avatar Apr 22 '24 09:04 shadinaif

@shadinaif Sounds good, thanks for the update.

itsjeyd avatar Apr 26 '24 07:04 itsjeyd

Hey @shadinaif, do you have any updates about when you'll be able to come back to this PR?

itsjeyd avatar May 23 '24 15:05 itsjeyd

Thanks for the follow-up @itsjeyd , I'll get back to it and complete it on Tuesday, June 4, 2024 I promise. I've added it to my schedule. Sorry for the delay 🙏🏼

shadinaif avatar May 25 '24 13:05 shadinaif

Sounds good, thanks for the update @shadinaif.

itsjeyd avatar May 31 '24 07:05 itsjeyd

@shadinaif It looks like tests will need some further tweaking here. Could you have a look?

itsjeyd avatar Jun 06 '24 07:06 itsjeyd

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 95.12%. Comparing base (8b320d6) to head (8fd1c39). Report is 4 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2193      +/-   ##
==========================================
+ Coverage   95.09%   95.12%   +0.02%     
==========================================
  Files         195      196       +1     
  Lines       21479    21584     +105     
  Branches     1931     1935       +4     
==========================================
+ Hits        20425    20531     +106     
  Misses        787      787              
+ Partials      267      266       -1     
Flag Coverage Δ
unittests 95.12% <100.00%> (+0.02%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Jun 07 '24 13:06 codecov[bot]

Hey @shadinaif, thanks for working on the tests.

It looks like some of them are still failing. Will you be taking another look?

itsjeyd avatar Jun 26 '24 11:06 itsjeyd

Thanks for the reminder @itsjeyd , I'll do in a couple of days 👍🏼

shadinaif avatar Jun 26 '24 20:06 shadinaif

@shadinaif Just checking in to see if you're still planning to continue working on this PR? If you don't think you'll get to it in the short term, it might make sense to close it for the time being.

itsjeyd avatar Jul 18 '24 15:07 itsjeyd

@itsjeyd thank you for your patience on this. I've added the needed tests, and I also had to fix some linter errors not related to the PR. All green now

shadinaif avatar Jul 27 '24 15:07 shadinaif

@shadinaif Great! I'm marking this PR as ready for review now.

itsjeyd avatar Aug 08 '24 06:08 itsjeyd

Hi @openedx/2u-aurora team, this PR is ready for engineering review.

@feanil I can't formally request a review from the Aurora team, could you please update the team's permissions for this repo to make that possible?

itsjeyd avatar Aug 08 '24 06:08 itsjeyd

Added the team to the repo and tagged them for review.

feanil avatar Aug 12 '24 14:08 feanil