Forem Creators and Builders


Why s3_direct_upload and why not Active Storage?

Akhil Naidu
I am an Engineering Physics graduate from IIT Guwahati, but merely not restricted to Physics itself. In the past few years, I involved in many Cybersecurity blogging and now on Open-source.
・1 min read

As Forem is not using active storage and prefers to use the s3_direct_upload, which was not updated since 2016, I feel like we are missing a lot.

With s3_Direct-Uploads

Also, right now, we can solve many platform dependency issues if we use active storage. For example, if you use Heroku or Dokku based Forem, you need to use both s3 and Cloudflare paid addons for image-resizing.

On the other hand, if we use Forem in a container, we should manually create persistent storage for images and then use imgproxy for resizing. It's so good and the most desired, but we lost the availability to upload the files in s3.

With Active Storage

If we have active storage enabled, we can use the Rails-6 inbuild attributes to configure AWS SDK and upload images to s3. And also, if s3 is configured, we can use s3 as active storage(If needed) and make imgproxy work with s3. (Just by changing the URL format of imgproxy and adding IMGPROXY_USE_S3 variable)

Also, presently we can't use other storages other than s3, but with active storage, we can use Digital Ocean spaces or even Self Hosting MinIO.

The author of the s3_direct_upload was himself surprised@2018 to see his outdated repository@2016 to be in such good use. He even opened an issue, suggesting to migrate. So I guess this would be the right time to look into this aspect.

Including active storage will remove the dependency of external files like s3_direct_upload and also increases possibilities with added features.

Discussion (1)

coffeecraftcode profile image
Christina Gorton

Hey @akhil . I don't have a full answer for you yet of what we are using but we do not use s3_direct_upload in the new selfhost or managed Forem we will be releasing soon.