From 10ce9812575f05bca9c62575f52c6fca697d5dba Mon Sep 17 00:00:00 2001 From: Paul Robello Date: Tue, 7 Nov 2023 09:17:27 -0800 Subject: [PATCH] cleanup and simplify localstack compose layers --- dc-ls-host.yml | 47 -------------------------------------------- dc-ls.yml | 31 +++++++++++++++-------------- docker-compose.yml | 2 +- run-dev-container.sh | 5 ++--- 4 files changed, 19 insertions(+), 66 deletions(-) diff --git a/dc-ls-host.yml b/dc-ls-host.yml index 0da118d..224973d 100644 --- a/dc-ls-host.yml +++ b/dc-ls-host.yml @@ -2,12 +2,6 @@ version: '3.8' services: localstack: - image: "${LS_IMAGE-localstack/localstack}:${LS_VERSION-latest}" - container_name: "${LS_MAIN_CONTAINER_NAME-localstack}" - stdin_open: true - tty: true - networks: - devnet: ports: - "4566:4566" # LocalStack Gateway - "4510-4560:4510-4560" # external services port range @@ -15,45 +9,4 @@ services: - "443:443" # LocalStack HTTPS Gateway (required for Pro) - "4571:4571" # elasticsearch service environment: - # needed for LS Pro - - LOCALSTACK_API_KEY=${LOCALSTACK_API_KEY-} - - LOCALSTACK_AUTH_TOKEN=${LOCALSTACK_AUTH_TOKEN-} - - EXTRA_CORS_ALLOWED_ORIGINS=http://host.docker.internal:4566 - - DISABLE_CORS_CHECKS=1 - - PROVIDER_OVERRIDE_S3=v3 # new LS native s3 - - DEBUG=${DEBUG-} -# - LS_LOG=trace - # docker or docker-reuse -# - LAMBDA_EXECUTOR=${LAMBDA_EXECUTOR-docker-reuse} # this is deprecated in V2 and will be removed. - # remove idle lambdas - - LAMBDA_REMOVE_CONTAINERS=1 - # how long to keep idle lambdas around - - LAMBDA_RUNTIME_ENVIRONMENT_TIMEOUT=15 - # Tell Localstack to put Lambda containers on the same shared network - - LAMBDA_DOCKER_NETWORK=${DEVNET_NAME-devnet} - - KINESIS_ERROR_PROBABILITY=${KINESIS_ERROR_PROBABILITY-} - - DOCKER_HOST=unix:///var/run/docker.sock - - MAIN_CONTAINER_NAME=${LS_MAIN_CONTAINER_NAME-localstack} - # - HOSTNAME_EXTERNAL=${HOSTNAME_EXTERNAL-host.docker.internal} # deprecated in favor of LOCALSTACK_HOST - LOCALSTACK_HOST=${HOSTNAME_EXTERNAL-host.docker.internal} - # enable IAM checks. Only takes action if IAM_SOFT_MODE=0 - - ENFORCE_IAM=${LS_ENFORCE_IAM-1} - # only check IAM do not enforce it - - IAM_SOFT_MODE=${LS_IAM_SOFT_MODE-1} - - OPENSEARCH_ENDPOINT_STRATEGY=port - # - USE_SSL=false - # - DNS_ADDRESS=127.0.0.11 - # - HOSTNAME=localstack - # - HOSTNAME_EXTERNAL=localstack - # - DNS_RESOLVE_IP=169.254.170.3 - # - DOCKER_BRIDGE_IP=169.254.170.1 - # - LOCALSTACK_HOSTNAME=host.docker.internal - # - CLOUDFRONT_STATIC_PORTS=1 - volumes: - - "/var/run/docker.sock:/var/run/docker.sock" - - "${LOCALSTACK_VOLUME_DIR:-/tmp/ls_volume}:/var/lib/localstack" - -networks: - devnet: - name: ${DEVNET_NAME-devnet} - external: true diff --git a/dc-ls.yml b/dc-ls.yml index aafb475..f0efa9a 100644 --- a/dc-ls.yml +++ b/dc-ls.yml @@ -9,27 +9,28 @@ services: networks: devnet: environment: + - LOCALSTACK_API_KEY=${LOCALSTACK_API_KEY-} + - LOCALSTACK_AUTH_TOKEN=${LOCALSTACK_AUTH_TOKEN-} + - DOCKER_HOST=unix:///var/run/docker.sock + - MAIN_CONTAINER_NAME=${LS_MAIN_CONTAINER_NAME-localstack} - EXTRA_CORS_ALLOWED_ORIGINS=http://host.docker.internal:4566 - DISABLE_CORS_CHECKS=1 - - PROVIDER_OVERRIDE_S3=v3 # new LS native s3 - DEBUG=${DEBUG-} -# - LS_LOG=trace -# - LAMBDA_EXECUTOR=${LAMBDA_EXECUTOR-docker-reuse} # this is deprecated in V2 and will be removed + - PROVIDER_OVERRIDE_S3=v3 # new LS native s3 + # - LS_LOG=trace + # how long to keep idle lambdas around + - LAMBDA_RUNTIME_ENVIRONMENT_TIMEOUT=15 + # remove idle lambdas + - LAMBDA_REMOVE_CONTAINERS=1 + # - LS_LOG=trace # Tell Localstack to put Lambda containers on the same shared network - LAMBDA_DOCKER_NETWORK=${DEVNET_NAME-devnet} - KINESIS_ERROR_PROBABILITY=${KINESIS_ERROR_PROBABILITY-} - - DOCKER_HOST=unix:///var/run/docker.sock - - LOCALSTACK_API_KEY=${LOCALSTACK_API_KEY-} - - LOCALSTACK_AUTH_TOKEN=${LOCALSTACK_AUTH_TOKEN-} - - - MAIN_CONTAINER_NAME=${LS_MAIN_CONTAINER_NAME-localstack} - # - USE_SSL=false - # - DNS_ADDRESS=127.0.0.11 - # - HOSTNAME=localstack - # - DNS_RESOLVE_IP=169.254.170.3 - # - DOCKER_BRIDGE_IP=169.254.170.1 - # - LOCALSTACK_HOSTNAME=host.docker.internal - # - CLOUDFRONT_STATIC_PORTS=1 + # enable IAM checks. Only takes action if IAM_SOFT_MODE=0 + - ENFORCE_IAM=${LS_ENFORCE_IAM-1} + # only check IAM do not enforce it + - IAM_SOFT_MODE=${LS_IAM_SOFT_MODE-1} + - OPENSEARCH_ENDPOINT_STRATEGY=port volumes: - "/var/run/docker.sock:/var/run/docker.sock" - "${LOCALSTACK_VOLUME_DIR:-/tmp/ls_volume}:/var/lib/localstack" diff --git a/docker-compose.yml b/docker-compose.yml index 036e0d2..87b422b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -114,7 +114,7 @@ services: - PROXY_VOLUME_DIR # where to persist cert files. defaults to /tmp/mitproxy - PROXY_URL # http(s) proxy to use. if USE_PROXY_HOST is enabled will be set to http://PROXY_CONTAINER_NAME:8080 - PROXY_AUTO_EXPORT_ENV # auto export HTTP_PROXY and HTTPS_PROXY vars equal to PROXY_URL - - DEV_CONTAINER=1.9.63 # used to detect if running inside dev container + - DEV_CONTAINER=1.9.64 # used to detect if running inside dev container volumes: - /var/run/docker.sock:/var/run/docker.sock # allow container to interact with host docker - "${GDC_DIR}:/root/gdc-host" # mount gdc folder inside container to get access to compose files diff --git a/run-dev-container.sh b/run-dev-container.sh index 08a7885..0dca891 100755 --- a/run-dev-container.sh +++ b/run-dev-container.sh @@ -336,6 +336,8 @@ if [ -n "$LS_VERSION" ]; then docker pull "$LS_IMAGE" fi export USE_LOCALSTACK=yes + echo "Adding compose layer dc-ls.yml" + COMPOSE_FILES="$COMPOSE_FILES -f dc-ls.yml" if [ -n "$LOCALSTACK_STATIC_IP" ]; then COMPOSE_FILES="$COMPOSE_FILES -f dc-ls-static-ip.yml" @@ -346,9 +348,6 @@ if [ -n "$LS_VERSION" ]; then if [ -n "$LOCALSTACK_HOST_DNS_PORT" ]; then COMPOSE_FILES="$COMPOSE_FILES -f dc-ls-host-dns.yml" fi - else - echo "Adding compose layer dc-ls.yml" - COMPOSE_FILES="$COMPOSE_FILES -f dc-ls.yml" fi if [ "$USE_LOCALSTACK_PERSISTENCE" = "yes" ]; then COMPOSE_FILES="$COMPOSE_FILES -f dc-ls-persist.yml"