Heroku Deploy Images Reset - ruby-on-rails-3

I have an rails app deployed to Heroku. It has image uploads. After deployed to heroku again, i am unable to see old images that are uploaded.
Is heroku reset images folder when app is re-deployed? Please tell me the reason behind it.

Background
Heroku uses an 'ephemeral file system', which from an application architecture point of view should be considered as read-only - it is discarded as soon as the dyno is stopped or restarted (which, along with other occasions, occurs after each push), and is also not shared between multiple dynos.
This is fine for executing code from, as most application data is stored in a database that is independent of the dynos. However, for file uploads this presents a problem, and so any uploads should not be stored directly in the dyno filesystem.
Solution
The simplest solution is to use something like Amazon S3 as your file upload storage solution, and, if using a gem like Paperclip, this is natively supported within the gem. There is a great overview article in the Heroku Dev Center about using S3 and Heroku (https://devcenter.heroku.com/articles/s3), which leads into an article contributed by Thoughtbot (the developers of Paperclip) on implemenation specifics within a Rails app (https://devcenter.heroku.com/articles/paperclip-s3)

Related

Can I host images uploaded by user on HostGator?

I have a website where users have the option to upload their profile images. Currently, I'm using Cloudinary to host those images. My client has asked me if I can host those images on HostGator since they already have a paid shared hosting account there. My question is
Can I even do that? I tried that on Heroku and they warn you that images etc stored on their server will be deleted in 24 hours when their dynos restart, and they recommend Amazon S3.
If yes, then I will definitely need some kind of API to work with since all this is handled by my server and there must be a way to upload and delete images programmatically. It would be great if you could point me towards particular resources.
If no, then what are the industry standards for my particular use case?

Moving Images between Pirhana Websites

When uploading images on my local development environment, and uploading the contents of the Uploads and Content Folders up to the live environment the images do not show even after updating the application pool - do you know what step i am missing. I am using Piranha in passive mode?
Well without any further information it's hard to come up with something that will qualify as an answer :) However, if you have copied both the database and the binary files located in ~/App_Data/Content/ my guess would be that Windows is playing a prank on you and that the IIS pool of the live environment either:
Doesn't have permission to access the App_Data/Content folder, or
That permissions from your dev server have been copied to the live server so that the IIS app pool doesn't have permission to the copied files.
Regards
HÃ¥kan

How to store images on other server

We have a CMS application written in Ruby On Rails 3 and it is using Paperclip to handle file uploads and ImageMagick to do image manipulating. It has been working great, and we are very happy.
For a new customer we want to make a deployment: the application server is in a public network and the uploaded content + the database is stored on a secured computer in their internal environment.
We have 2 main tracks right now:
Make 2 applications from the application we have right now:
A media asset application (to be developed by us) to handle all of the uploaded files using a REST-based API. Images will represented by a GUID, and we would add functions so that the images can be scaled and cropped.
Another application to be most of the application server excluding the image scaling part and storing part. When an uploaded image is requested, it will function as an adapter to the media asset application to get all the files in the correct sizes and layouts.
Pros:
We have control over what's happening
Might be a cool application in itself
Cons:
A project that might grow and be very complex
Need to make a huge change in our current application
Need to run several Rails applications locally while developing
Make an OpenStack installation:
The other option is to make an OpenStack installation and configure Paperclip to use it. If we have understood correctly, Amazon S3 is using something similar to OpenStack and Paperclip should be possible to configure against a custom installation.
Pros:
Paperclip and our setup will not be affected that much
Cons:
Will not be simple to run a local installation
Might be difficult to setup OpenStack
Very little knowledge on the product if it would fail
Any ideas, thoughts, experiences?

Struts 2 FileUpload in EC2 Glassfish 3 deployed not working

I have spent numerous hours searching for a solution to this, not sure where else to turn. Our main app is deployed on amazon EC2, GlassFish 3.1. One of our pages handles file uploads. It works fine on my local development box, and on several other local deployments and other developer boxes. I've done a number of different logging options, and every time on local boxes the changed logging options appear correctly.
The problem is, no matter what I've tried, in amazon EC2, the file when uploaded never shows up in the various temporary paths I've tried (including changing all permissions to the path and parent paths to 777.. bad.. I know but trying anything to get this to work), the file always shows empty, and the logging indicates no errors. I've modified the file types allowed, the max file size supported, to no avail.
At this point, I am thinking it has something to do with EC2, since it works in several other deployments in different networks (team in India, local box, etc). I can't find anything in the EC2 console that sheds any light on any changes needed to permit a file upload. Heck, I can scp the .war file up to the instance and deploy it just fine, so I can't imagine anything would block file uploads from the web app itself from a browser.
Any help at all is much appreciated as this is unfortunately the only thing holding up our initial alpha release.
Thank you.

Rails & Amazon S3 - how it works?

I would like to ask you for a simple beginner's question - I have my app in Rails and it's on Heroku. For storing images use the app S3 by Amazon.
For uploading images I use the Paperclip plugin.
And what I don't understand - I deploy my app from localhost to Heroku. It seems on Heroku my app works fine, I upload the image, this image is stored to S3 and in my app is fine displayed.
But now if I will upload an image on my localhost version - so the image will be uploaded to S3 bucket or will be stored on my hard drive?
Are these two sides separated or if I once set up into my model the S3 support, so that will be mean all images will uploaded to S3 (from heroku and from localhost)?
#phs is correct. The images will be stored on S3 regardless of where you run the app. This can cause you some grief if your :id is embedded in the image location (which it probably is) and your dev database has different ID's than your production/heroku database.