From e3abddc3d5630e716419bd5ab6d0509778179a08 Mon Sep 17 00:00:00 2001 From: Simon Walker Date: Thu, 29 Aug 2024 12:18:18 +0100 Subject: [PATCH 1/3] Embed scenario descriptions --- scenarios/1-missing-network-configuration/README.md | 7 ++++++- scenarios/2-no-subdomain-support/README.md | 6 +++++- scenarios/3-urls-with-localhost/README.md | 13 ++++++++++++- scenarios/4-ls-in-network-not-target/README.md | 4 +++- scenarios/README.md | 4 ++-- 5 files changed, 28 insertions(+), 6 deletions(-) diff --git a/scenarios/1-missing-network-configuration/README.md b/scenarios/1-missing-network-configuration/README.md index ebeb939..1fd0bac 100644 --- a/scenarios/1-missing-network-configuration/README.md +++ b/scenarios/1-missing-network-configuration/README.md @@ -1,6 +1,11 @@ # Scenario 1 -Description: https://www.notion.so/localstack/Design-doc-154e88f34b774f0796e20a9b738e0d48?pvs=4#0f3d8350042d4434879f364188cc8c8f +I am a user who has an application container that needs to talk to LocalStack. For example, I have an API Gateway REST API that I communicate with from my application container. My application container is running in docker but cannot connect to LocalStack. The reason is that I haven’t read the network troubleshooting guide, and my containers are in a different network. I am using the CLI to start LocalStack, and did not start either container in a docker network. +1. Solution: put both docker containers in a user-defined network and use container name to address LS ✔️ +2. Solution: use `--network=host` 🤷 +3. Solution: use `host.docker.internal` (if available) 🤷 +4. Solution: use deprecated `links` API 🤷 +5. Solution: use the same network *namespace (*https://docs.docker.com/engine/reference/run/#network-container) ❌ # setup diff --git a/scenarios/2-no-subdomain-support/README.md b/scenarios/2-no-subdomain-support/README.md index dc61e13..845740d 100644 --- a/scenarios/2-no-subdomain-support/README.md +++ b/scenarios/2-no-subdomain-support/README.md @@ -1,6 +1,10 @@ # Scenario 2 -Description: https://www.notion.so/localstack/Design-doc-154e88f34b774f0796e20a9b738e0d48?pvs=4#9e9ca4599d914999aed789074e30c6ae +I am running LS from within a docker compose stack. My LS container and application container are implicitly within a user defined docker network, created by docker compose. I wish to access an API Gateway subdomain from my application container but I can’t. I am using `:4566` to connect to from my application container, but I cannot access `.execute-api.us-east-1.:4566`. +2. Solution: [configure the DNS server of the application container to point to LocalStack](https://docs.localstack.cloud/references/network-troubleshooting/endpoint-url/#from-your-container) +1. Solution: use external dns e.g. https://gist.github.com/boomshadow/20677ef02f110e448ee058ae6149af3a ✔️ +2. Solution: in pro - use LS DNS server and set `DNS_RESOLVE_IP` ✔️ +3. Solution: use tags when creating the domain to set a static rest API ID, and add hosts in docker to target that specific subdomain ❌ # setup diff --git a/scenarios/3-urls-with-localhost/README.md b/scenarios/3-urls-with-localhost/README.md index 3c8df70..58cca21 100644 --- a/scenarios/3-urls-with-localhost/README.md +++ b/scenarios/3-urls-with-localhost/README.md @@ -1,6 +1,17 @@ # Scenario 3 -Description: https://www.notion.so/localstack/Design-doc-154e88f34b774f0796e20a9b738e0d48?pvs=4#08efe8cb037046618bb6e34948871902 +I am trying to access an SQS queue created by LocalStack from my application container. I have received a queue url of `http://localhost:4566/000000000000/`. I try to connect to this endpoint from my application container, but I cannot access the queue. This is because the domain name returned is `localhost` (the current default), and of course LS is not available in the application container. I want to use the URL returned to access the SQS queue from the host and my application container. +1. Partial solution: set `HOSTNAME_EXTERNAL` to the docker container name for intra-docker communication, but won’t work at the same time from the host +2. Solution: set `HOSTNAME_EXTERNAL` to [`localhost.localstack.cloud`](http://localhost.localstack.cloud) for the host and add network aliases to the docker network + +```yaml +networks: + default: + aliases: + - localhost.localstack.cloud +``` + +3. Wait for https://github.com/moby/moby/pull/43444 to be merged ❌ # setup diff --git a/scenarios/4-ls-in-network-not-target/README.md b/scenarios/4-ls-in-network-not-target/README.md index c9d743a..3ba2c75 100644 --- a/scenarios/4-ls-in-network-not-target/README.md +++ b/scenarios/4-ls-in-network-not-target/README.md @@ -1,6 +1,8 @@ # Scenario 4 -Description: https://www.notion.so/localstack/Design-doc-154e88f34b774f0796e20a9b738e0d48?pvs=4#0f3d8350042d4434879f364188cc8c8f +I have launched LocalStack in a network as per the troubleshooting docs, but I have launched my application container in the default network. I cannot connect to LocalStack from my application container. +1. Solution: re-launch your container in the docker network of the LocalStack container +2. Solution: attach your container to the docker network of LocalStack (though ideally use option a) # setup diff --git a/scenarios/README.md b/scenarios/README.md index be976a2..5a2e0f2 100644 --- a/scenarios/README.md +++ b/scenarios/README.md @@ -1,5 +1,5 @@ # Test scenarios -These scenarios correspond to the information specified in this [design document](https://www.notion.so/localstack/Design-doc-154e88f34b774f0796e20a9b738e0d48?pvs=4#9fd287b388f6448faa1039f00e821c8d). - Run the `bootstrap.sh` script first. This only has to be done once per system (it installs the npm packages). + +_Note: these scenarios are relevant to LocalStack < 2_ however the debug application is still relevant._ From 759fafbd2af8952c26dcfe4767b0e862cc986f7d Mon Sep 17 00:00:00 2001 From: Simon Walker Date: Thu, 29 Aug 2024 12:19:52 +0100 Subject: [PATCH 2/3] Update scenario 2 formatting --- scenarios/2-no-subdomain-support/README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scenarios/2-no-subdomain-support/README.md b/scenarios/2-no-subdomain-support/README.md index 845740d..8f03532 100644 --- a/scenarios/2-no-subdomain-support/README.md +++ b/scenarios/2-no-subdomain-support/README.md @@ -1,10 +1,11 @@ # Scenario 2 I am running LS from within a docker compose stack. My LS container and application container are implicitly within a user defined docker network, created by docker compose. I wish to access an API Gateway subdomain from my application container but I can’t. I am using `:4566` to connect to from my application container, but I cannot access `.execute-api.us-east-1.:4566`. -2. Solution: [configure the DNS server of the application container to point to LocalStack](https://docs.localstack.cloud/references/network-troubleshooting/endpoint-url/#from-your-container) -1. Solution: use external dns e.g. https://gist.github.com/boomshadow/20677ef02f110e448ee058ae6149af3a ✔️ -2. Solution: in pro - use LS DNS server and set `DNS_RESOLVE_IP` ✔️ -3. Solution: use tags when creating the domain to set a static rest API ID, and add hosts in docker to target that specific subdomain ❌ + +1. Solution: [configure the DNS server of the application container to point to LocalStack](https://docs.localstack.cloud/references/network-troubleshooting/endpoint-url/#from-your-container) +2. Solution: use external dns e.g. https://gist.github.com/boomshadow/20677ef02f110e448ee058ae6149af3a ✔️ +3. Solution: in pro - use LS DNS server and set `DNS_RESOLVE_IP` ✔️ +4. Solution: use tags when creating the domain to set a static rest API ID, and add hosts in docker to target that specific subdomain ❌ # setup From 80410d0528b55f3631df87ed347fee4274383cb1 Mon Sep 17 00:00:00 2001 From: Simon Walker Date: Thu, 29 Aug 2024 12:21:08 +0100 Subject: [PATCH 3/3] Add link to troubleshooting guide to readme --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 058ca9b..9cdffe7 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,9 @@ This repository contains the source code for the LocalStack docker debug application. +> [!TIP] +> Please see the [Network Troubleshooting Guide](https://docs.localstack.cloud/references/network-troubleshooting) for more up to date guidance. + ## Usage If you have an issue with your docker networking setup, you can use this docker container to investigate further.