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

Add AWS support for downloads #11

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

mjohnson9
Copy link

Hi,

I don't know if these types of changes are desired or not, but I figured I'd offer.

This changeset adds support for S3/CloudFront signed URLs to allow secure downloading directly from AWS.

I also formatted the code using prettier, added an eslint configuration file, and added a Sublime Text project. I can remove the configuration files, but unformatting the code wouldn't be practical.

Are you interested in these changes? I'm planning on more AWS stuff like spinning up EC2 instances on demand.

@Maxou44
Copy link
Member

Maxou44 commented Mar 11, 2019

Thanks for this PR, do you use Rclone to mount your bucket in Plex?
We plan to support rclone link feature for downloads (If the link is unencrypted, the load balancer will 302 the link) and we also want support rclone decrypt on transcoders (the link will be forwarded with the key to a trancoder, and it will uncrypt and serve the file itself), maybe it could be more "universal" than implementing AWS support only?

For the code style, it's nice but a lot of important comment were removed (in the image resizer part), because it's a Plex reimplementation it could be nice to keep all the comments 😊

I preferer AirBnB codestyle, is it possible to switch on it?
https://github.com/airbnb/javascript

@mjohnson9
Copy link
Author

I can change eslint to use the airbnb rules and make prettier’s configuration closer to airbnb, but prettier is opinionated and has its own style. I use it because it’s the only JS code style tool that I know of that is deterministic (it parses the code into an AST and will always give the same output style).

Did it remove comments? I didn’t notice. I’ll fix that when I’m at my dev computer next.

@mjohnson9
Copy link
Author

Oh, and I use s3fs. I’ve been able to achieve exceptional performance with it. With a c5.large and an S3 VPC endpoint, I get constant speeds of 1Gbps per transfer and bursts up to 6Gbps. I don’t use the cache on the transcoder instances.

@Maxou44
Copy link
Member

Maxou44 commented Mar 14, 2019

I checked this commit again and after a talk with @drouarb, we'll introduce a generic "FileResolve" API soon, the UnicornLoadBalancer will call each resolver to transform the original path to an HTTP link (for download / transcoders). I think it will be easier to support new providers/resolvers, what do you think ?
Rclone now support the "link" command in its remote control API, I think we'll support it soon.

@mjohnson9
Copy link
Author

I think that would be a good idea, even if the transcoder is downloading from the load balancer. The Plex Transcoder version of ffmpeg supports pipe as an input, so we don’t even need to write it to disk.

@Maxou44
Copy link
Member

Maxou44 commented Mar 15, 2019

Why do you want to pipe data to ffmpeg? It also support HTTP(s) link directly ✌
For me resolvers will edit ffmpeg arguments and replace the local path like "/mnt/mydrive/myfile.mp4" to "https://aws....com/myfile.mp4?token=xxxxx"

@mjohnson9
Copy link
Author

Oh, I didn’t realize it supports links directly. That could definitely be good.

I’m about to reformat this PR to be more like airbnb style and then start working on making UnicornTranscoder report transcoding speed to CloudWatch Metrics for autoscaling. I’m also going to make UnicornLoadBalancer aware of autoscaling groups so that it can change desired count from 0 to 1 (to start the first transcoder).

@Maxou44
Copy link
Member

Maxou44 commented Mar 15, 2019

Transcode speed can be handled on "/progress" route called by ffmpeg

@mjohnson9
Copy link
Author

Changed to follow airbnb style. What do you think?

Also, I couldn't find any comments that were removed.

@Maxou44
Copy link
Member

Maxou44 commented Mar 15, 2019

Also, I couldn't find any comments that were removed.

My bad, a mistake on my side, sorry

@Maxou44
Copy link
Member

Maxou44 commented Mar 21, 2019

I'm working on the resolver branch to create a sort of API to easily plug any link resolvers (AWS, rclone, mergerfs...)

It's not tested and not implemented, but it give you an idea of how it will be interfaced ✌

@mjohnson9
Copy link
Author

I have to take a break from developing on this for now. I have final projects due in two programming classes, so that’s going to have to take precedence. I intend to work on this project more once I have the time again.

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