aws / aws-lambda-runtime-interface-emulator

Apache License 2.0
936 stars 99 forks source link

Implement listen address argument and Rapid port argument #62

Closed StefanNienhuis closed 1 year ago

StefanNienhuis commented 2 years ago

Issue #, if available: None

Description of changes:

Implements listen address argument (-l|--listen <listen-address>). If the argument is not supplied, it defaults to 0.0.0.0:8080 for backwards-compatibility.

Not sure whether to merge on develop or main, but develop is the default branch so I'm basing it on that.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

StefanNienhuis commented 2 years ago

This would also close #14, which is a WIP with the same goal, but is based on a much older version of the codebase.

StefanNienhuis commented 2 years ago

The motivation behind the PR is that I want to run multiple instances of RIE, to support multiple Lambda functions (without Docker, as I want the Lambda functions to quickly restart). However, while testing this with the current codebase, I noticed that port 9001 is also hard coded.

This seems to be for the rapid server. I'm not too familiar with the codebase, but I don't really see why there's another HTTP server. Could you give some information on this?

If it is essential to run those two servers, I propose adding another property to the SandboxBuilder Init object, that specifies the rapid server address & port, which in turn can be specified by an argument in the aws-lambda-rie package. Does that sound alright?

StefanNienhuis commented 2 years ago

Changed the implementation up a bit from what I said earlier, but accomplishes the same goal for the Rapid port.

volphy commented 2 years ago

Is there any chance that this PR will be merged to the main branch and released?

valerena commented 2 years ago

Hi. This year the team that maintains this has been short on resourcing to dedicate enough time to PR reviews and we've been just updating the released binaries because of security reports with the Go version. We expect to be able to dedicate more time to this project from July on. Sorry for any inconvenience this might cause.

eval-apply commented 2 years ago

This would be a very welcome feature, having a flag for the port would make using RIE much more pleasant in my workflow.

ghost commented 2 years ago

Thank you StefanNienhuis for working upon this improvement and opening a pull request.

We have merged functionality upstream to enable the providing of --runtime-api-address and --runtime-interface-emulator-address as command line arguments.

This functionality will be available with the next merge from upstream. I will leave this ticket open until the next merge from upstream.

Thanks you!

rpmcginty commented 1 year ago

@bodelsc Could you provide the upstream package and commit this change was merged with?

ghost commented 1 year ago

@bodelsc Could you provide the upstream package and commit this change was merged with?

Hi @rpmcginty,

Sorry for the delayed response I have been off on holiday until today.

The upstream repository is a private repository within AWS which undergoes active development and periodically all the changes are synced with this public repository. E.g. https://github.com/aws/aws-lambda-runtime-interface-emulator/pull/59

On the next synchronisation from the upstream private repository to this public repository it will include the change.

Regards, Callum

StefanNienhuis commented 1 year ago

Hi @ghost, do you have any idea as to when upstream will be merged into this repository?

Regards, Stefan

valerena commented 1 year ago

Hi @StefanNienhuis . I'm sorry for the really long delay on our side. The changes mentioned previously were finally merged from upstream and released in the latest version.

Now it's possible to add a parameter --runtime-interface-emulator-address to indicate the address where RIE will be receiving requests.