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

Switch Asset Storage to S3 #1588

Draft
wants to merge 9 commits into
base: dev/10.3.0
Choose a base branch
from
Draft

Switch Asset Storage to S3 #1588

wants to merge 9 commits into from

Conversation

cayb0rg
Copy link
Contributor

@cayb0rg cayb0rg commented Jun 27, 2024

Switches storage driver to s3. This uses fakes3 on dev and AWS S3 bucket on prod. (Tested with personal S3 bucket. Not tested on materia server yet)

Things to note:

  • I didn't see the purpose of setting AWS keys in the docker compose file since these are set in .env.local and converted to $_ENV vars in bootstrap.php during local development, and production also doesn't appear to need them. If this is a mistake, lmk
  • This updates the AWS SDK for PHP package, so you might have to do a fresh install (re-run run_first.sh)
  • The fakes3 container was restarted after running run_tests.sh, essentially deleting all uploaded assets. My initial fix for this is just create a whole new fakes3 container for testing, and drop it after tests are complete.

How to test:

  • run_first.sh should run without errors, meaning all widget assets were uploaded. Check s3mnt/ folder in local fakes3 container
  • Do all thumbnails and uploaded assets load properly in different views?
  • Does the media uploader work?
  • Does running run_tests.sh remove any assets? (Do assets in widget demos still load?)
  • Any other way you can think to break it!

If you want to test your own S3 bucket, you'll need to set these variables in your .env.local file in the root folder. Here's the guide I used for setting up AWS locally

FAKES3_DISABLED = true
# ASSET_STORAGE_S3_BUCKET=<MUST_SET>
# ASSET_STORAGE_S3_ENDPOINT=<MUST_SET>
# AWS_ACCESS_KEY_ID=<MUST_SET>
# AWS_SECRET_ACCESS_KEY=<MUST_SET>
# AWS_SESSION_TOKEN=<MUST_SET> // STS token for s3 development

To Do:

  • Add S3 Object Locking in lock_for_processing and unlock_for_processing for when assets are resized
  • Disable Object Locking when using fakes3
  • May need a re-check / error handling refactor after dev/10.2.0 is pushed
  • Test deleting assets

@clpetersonucf clpetersonucf changed the base branch from master to dev/10.3.0 July 16, 2024 19:19
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.

None yet

2 participants