-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Configure cosmetic and functional variables with LOCALSTACK_HOST and GATEWAY_LISTEN #7893
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
Conversation
5f465ff
to
cea3aa6
Compare
cea3aa6
to
2a317cd
Compare
a744854
to
1343947
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.
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(",") |
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.
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.
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
The |
…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`.
We are switching to using
LOCALSTACK_HOST
andGATEWAY_LISTEN
to 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:4566
on the host and0.0.0.0:4566
in docker.GATEWAY_LISTEN
advantagesSince
GATEWAY_LISTEN
supports 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_HTTP
andEDGE_BIND_HOST
) as these are now derived fromGATEWAY_LISTEN
if absent. Some examples:GATEWAY_LISTEN
: "" ->EDGE_PORT=4566
,EDGE_PORT_HTTP=4566
,EDGE_BIND_HOST=127.0.0.1/0.0.0.0
GATEWAY_LISTEN=0.0.0.0:9999
->EDGE_PORT=9999
,EDGE_PORT_HTTP=9999
,EDGE_BIND_HOST=0.0.0.0
If
GATEWAY_LISTEN
is not given but legacy variables are, they pick up the supplied values rather than inheriting the defaultGATEWAY_LISTEN
.If
GATEWAY_LISTEN
includes multiple values, the first will be used to configure ourhypercorn
listener, and the rest will be transparent proxies (implementation in future PR).Legacy variables have been marked as deprecated:
LOCALSTACK_HOSTNAME
HOSTNAME_EXTERNAL
EDGE_PORT
EDGE_PORT_HTTP
EDGE_BIND_HOST
Design document