Comments (1)
See the "Other web servers" section in the README:
Other web servers
It's perfectly feasible to run tus-ruby-server on web servers other than Goliath or Unicorn (even necessary if you want to run it inside another app). Just keep in mind that most other web servers don't support request streaming, which means that tus-ruby-server will be able to start processing upload requess only once the whole request body has been received. Additionally, incomplete upload requests won't be forwarded to tus-ruby-server, so in order for resumable upload to be possible the client needs to send data in multiple upload requests (which can then be retried individually).
I realized now I could have explained it in a way that's directly actionable. Here it is:
Unless you're using Goliath, or Unicorn with Nginx buffering disabled, you'll have to:
- Instruct your JS library (Uppy) to split the upload into chunks, which you should be able to do by specifying the
chunkSize
option to Uppy (5 * 1024 * 1024
= 5MB is good because it will work with tus-ruby-server's S3 storage). By default tus-js-client (which Uppy uses) will send a single upload request, which if the connection broke would never even reach tus-ruby-server (because Nginx will not forward it), which means you wouldn't be able to achieve resumable uploads. - Be vary of your disk space usage, because if you're using Puma, the uploaded data will be saved onto filesystem. Though you'll probably need to worry about that only if the traffic increases.
- Be aware that the progress bar for the user might halt for a moment after each 5MB chunk is uploaded, because it needs to wait for tus-ruby-server to save uploaded data to its storage. In Goliath scenario the file is being saved while it's being uploaded, so there is no such delay.
With these things in mind, you can safely mount tus-ruby-server inside your Ruby app. You can either mount it in your config.ru
:
# config.ru
require "tus/server"
map "/files" do
run Tus::Server
end
run YourApp
or in config/routes.rb
:
# config/initializers/tus_server.rb
require "tus/server"
# any tus-ruby-server configuration you want to put in here
# config/routes.rb
Rails.application.routes.draw do
# ...
mount Tus::Server => "/files"
end
from tus-ruby-server.
Related Issues (17)
- Rack dependency version prevents usage with Rails 4 HOT 3
- Before- and after-create hooks HOT 10
- S3-compatible endpoint consistency causing 409 Upload-Offset errors HOT 2
- S3 expire_files not checking prefix? HOT 1
- Failure on big files with S3 storage HOT 3
- error 400 in local HOT 3
- dynamic storage adapters HOT 2
- How can you find the Tus server configuration? HOT 3
- Returning 404 on OPTION check for file results in upload being unable to happen HOT 3
- Aws::S3::Errors::InvalidArgument - Invalid argument. HOT 7
- Full file SHA256 checksum? HOT 5
- Configure a CI
- Setting to update expire timestamp on PATCH requests HOT 5
- Mounting multiple Tus::Server instances with different storage adapters HOT 2
- 412 Pre-Condition Failed returns after whole body uploaded HOT 19
- Getting tus-ruby-server to run behind a reverse proxy HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tus-ruby-server.