I was ok using Paperclip plugin for my Rails app to manage my user's avatar images on file system.
Now I have to do load balance, whi开发者_StackOverflow中文版ch force me to put image somewhere central to be shared to multiple servers.
I found out Paperclip can not go to custom asset host. Paperclip can do S3, but i'm seeking alternate way by not using S3. Any idea guys?
Paperclip supports Fog, see /lib/paperclip/storage/fog.rb and http://fog.io. From their website:
Whether you need compute, dns, storage, or a multitude of other services, fog provides an accessible entry point and facilitates cross service compatibility.
I use Carrierwave to upload to S3, since our host, Heroku only allows storing files remotely. However, you can also use Carrierwave to upload to other storage services like Rackspace. Initially and like you, I had issues with load balancing. Since uploading a file would, in theory, hang the application until the upload is finished.
I found a way around this by uploading directly to our storage service using javascript. I used jQuery and Uploadify for this specifically. Uploading directly does not take up a entire http thread which pretty much evens out the load balance on the server.
What I would suggest, if you still decide on using Paperclip, is to upload directly to a storage service (or even your own server, if your server host allows it), using javascript and then assigning the file to your Paperclip uploader.
Hope that helps.
精彩评论