I have rails application running on heroku, as heroku file system is read-only so we cannot store any files or images on heroku.
A lot of people has suggested to use amazon s3, but can i use external storage to save user files and images and to retrieve them from there with paperclip or carrier-wave or anything similar.
Currently i am using Dropbox for images and files storage. But its too slow. I have a shared hosting account, there i have a lot of disk space and i want to use that to store files.
Any idea on how to do that?
Related
I've built an app where users can upload their avatars. I used the paperclip gem and everything works fine on my local machine. On Heroku everything works fine until server restart. Then every uploaded images disappear. Is it possible to keep them on the server?
Notice: I probably should use services such as Amazon S3 or Google Cloud. However each of those services require credit card or banking account information, even if you want to use a free mode. This is a small app just for my portfolio and I would rather avoid sending that information.
No, this isn't possible. Heroku's filesystem is ephemeral and there is no way to make it persistent. You will lose your uploads every time your dyno restarts.
You must use an off-site file storage service like Amazon S3 if you want to store files long-term.
(Technically you could store your images directly in your database, e.g. as a bytea in Postgres, but I strongly advise against that. It's not very efficient and then you have to worry about how to provide the saved files to the browser. Go with S3 or something similar.)
In my Rails app, for HIPAA reasons, I need to keep all my data stored on a separate server from my web application. This is simple to do with the database, but what's the best way to allow my rails app (on the web server) to access uploads on the filesystem of the database server? Or should I just store the uploads in the database (mysql)?
I'm using Rails 3.2 and Paperclip, but could switch to Carrierwave or another solution
Thanks!
Or should I just store the uploads in the database (mysql)
No. I will point you here for a better explanation Storing Images in DB - Yea or Nay?
what's the best way to allow my rails app (on the web server) to access uploads on the filesystem of the database server
I would probably create another web server with a separate rails app that was responsible solely for serving up files from it's local filesystem through some authenticated API.
It looks like people do use Amazon S3 successfully with HIPAA-compliant websites for file storage.
Can you create a HIPAA compliant Amazon S3 Web Application?
Amazon White Paper - Creating HIPAA-compliant Medical Data Applications with AWS
Googling "amazon hipaa compliance" turns up quite a bit of info. I would look into this before building my own infrastructure for storing files.
you can configure paper clip to store your documents on amazon s3
https://github.com/thoughtbot/paperclip#storage
http://rubydoc.info/gems/paperclip/Paperclip/Storage/S3
I'm building a rails application where users may want to upload images occasionally. Is there a way to have the users seamlessly upload the images to a remote host, like imgur, and store the URLs to the images in my database so that they can be displayed when needed?
I want to give the impression that they are uploading images directly to the database while actually offloading them to imgur. Is there a gem that does this, or does anybody have a good way to implement this?
Thanks.
Not sure about imgur, but if what you want is simply storing the images on the remote server, I think s3 + paperclip can be a good choice.
aws sdk: http://aws.amazon.com/articles/8621639827664165
paperclip: https://github.com/thoughtbot/paperclip
Using "gem 'carrierwave'" and "gem 'fog'" to upload to Google Cloud Storage or Amazon S3 is probably your best option.
http://railscasts.com/episodes/383-uploading-to-amazon-s3
I have an grails application, which allows users to upload image files and these images can be displayed. The application actually only stores file path in database and saves the image files in file system.
I've read some posts which says Cloud Foundry doesn't support local file system access. So my question is what modification should I do if I want to deploy my application to Cloud Foudry? I hope images still can be displayed directly on the webpage and users don't have to download them to their own computer only for viewing them.
The images stored on file system can disappear when your application stops, crashes, or moves. It should not be used for content that you want to persist. Further, the file system storage is not scalable. That is to say if more than one instance of your app is running the local storage is only visible to a specific instance of the app, and is not visible or shared across all instances.
To meet your requirements, a local service such as MongoDB GridFS, MySQL with blob data type or external blob stores such as Box.net or Amazon S3 can be used.
I'm developing a webapp with Rails, Paperclip and Heroku but since my last commit were I just added Google Analytics the most of the uploaded images disappeared! That's my link: http://wo42.herokuapp.com/ I don't know why that happened oO
Heroku never used to let you write to their file-system although they have recently introduced something calld the ephemeral file-system - this article explains it. Best option is to use S3.
The actual issue here is that when you push to Heroku your application is re-deployed, and that won't be to the same machine that you were on before (it could be anywhere at any time).
Therefore, if you were uploading images to your local dynos filesystem, only that dyno had access to those files. When you deployed, that dyno would have been destroyed and a new one created.
This is why Heroku recommend that you use a persistent backing service such as S3 to store your uploaded and persisted files. This sort of service is available to all dynos and persists across deploys.
https://devcenter.heroku.com/articles/s3