Configure cosmetic and functional variables with LOCALSTACK_HOST and GATEWAY_LISTEN#7893
Merged
Configure cosmetic and functional variables with LOCALSTACK_HOST and GATEWAY_LISTEN#7893
Conversation
5f465ff to
cea3aa6
Compare
cea3aa6 to
2a317cd
Compare
This was referenced Mar 22, 2023
a744854 to
1343947
Compare
thrau
reviewed
Mar 23, 2023
thrau
reviewed
Mar 23, 2023
thrau
approved these changes
Mar 23, 2023
Member
thrau
left a comment
There was a problem hiding this comment.
this looks great! really nice deprecation path. just a couple of nits regarding naming, but nothing blocking
localstack/config.py
Outdated
| port = int(localstack_host.split(":")[-1]) | ||
| edge_bind = f"{default_ip}:{port}" | ||
| else: | ||
| components = edge_bind.split(",") |
Member
There was a problem hiding this comment.
nit: should we maybe output a warning here if there are >1 components in here for now, since they are ignored? we could however pretty soon update the logic to start the gateway and proxies.
simonrw
added a commit
that referenced
this pull request
Mar 23, 2023
This means we can test the configuration without mutating global state, which affects downstream tests.
If the user has not migrated yet, we don't want the new variables' defaults overriding their configuration.
f4d8a4b to
d7aa1e2
Compare
Contributor
Author
|
The |
alexrashed
pushed a commit
that referenced
this pull request
Mar 23, 2023
…GATEWAY_LISTEN (#7893) Switch to using `LOCALSTACK_HOST` and `GATEWAY_LISTEN` for configuring the cosmetic and functional properties of LocalStack. * `LOCALSTACK_HOST`: cosmetic - interpolated into URLs and hostnames/ports returned * `GATEWAY_LISTEN`: functional - replaces `EDGE_PORT`, `EDGE_PORT_HTTP`, `EDGE_BIND_HOST`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We are switching to using
LOCALSTACK_HOSTandGATEWAY_LISTENto configure LocalStack.Variable types
These variables are split into two types: cosmetic and functional. Cosmetic are purely used as hostnames in returned URLs or addresses by LocalStack. LocalStack does not use these variables to configure services.
functional variables are used to configure the networking stack of LocalStack.
Roles
LOCALSTACK_HOST: (cosmetic) this variable is interpolated into URLs and addresses. It has the form<hostname>:<port>and defaults tolocalhost.localstack.cloud:4566.GATEWAY_LISTEN: (functional) this configures the bind addresses of LocalStack. It has the form<ip address>:<port>(,<ip address>:<port>)*and defaults to127.0.0.1:4566on the host and0.0.0.0:4566in docker.GATEWAY_LISTENadvantagesSince
GATEWAY_LISTENsupports multiple addresses (separated by,) we can provide configuration for pro users who wish to use SSL e.g.GATEWAY_LISTEN=0.0.0.0:4566,0.0.0.0:443.Legacy configuration
Existing configuration of the system is maintained with the existing legacy variables (
EDGE_PORT,EDGE_PORT_HTTPandEDGE_BIND_HOST) as these are now derived fromGATEWAY_LISTENif absent. Some examples:GATEWAY_LISTEN: "" ->EDGE_PORT=4566,EDGE_PORT_HTTP=4566,EDGE_BIND_HOST=127.0.0.1/0.0.0.0GATEWAY_LISTEN=0.0.0.0:9999->EDGE_PORT=9999,EDGE_PORT_HTTP=9999,EDGE_BIND_HOST=0.0.0.0If
GATEWAY_LISTENis not given but legacy variables are, they pick up the supplied values rather than inheriting the defaultGATEWAY_LISTEN.If
GATEWAY_LISTENincludes multiple values, the first will be used to configure ourhypercornlistener, and the rest will be transparent proxies (implementation in future PR).Legacy variables have been marked as deprecated:
LOCALSTACK_HOSTNAMEHOSTNAME_EXTERNALEDGE_PORTEDGE_PORT_HTTPEDGE_BIND_HOSTDesign document