-
Notifications
You must be signed in to change notification settings - Fork 67
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
Implement remote resolver for storage indexer #823
Conversation
Status update: I tried to use Google Storage client to reach out the public bucket, but failed as I tried with a generic Now, I'm working on enabling the L7 proxy mode when the response can be streamed directly from Package Storage. I don't know what I do with streaming resources from the zip file. In the worst case, we will have to unpack and store them in the public bucket. |
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.
Added a suggestion about explicitly configuring the package to indicate that it requires redirects, instead of relying on the indexer, let me know what you think. I think this may require less refactors.
artifacts.go
Outdated
@@ -58,7 +60,13 @@ func artifactsHandler(indexer Indexer, cacheTime time.Duration) func(w http.Resp | |||
return | |||
} | |||
|
|||
aPackage := packageList[0] | |||
if storageIndexer, assert := aPackage.Indexer().(*storage.Indexer); assert { | |||
storageIndexer.HijackArtifactsHandler(w, r, aPackage) |
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.
I wouldn't call it "Hijack", here we are doing a legit redirect 🙂
Some suggestions:
storageIndexer.HijackArtifactsHandler(w, r, aPackage) | |
storageIndexer.RedirectArtifactsHandler(w, r, aPackage) |
storageIndexer.HijackArtifactsHandler(w, r, aPackage) | |
storageIndexer.RemoteArtifactsHandler(w, r, aPackage) |
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.
I can apply those renamings, not a problem :)
I found an analogy with http.Hijacker, which lets a handler take over the TCP connection. In this case, we let Storage Indexer handlers process requests, which include a redirection.
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.
Ok, let's keep this terminology if already present in the standard library :)
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.
Thanks for addressing all the comments! 🚀
This PR implements hijack handlers for the storage indexer to redirect package zip, artifacts, static requests to https://package-storage.elastic.co/.
It uses HTTP 303 to pass the request. It was the easiest way to implement because I don't have to write content streaming at all. No need for Accept-Range tests, download tests, etc.
Breaking changes:
Spotted bugs:
Local testing:
How to prepare the development bucket (
cursor.json
andsearch-index-all.json
):Questions:
queue-publishing
with package candidates in the private bucket? I don't remember why have we decided to put indices in the internal one...Fixes #767