-
Notifications
You must be signed in to change notification settings - Fork 97
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
feat(wasmtime): support wasi:http/proxy world in wasmtime shim #691
Conversation
131e0b5
to
74b24e7
Compare
dfae7d6
to
9548e83
Compare
563426c
to
64ffcbf
Compare
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.
Great work! I left some comments on this PR. I think the shape of this PR is pretty good and I am happy to approve it to merge to the main tree when comments are resolved.
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.
LGTM!
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 @andreiltd, this is great work, and a great feature!
I left a few comments, but I don't think we need to address all of them here.
resource_table: ResourceTable::default(), | ||
}; | ||
Ok(wasi_data) | ||
pub(crate) fn envs_from_ctx(ctx: &impl RuntimeContext) -> Vec<(String, String)> { |
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.
thought: I'm inclined to think that this functionality should be part of the context, but not sure what name it should have.
Here is a follow up PR that implements a graceful server shutdown: https://github.com/andreiltd/runwasi/pull/1/files |
6b51a1b
to
ea036fa
Compare
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 @andreiltd for your contribution!
🥂 thanks for working on this, @andreiltd ! |
This is a follow-up to #401.
The patch introduces initial support for the
wasi:http/proxy
world in thewasmtime
shim. The main goal is to detect components targetinghttp/proxy
, start up ahyper
server to listen for incoming connections, and forward the incoming requests to the WASM component for handling. This behavior is very similar to what thewasmtime serve
command currently offers. The server task is terminated upon receiving a terminate or interrupt signal in the container.The server can be customized by setting environment variables passed to the RuntimeContext. These variables include:
WASMTIME_HTTP_PROXY_SOCKET_ADDR
: Defines the socket address to bind to (default: 0.0.0.0:8080).WASMTIME_HTTP_PROXY_BACKLOG
: Defines the maximum number of pending connections in the queue (default: 100).The compiled WASM component targeting
wasi:http/proxy
world has been integrated into thetest-modules
crate. This allows us to validate the functionality in the integration tests.Closes: #416