From bed895f858193d66ea1c025d01ebd69403ab3ba6 Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Sun, 22 Sep 2024 17:02:09 +0200 Subject: [PATCH] fix: working configuration of r2dbc connection pool --- docker-compose.yml | 4 ++-- search-service/build.gradle.kts | 1 + search-service/src/main/resources/application.properties | 2 +- subscription-service/build.gradle.kts | 1 + .../src/main/resources/application.properties | 3 ++- 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 6ea6b6631..0022856cf 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -49,7 +49,7 @@ services: image: stellio/stellio-search-service:${STELLIO_DOCKER_TAG} environment: - SPRING_PROFILES_ACTIVE=${ENVIRONMENT} - - SPRING_R2DBC_URL=r2dbc:postgresql://postgres/${STELLIO_SEARCH_DB_DATABASE} + - SPRING_R2DBC_URL=r2dbc:pool:postgresql://postgres/${STELLIO_SEARCH_DB_DATABASE} - SPRING_FLYWAY_URL=jdbc:postgresql://postgres/${STELLIO_SEARCH_DB_DATABASE} - SPRING_R2DBC_USERNAME=${POSTGRES_USER} - SPRING_R2DBC_PASSWORD=${POSTGRES_PASS} @@ -73,7 +73,7 @@ services: image: stellio/stellio-subscription-service:${STELLIO_DOCKER_TAG} environment: - SPRING_PROFILES_ACTIVE=${ENVIRONMENT} - - SPRING_R2DBC_URL=r2dbc:postgresql://postgres/${STELLIO_SUBSCRIPTION_DB_DATABASE} + - SPRING_R2DBC_URL=r2dbc:pool:postgresql://postgres/${STELLIO_SUBSCRIPTION_DB_DATABASE} - SPRING_FLYWAY_URL=jdbc:postgresql://postgres/${STELLIO_SUBSCRIPTION_DB_DATABASE} - SPRING_R2DBC_USERNAME=${POSTGRES_USER} - SPRING_R2DBC_PASSWORD=${POSTGRES_PASS} diff --git a/search-service/build.gradle.kts b/search-service/build.gradle.kts index 9151524f4..e951031ce 100644 --- a/search-service/build.gradle.kts +++ b/search-service/build.gradle.kts @@ -29,6 +29,7 @@ dependencies { runtimeOnly("org.flywaydb:flyway-database-postgresql") runtimeOnly("org.postgresql:postgresql") + runtimeOnly("io.r2dbc:r2dbc-pool") testImplementation("org.testcontainers:postgresql") testImplementation("org.testcontainers:kafka") diff --git a/search-service/src/main/resources/application.properties b/search-service/src/main/resources/application.properties index 77e33e88e..ddfee6a89 100644 --- a/search-service/src/main/resources/application.properties +++ b/search-service/src/main/resources/application.properties @@ -1,6 +1,6 @@ spring.config.import=classpath:/shared.properties -spring.r2dbc.url=r2dbc:postgresql://localhost/stellio_search +spring.r2dbc.url=r2dbc:pool:postgresql://localhost/stellio_search spring.r2dbc.username=stellio spring.r2dbc.password=stellio_password diff --git a/subscription-service/build.gradle.kts b/subscription-service/build.gradle.kts index 6ee2efde1..6a7803afc 100644 --- a/subscription-service/build.gradle.kts +++ b/subscription-service/build.gradle.kts @@ -29,6 +29,7 @@ dependencies { runtimeOnly("org.flywaydb:flyway-database-postgresql") runtimeOnly("org.postgresql:postgresql") + runtimeOnly("io.r2dbc:r2dbc-pool") testImplementation("org.wiremock:wiremock-standalone:3.3.1") testImplementation("org.testcontainers:postgresql") diff --git a/subscription-service/src/main/resources/application.properties b/subscription-service/src/main/resources/application.properties index 9f4dd82b6..322b79bcc 100644 --- a/subscription-service/src/main/resources/application.properties +++ b/subscription-service/src/main/resources/application.properties @@ -1,5 +1,6 @@ spring.config.import=classpath:/shared.properties -spring.r2dbc.url = r2dbc:postgresql://localhost/stellio_subscription + +spring.r2dbc.url = r2dbc:pool:postgresql://localhost/stellio_subscription spring.r2dbc.username = stellio spring.r2dbc.password = stellio_password # Required for Flyway to know where the DB is located