Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Heroku File Storage

Heroku only has 100MB of file storage, right? I'm making a low-level rails app and I really like Heroku, but if my app allows each user to upload one picture, I may run out of space quickly...is there a simple solution that will allow me to have alternative file storage for profile pics or something of the like?

like image 765
Kevin Brown Avatar asked Jul 11 '11 21:07

Kevin Brown


People also ask

Does Heroku provide file storage?

Heroku has an “ephemeral” hard drive, this means that you can write files to disk, but those files will not persist after the application is restarted. By default Active Storage uses a :local storage option, which uses the local file system to store any uploaded files.

Where does Heroku store uploaded files?

Files are uploaded directly to the cloud from your user's browser, without passing through your application. Adding direct uploads to your app allows you to offload the storage of static files from your app. This is crucial on Heroku, because your app's dynos have an ephemeral filesystem.

How much storage does Heroku give?

free, hobby and standard-1x have 512 MB. standard-2x has 1024 MB. performance-m has 2.5 GB.


2 Answers

I would recommend you to check heroku add-on solution which is https://addons.heroku.com/cloudinary. You will get 500MB for free and easy heroku integration.

For RoR app you can check: https://devcenter.heroku.com/articles/cloudinary#using-with-ruby-on-rails

There is also documentation for Nodejs and Django.

like image 163
jmarceli Avatar answered Oct 22 '22 09:10

jmarceli


See this blog post

In your model.

has_attached_file :picture,                     :styles => {:large => "275x450>"},                    :storage => :s3,                     :s3_credentials => "#{RAILS_ROOT}/config/s3.yml",                    :path => "appname/:attachment/:style/:id.:extension" 

In s3.yml in your config dir:

    development:       bucket: bucketname       access_key_id: key       secret_access_key: key      production:       bucket: bucketname       access_key_id: key       secret_access_key: key 

Then go signup for a bucket at Amazon S3: http://aws.amazon.com/s3/

like image 37
thenengah Avatar answered Oct 22 '22 09:10

thenengah