Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attaching Photos: Look into blob storage with CarrierWave #30

Open
GFLEMING133 opened this issue Aug 13, 2019 · 4 comments
Open

Attaching Photos: Look into blob storage with CarrierWave #30

GFLEMING133 opened this issue Aug 13, 2019 · 4 comments
Labels
Architecture / Design Work item describes a feature or decision that affects infrastructure or flow of existing program enhancement New feature or request

Comments

@GFLEMING133
Copy link
Member

Given that CarrierWave does not have built-in support for blob storage (active storage does but it is obviously built for ActiveRecord). This brings into question whether or not we actually need a database as part of this application.

Questions for the room:

  1. What are the benefits of using blobs?

  2. Is it possible to use blobs without a database?

  3. If "no" to Implemented better handling for GitHub API rate limit errors #2, is the statement "having a database is not extremely beneficial" accurate?

@andy-wojciechowski @rgeorgebu @GFLEMING133

@GFLEMING133 GFLEMING133 added enhancement New feature or request Architecture / Design Work item describes a feature or decision that affects infrastructure or flow of existing program labels Aug 13, 2019
@GFLEMING133
Copy link
Member Author

For context, this is the original work item submitted for this:

Attaching Photos: Look into blob storage with CarrierWave

Findings from Andy: CarrierWave does not have built in support for blob storage does. ActiveStorage does but it's built for ActiveRecord. If we wanted this wouldn't it be for a database? Instead why don't we just delete the cache folder from the server after we submit a post

@andy-wojciechowski
Copy link
Member

If we go with blob storage do we want to look into investing into some cloud file storage? AWS might be a realistic option for SSE but do we want to add an extra AWS layer? Which might be more difficult for future SSE website developers to maintain.

@andy-wojciechowski
Copy link
Member

I found an interesting article if we go with AWS: https://medium.com/@pk60905/use-carrierwave-to-upload-files-to-s3-81ce79c29b6d. I didn't see the fog-aws gem during my initial research and we can use that gem without a database.

@andy-wojciechowski
Copy link
Member

@rgeorgebu @GFLEMING133 Based on my findings: https://habiletechnologies.com/blog/better-saving-files-database-file-system/. I don't think storing a blob in a DB would be appropriate due to performance. We store image files temporarily on the server and I feel like we would run into performance problems reading images files from the DB given a post can contain any amount of photos that a user wants. Also, I think it would just be overkill for temporary storage. Blob storage seems likes its more for long term image storage. However if we want to support something like drafts in the future I think we should go with PostgreSQL with blob storage.

I think our solution is currently the simplest possible solution with just storing it directly on the server. The only improvement I would make is to possibly add a CRON job to cleanup old cached files from the server. However I feel like the best alternative would be AWS: https://devcenter.heroku.com/articles/s3#file-uploads. With AWS we would not to worry about managing files stored on the server, but it would take a little more setup and we would have an extra layer in our system to maintain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Architecture / Design Work item describes a feature or decision that affects infrastructure or flow of existing program enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants