Reputation: 303
I am using paperclip
gem and storing the images in the public
folder, but i saw in many examples that used s3
to store assets
like images. why? Also i have read few information saying that when we deploy our app in heroku
we cannot write or store anything as because it is a read-only file system
. If so, does heroku provide some services similar to that of the amazon s3.
Looking for more answers so as to get different views and points.
Upvotes: 0
Views: 652
Reputation: 3265
From Ryan Bates' Railscast on Uploading to Amazon S3:
In the past, I've done several episodes on file uploads. But one thing I haven't talked about is where that file is stored once it's actually uploaded to the server. Oftentimes, the file is just stored in the local file system that runs the Rails application, but there can be several disadvantages to this:
- Sometimes that server has limited disk space or bandwidth.
- Also if you want to make a cluster of Rails servers, that can add some complications.
- And also, don't forget about the potential security issues of allowing users to upload files to your Rails server.
So there are several reasons why you might want to store uploaded files elsewhere...
Amazon S3 simply represents one instance of 'elsewhere'. :-)
Upvotes: 0
Reputation: 115531
Keep in mind that when someone uses your web app, the browser tries to get athe web page the as fast as possible.
If you've only one server rendering html + assets, it's naturally slower than having a dedicated CDN.
Upvotes: 2