Skip to content

Conversation

simonrw
Copy link
Contributor

@simonrw simonrw commented Mar 17, 2023

We are switching to using LOCALSTACK_HOST and GATEWAY_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 to localhost.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 to 127.0.0.1:4566 on the host and 0.0.0.0:4566 in docker.

GATEWAY_LISTEN advantages

Since 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 and EDGE_BIND_HOST) as these are now derived from GATEWAY_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 default GATEWAY_LISTEN.

If GATEWAY_LISTEN includes multiple values, the first will be used to configure our hypercorn 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

@simonrw simonrw self-assigned this Mar 17, 2023
@simonrw simonrw temporarily deployed to localstack-ext-tests March 17, 2023 12:00 — with GitHub Actions Inactive
@coveralls
Copy link

coveralls commented Mar 17, 2023

Coverage Status

Coverage: 84.943% (+0.005%) from 84.938% when pulling df661df on deprecate-envars into 5f13258 on master.

@github-actions
Copy link

github-actions bot commented Mar 17, 2023

LocalStack integration with Pro

1 827 tests  ±0   1 481 ✔️ ±0   1h 5m 35s ⏱️ +56s
       1 suites ±0      345 💤 ±0 
       1 files   ±0          1 ±0 

For more details on these failures, see this check.

Results for commit f4d8a4b. ± Comparison against base commit fad6714.

♻️ This comment has been updated with latest results.

@simonrw simonrw temporarily deployed to localstack-ext-tests March 20, 2023 09:46 — with GitHub Actions Inactive
@simonrw simonrw marked this pull request as ready for review March 20, 2023 10:13
@simonrw simonrw requested a review from thrau as a code owner March 20, 2023 10:13
@simonrw simonrw marked this pull request as draft March 20, 2023 10:42
@simonrw simonrw temporarily deployed to localstack-ext-tests March 22, 2023 13:19 — with GitHub Actions Inactive
@simonrw simonrw temporarily deployed to localstack-ext-tests March 22, 2023 15:28 — with GitHub Actions Inactive
@simonrw simonrw temporarily deployed to localstack-ext-tests March 22, 2023 16:31 — with GitHub Actions Inactive
@simonrw simonrw changed the title Add deprecation notices for HOSTNAME_EXTERNAL/LOCALSTACK_HOST Configure cosmetic and networking variables with LOCALSTACK_HOST and EDGE_BIND Mar 22, 2023
@simonrw simonrw changed the title Configure cosmetic and networking variables with LOCALSTACK_HOST and EDGE_BIND Configure cosmetic and functional variables with LOCALSTACK_HOST and EDGE_BIND Mar 22, 2023
@simonrw simonrw temporarily deployed to localstack-ext-tests March 22, 2023 16:50 — with GitHub Actions Inactive
@simonrw simonrw marked this pull request as ready for review March 22, 2023 16:51
@simonrw simonrw temporarily deployed to localstack-ext-tests March 22, 2023 16:51 — with GitHub Actions Inactive
@simonrw simonrw temporarily deployed to localstack-ext-tests March 23, 2023 12:13 — with GitHub Actions Inactive
@simonrw simonrw changed the base branch from master to v2 March 23, 2023 12:52
@simonrw simonrw temporarily deployed to localstack-ext-tests March 23, 2023 12:55 — with GitHub Actions Inactive
Copy link
Member

@thrau thrau left a 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

port = int(localstack_host.split(":")[-1])
edge_bind = f"{default_ip}:{port}"
else:
components = edge_bind.split(",")
Copy link
Member

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.

@simonrw simonrw temporarily deployed to localstack-ext-tests March 23, 2023 13:37 — with GitHub Actions Inactive
@simonrw simonrw temporarily deployed to localstack-ext-tests March 23, 2023 13:41 — with GitHub Actions Inactive
@simonrw simonrw changed the title Configure cosmetic and functional variables with LOCALSTACK_HOST and EDGE_BIND Configure cosmetic and functional variables with LOCALSTACK_HOST and GATEWAY_LISTEN Mar 23, 2023
@simonrw simonrw temporarily deployed to localstack-ext-tests March 23, 2023 15:19 — with GitHub Actions Inactive
@simonrw
Copy link
Contributor Author

simonrw commented Mar 23, 2023

The test_presigned_url_v4_signed_headers_in_qs S3 integration test is failing, but will be fixed with an upcoming merge of the new lambda provider. Thanks @alexrashed for the suggestion. I will merge this even though the pipeline is failing.

@simonrw simonrw merged commit 9f67f51 into v2 Mar 23, 2023
@simonrw simonrw deleted the deprecate-envars branch March 23, 2023 15:28
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`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants