From df2186fa83d1d016e2411be278241f2a8440e5da Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 14 May 2024 01:32:44 +0000 Subject: [PATCH 1/3] Update patch dependencies --- operations/environments/dev/main.tf | 2 +- operations/environments/internal/main.tf | 2 +- operations/environments/pr/main.tf | 2 +- operations/environments/prd/main.tf | 2 +- operations/environments/stg/main.tf | 2 +- shared/build.gradle | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/operations/environments/dev/main.tf b/operations/environments/dev/main.tf index 1e7c16f5b..f59dc8a3b 100644 --- a/operations/environments/dev/main.tf +++ b/operations/environments/dev/main.tf @@ -2,7 +2,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "3.103.0" + version = "3.103.1" } } diff --git a/operations/environments/internal/main.tf b/operations/environments/internal/main.tf index 361432b2c..1f3866080 100644 --- a/operations/environments/internal/main.tf +++ b/operations/environments/internal/main.tf @@ -2,7 +2,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "3.103.0" + version = "3.103.1" } } diff --git a/operations/environments/pr/main.tf b/operations/environments/pr/main.tf index ce04d492d..ab2d49765 100644 --- a/operations/environments/pr/main.tf +++ b/operations/environments/pr/main.tf @@ -2,7 +2,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "3.103.0" + version = "3.103.1" } } diff --git a/operations/environments/prd/main.tf b/operations/environments/prd/main.tf index ab1c82475..7b2a0eeae 100644 --- a/operations/environments/prd/main.tf +++ b/operations/environments/prd/main.tf @@ -2,7 +2,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "3.103.0" + version = "3.103.1" } } diff --git a/operations/environments/stg/main.tf b/operations/environments/stg/main.tf index a8d92e6ce..adc4b8368 100644 --- a/operations/environments/stg/main.tf +++ b/operations/environments/stg/main.tf @@ -2,7 +2,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "3.103.0" + version = "3.103.1" } } diff --git a/shared/build.gradle b/shared/build.gradle index 9cf588210..b38169869 100644 --- a/shared/build.gradle +++ b/shared/build.gradle @@ -44,7 +44,7 @@ dependencies { runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.12.5' // azure sdk - implementation 'com.azure:azure-security-keyvault-secrets:4.8.2' + implementation 'com.azure:azure-security-keyvault-secrets:4.8.3' implementation 'com.azure:azure-identity:1.12.1' testImplementation 'org.apache.groovy:groovy:4.0.21' From 9cbca55e9aab06dfb4c616160c43cd2abda65325 Mon Sep 17 00:00:00 2001 From: jcrichlake <145698165+jcrichlake@users.noreply.github.com> Date: Tue, 14 May 2024 12:43:39 -0400 Subject: [PATCH 2/3] Adding logging for getting a token from Azure to assist with troubleshooting (#1094) --- .../external/azure/AzureDatabaseCredentialsProvider.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/shared/src/main/java/gov/hhs/cdc/trustedintermediary/external/azure/AzureDatabaseCredentialsProvider.java b/shared/src/main/java/gov/hhs/cdc/trustedintermediary/external/azure/AzureDatabaseCredentialsProvider.java index 73d46440f..8e6ea25a7 100644 --- a/shared/src/main/java/gov/hhs/cdc/trustedintermediary/external/azure/AzureDatabaseCredentialsProvider.java +++ b/shared/src/main/java/gov/hhs/cdc/trustedintermediary/external/azure/AzureDatabaseCredentialsProvider.java @@ -2,7 +2,9 @@ import com.azure.core.credential.TokenRequestContext; import com.azure.identity.DefaultAzureCredentialBuilder; +import gov.hhs.cdc.trustedintermediary.wrappers.Logger; import gov.hhs.cdc.trustedintermediary.wrappers.database.DatabaseCredentialsProvider; +import javax.inject.Inject; /** * AzureDatabaseCredentialsProvider is a class responsible for providing credentials for a database @@ -19,8 +21,13 @@ public static AzureDatabaseCredentialsProvider getInstance() { private AzureDatabaseCredentialsProvider() {} + @Inject Logger logger; + @Override public String getPassword() { + + logger.logInfo("Fetching credentials from Azure"); + return new DefaultAzureCredentialBuilder() .build() .getTokenSync( From 82e065265aca575823ae4004a18273abb1e12f32 Mon Sep 17 00:00:00 2001 From: Sylvie Date: Wed, 15 May 2024 14:52:45 -0500 Subject: [PATCH 3/3] Use a (local) test DB for load tests so it doesn't wipe out the regular local DB (#1074) * Use a (local) test DB for load tests so it doesn't wipe out the regular DB * split out the ports and volumes between test and not * Update README.md --- README.md | 2 ++ docker-compose.postgres-test.yml | 17 +++++++++++++++++ load-execute.sh | 14 +++++++------- 3 files changed, 26 insertions(+), 7 deletions(-) create mode 100644 docker-compose.postgres-test.yml diff --git a/README.md b/README.md index 27edf4f49..fa14542bd 100644 --- a/README.md +++ b/README.md @@ -112,6 +112,8 @@ running... ``` This will run the API for you, so no need to run it manually. +**If you are already running the API, stop it before running the load tests or the cleanup steps won't work.** +The load tests will also spin up (and clean up) a local test DB on port 5434 that should not interfere with the local dev DB. The `locustfile.py` that specifies the load test is located at [`./operations/locustfile.py`](./operations/locustfile.py). diff --git a/docker-compose.postgres-test.yml b/docker-compose.postgres-test.yml new file mode 100644 index 000000000..23c3b1804 --- /dev/null +++ b/docker-compose.postgres-test.yml @@ -0,0 +1,17 @@ +version: "3.7" + +services: + postgresql-test: + image: postgres:16 + restart: unless-stopped + environment: + POSTGRES_DB: "intermediary-test" + POSTGRES_PASSWORD: "changeIT!" # pragma: allowlist secret + POSTGRES_USER: "intermediary" + ports: + - 5434:5432 + volumes: + - ti_postgres_test_data:/var/lib/postgresql/data + +volumes: + ti_postgres_test_data: diff --git a/load-execute.sh b/load-execute.sh index ca81fcd9a..812e701d5 100755 --- a/load-execute.sh +++ b/load-execute.sh @@ -4,8 +4,8 @@ set -e start_api() { echo 'Starting API' export DB_URL=localhost - export DB_PORT=5433 - export DB_NAME=intermediary + export DB_PORT=5434 + export DB_NAME=intermediary-test export DB_USER=intermediary export DB_PASS=changeIT! export DB_SSL=require @@ -16,14 +16,14 @@ start_api() { start_database() { echo 'Starting database' - docker compose -f docker-compose.postgres.yml up -d + docker compose -f docker-compose.postgres-test.yml up -d sleep 2 echo "Database started" } migrate_database() { echo 'Migrating database' - liquibase update --changelog-file ./etor/databaseMigrations/root.yml --url jdbc:postgresql://localhost:5433/intermediary --username intermediary --password 'changeIT!' --label-filter '!azure' + liquibase update --changelog-file ./etor/databaseMigrations/root.yml --url jdbc:postgresql://localhost:5434/intermediary-test --username intermediary --password 'changeIT!' --label-filter '!azure' echo "Database migrated" } @@ -54,9 +54,9 @@ cleanup() { kill "${API_PID}" echo "PID ${API_PID} killed" echo "Stopping and deleting database" - docker stop trusted-intermediary-postgresql-1 - docker rm -f trusted-intermediary-postgresql-1 - docker volume rm trusted-intermediary_ti_postgres_data + docker stop trusted-intermediary-postgresql-test-1 + docker rm -f trusted-intermediary-postgresql-test-1 + docker volume rm trusted-intermediary_ti_postgres_test_data echo "Database stopped and deleted" }