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

Feature/s3 storage #86

Merged
merged 17 commits into from
Dec 2, 2022
Merged

Feature/s3 storage #86

merged 17 commits into from
Dec 2, 2022

Conversation

RishiDiwanTT
Copy link
Contributor

@RishiDiwanTT RishiDiwanTT commented Nov 29, 2022

Description

Library registry now pushes the library logos it gets from the authentication documents to an S3 bucket
It also stores the URL for the logo in the Library.logo_url attribute
The logo file is stored with a public-read ACL, so no presigned urls are required, making it CDN friendly

The storage class is written by abstracting away boto3 internals, so other platforms can be implemented when required.
Only basic operations have been implemented

  • Write
  • Delete
  • Get link (a falsely constructed, CDN friendly url)

Additionally,

  • Added a tox configuration for a minio container
  • Changed all nose-type setup() methods to pytest setup_method()'s, removing 300+ deprecation warnings from the test reports
  • Added the library logo url to the catalog feed

Motivation and Context

The library-registry libraries feed did not contain the library logo urls, causing mobile apps to unnecessarily make additional requests to the CMs. This change is meant to reduce that traffic.

Notion

How Has This Been Tested?

Manually tested with a MiniO container, no S3 testing.
Unit tests have been written to encompass the change.

Checklist

  • I have updated the documentation accordingly.
  • All new and existing tests passed.

The test cases depend on MiniO
An alembic migration has been introduced for it
The LibraryRegistrar.register method uploads logos to S3 now
Thus removing 300+ deprecation warnings from the test result
@RishiDiwanTT RishiDiwanTT requested a review from a team November 29, 2022 08:01
@RishiDiwanTT RishiDiwanTT self-assigned this Nov 29, 2022
Copy link
Member

@jonathangreen jonathangreen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, just a few comments and it should be good to merge.

model.py Show resolved Hide resolved
opds.py Show resolved Hide resolved
registrar.py Outdated Show resolved Hide resolved
util/file_storage.py Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
util/file_storage.py Outdated Show resolved Hide resolved
@jonathangreen
Copy link
Member

This looks ready to go to me. Only reason I'm not approving it right now is that I would like to test the migrations against our production database before we merge. Going to get that test setup and make sure everything goes smoothly, then will approve.

Copy link
Member

@jonathangreen jonathangreen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with a copy of the production database, and this worked well. I pushed a couple commits, that you should take a look at before merging @RishiDiwanTT and let me know if you have any feedback.

  • Update docker-compose.yml to have minio and necessary env variables for testing
  • Updated the path of the stored logo to use the uuid instead of the ID. This is consistent with the other links we expose, the seem to use the uuid rather then the database ID of the item.

@RishiDiwanTT
Copy link
Contributor Author

Tested with a copy of the production database, and this worked well. I pushed a couple commits, that you should take a look at before merging @RishiDiwanTT and let me know if you have any feedback.

  • Update docker-compose.yml to have minio and necessary env variables for testing
  • Updated the path of the stored logo to use the uuid instead of the ID. This is consistent with the other links we expose, the seem to use the uuid rather then the database ID of the item.

All looks good

@RishiDiwanTT RishiDiwanTT merged commit 464046a into main Dec 2, 2022
@RishiDiwanTT RishiDiwanTT deleted the feature/s3-storage branch December 2, 2022 06:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants