-
Notifications
You must be signed in to change notification settings - Fork 156
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
Support for Files, Images, Videos to be stored in a cloud provider in addiiton to filesystem #370
Comments
This is a really interesting subject and can be implemented within structr. though it's absolutely non-trivial and you would have to learn a lot of the deeper functionality the system offers. I've dabbled a little bit with using a combination of extension, inheritance, function attributes and entity methods (onCreate/onSave) to manage where user content resides in the system. I use entity methods extensively for organizing projects (a core asset in my system) in the user's content folder for a user, and setting up (automagically) where their generated content goes when the user is created. I haven't made the jump just yet to publishing them on a CDN, which i is something i've been thinking about for some time I like the idea of doing this since then Structr can be the system of record for the images, etc, and serves directly if required, but can seamlessly support an asynchronous publishing model that as they become published asset are automatically served from the right place, and it's non-destructive & easy to "undo". makes for pretty seamless management and the file can stay in the system (for management) but aren't a drag on serving resources once published on a CDN. Here is the basic concept/plan i expect to use to accomplish this. Extend entity "File":
the function code for that "bestUri" attribute would look something like:
Entity Methods
####Usage change You would need to add the bestUri to the public view of file, and perhaps each of the entities that you wanted to do this with to make sure it's available (if you're using the REST services externally). This obviously doesn't address the publishing part, but there are a number of ways to achieve this. I haven't settled on what i'm going to do for my system just yet, but i'll post back once i figure it out. it may be possible to have to use the the inbuild POST function to publish the assets directly, thought i've not used it extensively. Perhaps, @amorgner or @cmorgner can comment on whether the post function would allow you to control the headers/auth that might be required to publish on a CDN. |
Great ideas, Eric, this could definitely work like this. The POST function supports headers, just set them before actual request:
Typically, uploading an asset to a CDN is initiated by a POST request, telling the CDN the location of the original file, and the CDN returns an UUID which then can be used to access the file on the CDN. Here's a nice example: https://uploadcare.com/documentation/upload/ |
I love the ideas and it would be great to see this almost as a provider model concept with the ability to create and configure different providers for different destinations. Then possibly we could have a set of default options for things like AWS, AzureBlob, Samba, and local mountpoint. |
@ravensorb I'm getting closer to going this. I'll post the schema JSON for whatever tracking entities i create. |
It would be great from a scalability perspective to support storing the underling files (videos, images, etc) within a cloud provider (CDN, AWS, Azure, etc). This would allow us to leverage those from a scalability and distribution perspective while still maintaining the metadata within structr.
The text was updated successfully, but these errors were encountered: