Store user profile pics on AWS S3

Posted by Denny at 21:42 on Thu, 12 Dec 2019

It's now possible to store user profile pics on S3 if you set up a bucket and stick the relevant details in the ENV. If you don't do that, it falls back to local storage (which won't work on Heroku, as far as I'm aware, I think their dynos have a read-only filesystem for the most part - and not persisted across restarts, obviously).

You can get into some weird states if you delete the file directly via S3's web interface and then try to load it via the CMS, so I think there needs to be some more defensive code around the image loads somewhere - but it was good to get the basics working.

Tags: aws s3 images storage activestorage profile pics

« Refactoring authorisation and related code Authorisation with Pundit »


No comments found