From 08587fe1beb79b0aa3b539a697bc52eca1bd79d1 Mon Sep 17 00:00:00 2001 From: Ryan Emerle Date: Mon, 31 Jan 2022 13:40:45 -0500 Subject: [PATCH] Fix issues pertaining to running env - Add `debug` flag to `sbt.sh` - Remove need for `LOCALSTACK_EXT_HOSTNAME` (provided by update to backing Docker images) --- .gitignore | 1 + build/sbt.sh | 32 ++++++++++++++++++- .../sns/SnsNotifierIntegrationSpec.scala | 5 +-- quickstart/.env | 1 + quickstart/docker-compose.yml | 3 +- quickstart/quickstart-vinyldns.sh | 1 - 6 files changed, 37 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 40aaed248..29b6ff886 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,4 @@ quickstart/data **/.venv* **/*cache* **/artifacts/ +**/.env.overrides diff --git a/build/sbt.sh b/build/sbt.sh index e02750d64..3e5030348 100755 --- a/build/sbt.sh +++ b/build/sbt.sh @@ -3,5 +3,35 @@ set -euo pipefail DIR=$(cd -P -- "$(dirname -- "$0")" && pwd -P) +usage() { + echo "USAGE: sbt.sh [options]" + echo -e "\t-d, --debug enable debugging" + echo -e "\t-p, --debug-port the debug port (default: 5021)" +} + +DEBUG_SETTINGS="" +DEBUG_PORT=5021 +while [[ $# -gt 0 ]]; do + case "$1" in + --debug | -d) + DEBUG_SETTINGS="-e SBT_OPTS=\"-agentlib:jdwp=transport=dt_socket,server=y,suspend=n" + shift + ;; + --debug-port | -p) + DEBUG_PORT=$2 + shift + shift + ;; + *) + usage + exit 1 + ;; + esac +done + +if [ "${DEBUG_SETTINGS}" != "" ]; then + DEBUG_SETTINGS="${DEBUG_SETTINGS},address=${DEBUG_PORT}\" -p \"${DEBUG_PORT}:${DEBUG_PORT}\"" +fi + cd "$DIR/../test/api/integration" -make build DOCKER_PARAMS="--build-arg SKIP_API_BUILD=true" && make run-local WITH_ARGS="sbt" DOCKER_PARAMS="-e RUN_SERVICES=none --env-file \"$DIR/../test/api/integration/.env.integration\"" +make build DOCKER_PARAMS="--build-arg SKIP_API_BUILD=true" && make run-local WITH_ARGS="sbt" DOCKER_PARAMS="-p \"5020-5030:5020-5030\" ${DEBUG_SETTINGS} -e RUN_SERVICES=none --env-file \"$DIR/../test/api/integration/.env.integration\"" diff --git a/modules/api/src/it/scala/vinyldns/api/notifier/sns/SnsNotifierIntegrationSpec.scala b/modules/api/src/it/scala/vinyldns/api/notifier/sns/SnsNotifierIntegrationSpec.scala index c3952b870..206996c43 100644 --- a/modules/api/src/it/scala/vinyldns/api/notifier/sns/SnsNotifierIntegrationSpec.scala +++ b/modules/api/src/it/scala/vinyldns/api/notifier/sns/SnsNotifierIntegrationSpec.scala @@ -85,16 +85,17 @@ class SnsNotifierIntegrationSpec val sns = AmazonSNSClientBuilder.standard .withEndpointConfiguration( new EndpointConfiguration( - snsConfig.getString("service-endpoint"), + sys.env.getOrElse("SNS_SERVICE_ENDPOINT", snsConfig.getString("service-endpoint")), snsConfig.getString("signing-region") ) ) .withCredentials(credentialsProvider) .build() + val sqs = AmazonSQSClientBuilder .standard() .withEndpointConfiguration( - new EndpointConfiguration(sys.env.getOrElse("SNS_SERVICE_ENDPOINT", "http://127.0.0.1:19003"), "us-east-1") + new EndpointConfiguration(sys.env.getOrElse("SQS_SERVICE_ENDPOINT", "http://127.0.0.1:19003"), "us-east-1") ) .withCredentials(credentialsProvider) .build() diff --git a/quickstart/.env b/quickstart/.env index fb0b428e2..aae1e5af8 100644 --- a/quickstart/.env +++ b/quickstart/.env @@ -6,6 +6,7 @@ VINYLDNS_PORTAL_URL=http://localhost:9001 PORTAL_PORT=9001 PLAY_HTTP_SECRET_KEY=change-this-for-prod VINYLDNS_BACKEND_URL=http://vinyldns-api:9000 +# VINYLDNS_BACKEND_URL=http://host.docker.internal:9000 # You can use this when the API is running locally, but the portal is in a container LDAP_PROVIDER_URL=ldap://vinyldns-ldap:19004 TEST_LOGIN=false diff --git a/quickstart/docker-compose.yml b/quickstart/docker-compose.yml index 8b0b9acbe..35d08e6d0 100644 --- a/quickstart/docker-compose.yml +++ b/quickstart/docker-compose.yml @@ -21,7 +21,6 @@ services: VINYLDNS_BASE_VERSION: "${VINYLDNS_BASE_VERSION}" environment: RUN_SERVICES: "deps-only tail-logs" - LOCALSTACK_EXT_HOSTNAME: "${LOCALSTACK_EXT_HOSTNAME:-vinyldns-integration}" env_file: .env ports: @@ -42,7 +41,7 @@ services: volumes: - ../build/docker/api/application.conf:/opt/vinyldns/conf/application.conf env_file: - .env + - .env ports: - "9000:9000" depends_on: diff --git a/quickstart/quickstart-vinyldns.sh b/quickstart/quickstart-vinyldns.sh index 3dc5318cf..6fdea5c36 100755 --- a/quickstart/quickstart-vinyldns.sh +++ b/quickstart/quickstart-vinyldns.sh @@ -101,7 +101,6 @@ while [[ $# -gt 0 ]]; do shift ;; -d | --deps-only) - export LOCALSTACK_EXT_HOSTNAME="localhost" SERVICE="integration ldap" shift ;;