diff --git a/.env-gdc b/.env-gdc index 01371c9..1fdd192 100644 --- a/.env-gdc +++ b/.env-gdc @@ -78,6 +78,7 @@ if [ -z ${LOCALSTACK_HOST_DNS_PORT+x} ]; then fi export USE_LOCALSTACK_SHARED=${USE_LOCALSTACK_SHARED:=no} # mount shared volume in LS container under /shared export LOCALSTACK_HOST_DNS_PORT +export LOCALSTACK_GATEWAY_LISTEN export USE_LOCALSTACK_DNS=${USE_LOCALSTACK_DNS:=no} # set to yes to assign static ip to LS container and use it as primary DNS export USE_AUTH0 # starts up auth0 mock container in container only mode @@ -96,15 +97,15 @@ if [ -z ${SSH_KEYSCAN_HOSTS+x} ]; then export SSH_KEYSCAN_HOSTS="gitlab.com github.com bitbucket.org" # copy ssh keys from these hosts to prevent unknown key prompts fi - -if [ -z "$GDC_DNS_PRI_IP" ]; then - export GDC_DNS_PRI_IP=8.8.8.8 -fi - +# default secondary dns to google secondary dns if not specified if [ -z "$GDC_DNS_SEC_IP" ]; then - export GDC_DNS_SEC_IP=8.8.4.4 + GDC_DNS_SEC_IP=8.8.4.4 fi +# these will only be used by the container if GDC_DNS_PRI_IP is defined +export GDC_DNS_PRI_IP +export GDC_DNS_SEC_IP + export DEVNET_GATEWAY export USE_COLOR_PROMPT=${USE_COLOR_PROMPT:=yes} # enable colored bash prompt diff --git a/dc-dns.yml b/dc-dns.yml new file mode 100644 index 0000000..13a444f --- /dev/null +++ b/dc-dns.yml @@ -0,0 +1,7 @@ +version: "3.8" + +services: + dev: + dns: + - ${GDC_DNS_PRI_IP} + - ${GDC_DNS_SEC_IP} \ No newline at end of file diff --git a/dc-ls-host.yml b/dc-ls-host.yml index 224973d..c1b004b 100644 --- a/dc-ls-host.yml +++ b/dc-ls-host.yml @@ -9,4 +9,5 @@ services: - "443:443" # LocalStack HTTPS Gateway (required for Pro) - "4571:4571" # elasticsearch service environment: - - LOCALSTACK_HOST=${HOSTNAME_EXTERNAL-host.docker.internal} +# - LOCALSTACK_HOST=${LOCALSTACK_HOST-host.docker.internal:4566} # dont use this with LS 3.x + - GATEWAY_LISTEN=${LOCALSTACK_GATEWAY_LISTEN-0.0.0.0:4566,0.0.0.0:443} diff --git a/dc-ls.yml b/dc-ls.yml index f0efa9a..c7cf7a9 100644 --- a/dc-ls.yml +++ b/dc-ls.yml @@ -16,13 +16,11 @@ services: - EXTRA_CORS_ALLOWED_ORIGINS=http://host.docker.internal:4566 - DISABLE_CORS_CHECKS=1 - DEBUG=${DEBUG-} - - 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-} diff --git a/docker-compose.yml b/docker-compose.yml index 74d959b..0d5dc9e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,9 +7,6 @@ services: tty: true networks: devnet: - dns: - - ${GDC_DNS_PRI_IP} - - ${GDC_DNS_SEC_IP} extra_hosts: - "host.docker.internal:host-gateway" build: @@ -77,8 +74,8 @@ services: - AWS_IDENTITY_ACCOUNT # used by AWS assume-role.sh script - GIT_EMAIL # required for GIT if you don't have a .gitconfig in your home directory - GIT_NAME # required for GIT if you don't have a .gitconfig in your home directory - - HOSTNAME_EXTERNAL # used by localstack - LOCALSTACK_HOST # used by localstack + - LOCALSTACK_GATEWAY_LISTEN # used by localstack - YARN_CACHE_FOLDER=/usr/local/share/.cache/yarn # cache yarn installs - PIP_CACHE_DIR=/usr/local/share/.cache/pip # cache pip installs - npm_config_cache=/usr/local/share/.cache/npm # case npm installs @@ -114,7 +111,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.66 # used to detect if running inside dev container + - DEV_CONTAINER=1.9.7 # 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/etc/skel/.bashrc b/etc/skel/.bashrc index 23dad1d..1a3b284 100644 --- a/etc/skel/.bashrc +++ b/etc/skel/.bashrc @@ -203,6 +203,9 @@ if [ "$USE_LOCALSTACK" = "yes" ]; then if [ -n "$LOCALSTACK_STATIC_IP" ]; then echo "Localstack static ip: $LOCALSTACK_STATIC_IP" fi +fi + +if [ -n "$GDC_DNS_PRI_IP" ]; then echo "GDC PRI DNS IP $GDC_DNS_PRI_IP" echo "GDC SEC DNS IP $GDC_DNS_SEC_IP" fi diff --git a/readme.md b/readme.md index ec5e5e8..4988888 100644 --- a/readme.md +++ b/readme.md @@ -126,8 +126,8 @@ These options control what packages / functionality are built into the container `USE_` vars are **yes / no** values for toggling related options. * GDC_NAME= - PROJECT_NAME will be set to this if no command line argument is specified for name. -* GDC_DNS_PRI_IP=8.8.8.8 - sets primary dns for GDC container. USE_LOCALSTACK_DNS=yes will override this. -* GDC_DNS_SEC_IP=8.8.4.4 - sets primary dns for GDC container. USE_LOCALSTACK_DNS=yes will override this. +* GDC_DNS_PRI_IP= - sets primary dns for GDC container. USE_LOCALSTACK_DNS=yes will override this. +* GDC_DNS_SEC_IP=8.8.4.4 - sets secondary dns for GDC container. This value is only used if GDC_DNS_PRI_IP is set. * PROJECT_NAME= - used to suffix DEVNET_NAME, LOCALSTACK_VOLUME_DIR, DEV_CONTAINER_NAME. * DEV_CONTAINER_NAME=dev-1 - sets the dev container name and is prepended with PROJECT_NAME. * COMPOSE_BIN="docker compose" - sets method of execution for compose. Should be set to ether "docker compose" or "docker-compose" diff --git a/run-dev-container.sh b/run-dev-container.sh index 3246ce8..39f8f52 100755 --- a/run-dev-container.sh +++ b/run-dev-container.sh @@ -114,6 +114,7 @@ fi export DEVNET_SUBNET export LOCALSTACK_STATIC_IP + CACHE_VOLUMES_REQUIRED="pulumi pkg_cache" SHARED_VOLUMES_REQUIRED="shared home_config" @@ -193,6 +194,12 @@ fi COMPOSE_FILES="-f docker-compose.yml" +if [ -n "$GDC_DNS_PRI_IP" ]; then + echo "Adding compose layer dc-dns.yml" + COMPOSE_FILES="$COMPOSE_FILES -f dc-dns.yml" +fi + + if [ ! -d "./tmp" ]; then mkdir ./tmp fi @@ -203,12 +210,11 @@ COMPOSE_PROJECT_NAME="${COMPOSE_PROJECT_NAME//[ -]/_}" export LS_MAIN_CONTAINER_NAME=${LS_MAIN_CONTAINER_NAME:="localstack_$COMPOSE_PROJECT_NAME"} # used by localstack to name main container if [ "$USE_LOCALSTACK_HOST" = "yes" ]; then - export HOSTNAME_EXTERNAL=${HOSTNAME_EXTERNAL:=host.docker.internal} + export LOCALSTACK_HOST=${LOCALSTACK_HOST:=host.docker.internal:4566} else - export HOSTNAME_EXTERNAL=${HOSTNAME_EXTERNAL:=$LS_MAIN_CONTAINER_NAME} + export LOCALSTACK_HOST=${LOCALSTACK_HOST:=$LS_MAIN_CONTAINER_NAME:4566} fi -export LOCALSTACK_HOSTNAME="$HOSTNAME_EXTERNAL" - +export LOCALSTACK_HOSTNAME=$(echo "$LOCALSTACK_HOST" | cut -d: -f1) export DEVNET_NAME=${DEVNET_NAME:="devnet_$COMPOSE_PROJECT_NAME"} if [ -z "$DEVNET_NAME" ]; then