From 980f7f4bdf651010e2963b6d4a8c462e041a043b Mon Sep 17 00:00:00 2001 From: GeorgeC Date: Thu, 22 Aug 2024 09:58:17 -0400 Subject: [PATCH 1/2] Refactor Dockerfile and update dependencies Set default Spring profile in Dockerfile. Add AWS Secrets Manager JDBC dependency in pom.xml and create application-bdc.properties for database configuration. --- Dockerfile | 3 ++- pom.xml | 5 +++++ src/main/resources/application-bdc.properties | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 src/main/resources/application-bdc.properties diff --git a/Dockerfile b/Dockerfile index b707710..1a441e0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,4 +16,5 @@ COPY --from=build target/dictionary-*.jar /dictionary.jar # Time zone ENV TZ="US/Eastern" -ENTRYPOINT java $DEBUG_VARS $PROXY_VARS -Xmx8192m -jar /dictionary.jar +# Default to no profile +ENTRYPOINT java $DEBUG_VARS $PROXY_VARS -Xmx8192m -jar /dictionary.jar --spring.profiles.active=${SPRING_PROFILE:-} diff --git a/pom.xml b/pom.xml index 92114a3..5580bba 100644 --- a/pom.xml +++ b/pom.xml @@ -61,6 +61,11 @@ postgresql test + + com.amazonaws.secretsmanager + aws-secretsmanager-jdbc + 2.0.2 + diff --git a/src/main/resources/application-bdc.properties b/src/main/resources/application-bdc.properties new file mode 100644 index 0000000..2c9602f --- /dev/null +++ b/src/main/resources/application-bdc.properties @@ -0,0 +1,6 @@ +spring.application.name=dictionary +spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect +spring.datasource.driver-class-name=com.amazonaws.secretsmanager.sql.AWSSecretsManagerPostgreSQLDriver +spring.datasource.url=jdbc-secretsmanager:mysql://${DATASOURCE_URL}/auth?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&autoReconnectForPools=true +spring.datasource.username=${DATASOURCE_USERNAME} +server.port=80 \ No newline at end of file From db7e2de26dd51c84d21c0cff69011f948f01e595 Mon Sep 17 00:00:00 2001 From: GeorgeC Date: Thu, 22 Aug 2024 10:11:40 -0400 Subject: [PATCH 2/2] Update datasource URL to use PostgreSQL --- src/main/resources/application-bdc.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/application-bdc.properties b/src/main/resources/application-bdc.properties index 2c9602f..352e321 100644 --- a/src/main/resources/application-bdc.properties +++ b/src/main/resources/application-bdc.properties @@ -1,6 +1,6 @@ spring.application.name=dictionary spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect spring.datasource.driver-class-name=com.amazonaws.secretsmanager.sql.AWSSecretsManagerPostgreSQLDriver -spring.datasource.url=jdbc-secretsmanager:mysql://${DATASOURCE_URL}/auth?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&autoReconnectForPools=true +spring.datasource.url=jdbc-secretsmanager:postgres://${DATASOURCE_URL}/auth?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&autoReconnectForPools=true spring.datasource.username=${DATASOURCE_USERNAME} server.port=80 \ No newline at end of file