large file uploads & progress bar

329 views
Skip to first unread message

michae...@gmail.com

unread,
Dec 27, 2016, 10:22:53 AM12/27/16
to Shrine
I make a rails app that needs to:

  • be able to upload huge files (2-20GB) and not make the rails hang,
  • have a progress bar, otherwise end user will not know what's going on for so long.

this is welcome, but not absolutely necessary:
  • resumable uploads.
I've watched gorails screencast on shrine uploads to s3, and I think I can follow along, but I need to upload to local storage.

I'm totally blown away with the amount of information I need to consume in order to make it work. This jquery-file-uploads monster with tons of javascript to write, and js is not what I'm not really into.

Plus, jquery-file-uploads suggests its go/python server side scripts, and I'm not sure I really need them in rails/shrine situation. But what's instead?

What is the most straightforward and proper way to do this? Maybe tus-ruby-server + tus-js-client?

Janko Marohnić

unread,
Dec 27, 2016, 10:54:19 AM12/27/16
to michae...@gmail.com, Shrine
For large files it's definitely recommended that you have resumable uploads, and the recommended solution for that is tus-ruby-server + tus-js-client. Shrine-tus-demo is a Roda example app (but can easily be translated into Rails) showing how you can hook up tus-ruby-server with Shrine, and includes a progress bar implementation. Just remember to set the `chunkSize` option for tus-js-client, to force it to split the upload into multiple chunks.

Another JavaScript file upload library that supports resumable uploads (thus is suitable for large files) is FineUploader, which additionally supports uploading the chunks in parallel (thus making the overall upload faster). However, there doesn't exist yet something like tus-ruby-server for FineUploader.

Kind regards,
Janko

--
You received this message because you are subscribed to the Google Groups "Shrine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-shrine+unsubscribe@googlegroups.com.
To post to this group, send email to ruby-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ruby-shrine/ef0c2cec-395b-40a0-b874-89a1c5c06554%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

michae...@gmail.com

unread,
Dec 28, 2016, 5:51:51 AM12/28/16
to Shrine, michae...@gmail.com
Roda looks pretty neat, and there are not so much code overall in your example, so I think I can grasp it.

I think I'll build my application on top of your example, because it's already 25% of what I need to be done.

On Tuesday, December 27, 2016 at 6:54:19 PM UTC+3, Janko Marohnić wrote:
For large files it's definitely recommended that you have resumable uploads, and the recommended solution for that is tus-ruby-server + tus-js-client. Shrine-tus-demo is a Roda example app (but can easily be translated into Rails) showing how you can hook up tus-ruby-server with Shrine, and includes a progress bar implementation. Just remember to set the `chunkSize` option for tus-js-client, to force it to split the upload into multiple chunks.

Another JavaScript file upload library that supports resumable uploads (thus is suitable for large files) is FineUploader, which additionally supports uploading the chunks in parallel (thus making the overall upload faster). However, there doesn't exist yet something like tus-ruby-server for FineUploader.

Kind regards,
Janko
On Wed, Dec 28, 2016 at 1:22 AM, <michae...@gmail.com> wrote:
I make a rails app that needs to:

  • be able to upload huge files (2-20GB) and not make the rails hang,
  • have a progress bar, otherwise end user will not know what's going on for so long.

this is welcome, but not absolutely necessary:
  • resumable uploads.
I've watched gorails screencast on shrine uploads to s3, and I think I can follow along, but I need to upload to local storage.

I'm totally blown away with the amount of information I need to consume in order to make it work. This jquery-file-uploads monster with tons of javascript to write, and js is not what I'm not really into.

Plus, jquery-file-uploads suggests its go/python server side scripts, and I'm not sure I really need them in rails/shrine situation. But what's instead?

What is the most straightforward and proper way to do this? Maybe tus-ruby-server + tus-js-client?

--
You received this message because you are subscribed to the Google Groups "Shrine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-shrine...@googlegroups.com.

michae...@gmail.com

unread,
Dec 28, 2016, 10:10:33 AM12/28/16
to Shrine, michae...@gmail.com
In the shrine-tus-demo, cache files in the data directory stay after successful upload, and even after that uploaded file has been deleted. So, they accumulate there. Ho can I remove data files after successful moving to :store location?

On Tuesday, December 27, 2016 at 6:54:19 PM UTC+3, Janko Marohnić wrote:
For large files it's definitely recommended that you have resumable uploads, and the recommended solution for that is tus-ruby-server + tus-js-client. Shrine-tus-demo is a Roda example app (but can easily be translated into Rails) showing how you can hook up tus-ruby-server with Shrine, and includes a progress bar implementation. Just remember to set the `chunkSize` option for tus-js-client, to force it to split the upload into multiple chunks.

Another JavaScript file upload library that supports resumable uploads (thus is suitable for large files) is FineUploader, which additionally supports uploading the chunks in parallel (thus making the overall upload faster). However, there doesn't exist yet something like tus-ruby-server for FineUploader.

Kind regards,
Janko
On Wed, Dec 28, 2016 at 1:22 AM, <michae...@gmail.com> wrote:
I make a rails app that needs to:

  • be able to upload huge files (2-20GB) and not make the rails hang,
  • have a progress bar, otherwise end user will not know what's going on for so long.

this is welcome, but not absolutely necessary:
  • resumable uploads.
I've watched gorails screencast on shrine uploads to s3, and I think I can follow along, but I need to upload to local storage.

I'm totally blown away with the amount of information I need to consume in order to make it work. This jquery-file-uploads monster with tons of javascript to write, and js is not what I'm not really into.

Plus, jquery-file-uploads suggests its go/python server side scripts, and I'm not sure I really need them in rails/shrine situation. But what's instead?

What is the most straightforward and proper way to do this? Maybe tus-ruby-server + tus-js-client?

--
You received this message because you are subscribed to the Google Groups "Shrine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-shrine...@googlegroups.com.

michae...@gmail.com

unread,
Dec 28, 2016, 11:29:51 AM12/28/16
to Shrine, michae...@gmail.com
My storage is configured like this:

Shrine.storages = {
  cache: Shrine::Storage::Url.new,
  store: Shrine::Storage::FileSystem.new("public", prefix: "uploads/store"),

michae...@gmail.com

unread,
Dec 28, 2016, 12:13:36 PM12/28/16
to Shrine, michae...@gmail.com
I seem to get the idea behind Tus::Server.opts[:expiration_time] and Tus::Server.opts[:expiration_interval]. So the question related to cache purging is resolved.
Reply all
Reply to author
Forward
0 new messages