Question

I deployed a Ruby on Rails app to Heroku, and I realized they have a read-only file system (http://docs.heroku.com/constraints#read-only-filesystem). This means I can't cache images locally, for example. I was using a Ruby gem called "Rio" (Ruby Input/Output), and that let me save files to my /public/images directory. Are there any good hosts that allow this? Specifically, I was looking at Rackspace Cloud. Would really help to know in advance before I try and deploy somewhere else!

Was it helpful?

Solution

You don't need to switch hosts to accomplish this.

With Heroku, you can write to the RAILS_ROOT/tmp directory. They just aren't guaranteed to stick around between requests, because different requests could be served from different dynos, and the tmp dir is cleared out periodically.

So you can fetch your images to that directory, do whatever processing your need, and then upload them to S3 (I'd recommend Delayed::Job for this if you aren't already using it).

OTHER TIPS

I just Googled for "free ruby hosting" and there are lots and lots of results. I would suggest looking through some of those.

Update: I just realized Heroku comes up at the top of that list, but there are plenty of others.

I admit I wasn't industrious enough to check each one to see if they let you write to their file system.

I think it's not necessary to scramble after "cloud" offerings. "cloud" addresses a problem you don't have (yet). "cloud" makes your application "infinitely" scalable, should you strike it big, your site gets SlashDotted or whatever.

What you're looking for is cheap-to-free hosting, and that's offered by providers that "do" virtual hosting (putting a lot of people on one physical box to cut costs for each) or free hosting for poor open source developers.

One solution, if you want to use Heroku would be not to host the images at their place. But at Amazon.
Your application could do what's necessary with the images and then send them on Amazon S3 platform.
Then when you want to display an image, you can just link to it on Amazon.

Paperclip allows you to send images to S3 quite easily.

I am not sure about heroku but to answer your question about Rackspace cloudFiles, there is no block storage exposed by cloudfiles but just an API to upload/retrieve/etc... the files.

There is thought some fuse wrapper that would expose your cloud files as a filesystem at least on Linux/Macosx :

https://github.com/redbo/cloudfuse/

there is JungleDisk as well which is tighten to cloudfiles but it's a whole complete infrastructure.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top