hicommonwealth / commonwealth

A platform for decentralized communities
https://commonwealth.im
GNU General Public License v3.0
67 stars 44 forks source link

Decide between presigned url vs direct upload approach for content in S3 #8742

Closed kurtisassad closed 1 month ago

kurtisassad commented 3 months ago

There would basically be 2 approaches for uploading content to s3. We could either send a presigned url to the user for them to upload the content themselves, or the user can pass in the content to our server, and we make a direct upload to s3.

Presigned URL

Description

So the idea would be the user has content they want to upload, say a thread body. They request for a presigned url from our server which then points them to an s3 bucket which the can upload that content to. During this presigned url request, our server would fire an event to a queue containing the s3 url of the content for further processing (indexing, ...) by some asynchronous consumer processes.

Pros

Cons

Direct Upload

Description

The user uploads the content directly to our server. Our server then uploads the data directly to S3. The server would perform the further processing step as part of this upload request.

Pros

Cons

timolegros commented 1 month ago

I'm not sure if we landed on a specific approach here but I do believe we agreed that the direct upload method is easier to implement. As such I think for now we should move forward with the simple approach and we can transition to a pre-signed URL method in the future if necessary. @kurtisassad please let me know ASAP if you disagree because I will be working on the bucket ticket starting today.

jnaviask commented 1 month ago

I'm OK with the direct upload approach here for the time being. Closing this ticket. We can revisit once initial MVP is in place.