feat(Assets): Add remote asset storage option#1802
Merged
Conversation
1480a58 to
211c779
Compare
Owner
Author
|
This has now been updated in the docs for the next release. See here. If the link no longer works, check the latest deploy of the next release PR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds the option to configure a S3-compatible storage remote for user uploaded assets. This can alleviate some costs or maintenance on the server host.
This comes with some configuration changes, a PR to the docs will be opened later today (likely) with specifics on that front. I'll update this description with a link once that's done.
By default without any config changes1, the original local storage approach will be used and stored in
/static/assets/(relative to the server folder).You'll however now be able to instead refer to a S3-compatible host by providing some URL info (e.g. bucket name etc) as well as 2 env variables to provide secrets.
The implementation is done without any extra dependencies to make it as generic as possible and without having to deal with whether or not I want to publish a docker image without and with the optional dependencies.
It's important that you FIRST run the migrations added in #1801 before moving to a remote solution if you intend to move your existing asset folder over.
It should be noted that I've only tested this with cloudflare R2 as that had an easy to setup free tier. I cannot vouch for any other service and I have only verified some basic operations. You'll have to look up for each service which values for region/bucket/url etc you need to provide. These can be added to the docs once known for a particular service.
!! It should also be noted that by using a remote solution you accept the risk of data costs that could occur if something in PA behaves faulty and ends up requesting from the remote too much. !!
This closes #1725 and #500
Footnotes
The existing
assets.directoryconfig key is moved, it however didn't properly work as far as I'm aware so I don't think this should impact anybody. It now works properly. ↩