0
votes

I uploaded my app to heroku. The app was built with ruby on rails and had the activeadmin and paperclip gem installed. The files are configured properly and i was able to upload images using he active admin gem. this worked perfectly loaclly and worked fine on heroku until i uploaded more images, now all the images have disappeared. Any ideas on how this can be sorted?

2

2 Answers

3
votes

Heroku has an ephemeral filesystem.
That is because each running dyno is an independent container (much like docker) which shared nothing with other dynos, and is destroyed when the app is restarted/deployed.

So any file written on disk will be lost when the dyno is restarted, and is not recoverable.

You need to configure paperclip to upload images to a dedicated file storage system like Amazon S3.

0
votes

You can't store images on heroku, or anything for that matter. Your uploaded files are available for temporary use only, long enough to process them away to cloud storage elsewhere.

http://cloudinary.com/ offers development accounts for free; https://aws.amazon.com/s3/ has become ridiculously cheap and gives new devs a long free trial. There are other resources but ultimately you have to choose storage which isn't transient.

You can use gems like carrierwave, or attachinary to easily access and store with either of those storage locations.