Skip to content

Commit

Permalink
cleanup and simplify localstack compose layers
Browse files Browse the repository at this point in the history
  • Loading branch information
paulrobello committed Nov 7, 2023
1 parent 322e61c commit 10ce981
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 66 deletions.
47 changes: 0 additions & 47 deletions dc-ls-host.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,58 +2,11 @@ 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
- "8001:8080" # only required for Pro
- "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
31 changes: 16 additions & 15 deletions dc-ls.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions run-dev-container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down

0 comments on commit 10ce981

Please sign in to comment.