dman926 / SEPHIRA-CMS

An Angular 13 front end with a complete FastAPI backend. Perfect for getting your next project off the ground
MIT License
9 stars 6 forks source link

Use GridFS for storing media instead of hard files #30

Closed dman926 closed 2 years ago

dman926 commented 2 years ago

Is your feature request related to a problem? Please describe. With the new media browser, I was thinking of how I could use mongo instead of storing the files regularly on disk. This came about cause I was looking at adding streaming capabilities (related to #21), and that would require a fastapi endpoint to stream the file.

Describe the solution you'd like It would be much easier if there was a media collection to store files instead. This would also be easier to handle user auth by storing the user with the media, giving ownership for atomic tasks. Of course, I would have to see if it is feasible to do live streaming this way too.

Describe alternatives you've considered In a previous project, I fully utilized NGINX to stream my video files, but that was a pain to set up.

Additional context https://docs.mongoengine.org/guide/gridfs.html I will try this out in a branch of angular-refresh

dman926 commented 2 years ago

A major issue I've read about is performance concerns. I will make a basic video player and then try both solutions to see if it is actually a major issue. I don't mind a <5% (maybe 10%) performance hit if I can stop using complicated os workarounds to use the file system instead of simply using mongo

dman926 commented 2 years ago

GridFS is a much cleaner option than file system storage. I don't see a hit in performance. In fact it's a better now since I'm forced to grab the file through fast API, so I can send much smaller payloads more frequently instead.