Rails - How to store uploads on my database server - ruby-on-rails

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

Related

Can Heroku be made to use a persistent filesystem?

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.)

Use external file storage for heroku app?

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?

Azure - uploading files to blob storage via shared hosting

Im struggling to find an answer to this. I have a website that is deployed in a shared hosting environment. I want to allow people to upload files to my azure blob storage account.
I have this working locally, using the storage emulator, however when I publish the site I get a Security Exception.
Is this actually possible under a shared hosting envrionment ?
Cheers
A bit more detail would help, in understanding how these uploads are taking place. That said, I'll make the assumption that people are uploading directly to Blob Storage, and not through your Website (or Web Service).
To allow direct uploads, you need to provide either a public blob or container (which everyone in the world can see), or create a temporary Shared Access Signature (SAS) on a specific blob or container, that grants access for a short time window.
If your app is Silverlight, then you are probably running into a cross-domain issue (and you'll need to correct that with an access policy).
If you provide more details around the way uploads are being sent, as well as the client and server technology, I can edit my answer to be more specific.

Publishing a Ruby on Rails website using Amazon S3

I've completed my website using a Ruby on Rails framework, which uses a simple database.
I have set up an Amazon S3 account and would like to upload it to this, however I've been told that I would need more than just this to get the website working.
I am COMPLETELY new to uploading RoR websites, so would anyone be willing to talk me through what needs doing/ why?
Amazon S3 is simply for storing static assets, images, css etc. You can run entirely static sites on it ie html but not 'applications'.
You may have misheard - you could use Amazon EC2 which provide you with a virtual server to host your application and run your application.
If you are entirely new to this process then I suggest you investigate the likes of Heroku (heroku.com) EngineYard, BrightBox, Rackspace etc With the first you probably would be able to use their free offering and deployment is simply by Git - there's no system administration involved.

Where to save scraped images?

I'm building a Ruby on Rails app that scrapes the images off a website. What is the best location to save this images to?
Edit:
To be clear, I know the file system is the best type of storage, but where on the file system? I suppose I have to stay in the RoR app directory, but which folder is best suitable for this? public?
On your file server (static Apache server), on your app server (save some where locally in the disk and serve via the app server) or on Amazon S3
But I would suggest not to store in Database. (Some people think it's alright. So, I would be limited to suggestion)
in ROR, under <app_name>/public/images see here -- but the data will be public. If you are worried about privacy, probably this is not right.
If you are concerned about privacy, see the options discussed here How to store private pictures and videos in Ruby on Rails But as a sughestion: serving files from app-server may be painful in high traffic conditions and my experience is it better off-loaded to a file server or a cloud like S3.
It's not hard to write and/or create a server that is only serving images from a file store outside your website's directory structure. A simple rewrite of the URL can provide your code with the info it needs to the actual file location, which it then outputs to the browser.
An alternate is to have the image's URL mapped to the image's directory path in a database, then do a lookup. Make the URL field an indexed lookup and it will be very fast.
I wrote an image server in Ruby a couple years ago along those lines and it was a pretty simple task.

Resources