-
Notifications
You must be signed in to change notification settings - Fork 0
[DO NOT MERGE - PROTOTYPE] [Issue #22] Prototype download endpoint #68
Conversation
- EAGER_SERVICES_LOADING=1 | ||
volumes: | ||
- "${LOCALSTACK_VOLUME_DIR:-./volume}:/var/lib/localstack" | ||
- "/var/run/docker.sock:/var/run/docker.sock" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Maybe make sure to document specific LocalStack config or requirements in the project? Though it looks all baked into the image here
We won't need a license then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Localstack has a community version that is free. Seems the main difference is which features are supported. S3 seems like its fully supported in community, so would work.
# TODO | ||
start-localstack: | ||
docker-compose up --detach localstack | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a brief comment on the command here on what we use localstack for
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also something in the docs that explains how to spin this up and test grabbing a file locally?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was just a prototype - would add docs/connect properly in the makefile if I was going to merge this.
x = url.replace("localstack", "localhost") | ||
print(x) | ||
|
||
return redirect(x, 302) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will you write tests covering this endpoint? Also any logging we should do here? or exceptions that may occur on this route?
Made an actual implementation here: #87 - so don't need this prototype anymore |
PROTOTYPE for discussion - will not be merged
Summary
Fixes #22
Time to review: 5 mins
Changes proposed
Setup an endpoint that returns a presigned S3 URL (as a redirect)
Localstack setup to have a mocked S3
Context for reviewers
Experimenting with a few ideas about how we handle a download endpoint. The simplest way I can think of is to put the files on S3, and return a presigned URL. Presigned URLs let users directly interact with S3 files, so we aren't actually handling the transfer of files, the users could download it directly from the source in a safe/secure manner.
The exact way we return the URL we can sort out later, while I did set this up as a redirect, I don't think that actually would be what we'd want. I think instead returning the URL in an ordinary response would be better. The frontend (or any users of the endpoint) could then download it in whatever manner they want.
Additional information
This is clunky to run, requires a bit of manual work, if you'd like to test this out, let me know and I'll help.