Closed GabrielBB closed 3 years ago
How are you enabling the prod
profile?
How are you enabling the
prod
profile?
Using SPRING_PROFILES_ACTIVE
env var
gcloud run deploy "$SERVICE_NAME" \
--image="gcr.io/$PROJECT_ID/$SERVICE_NAME:$GITHUB_SHA" \
--update-env-vars SPRING_PROFILES_ACTIVE=prod
Can you run with debug=true
and provide the auto-configuration report?
Note that the default profile would still be active, and you're relying on GcpCloudSqlAutoConfiguration
to ignore spring.datasource.url
, which it should, but I'm not sure how this interacts with Liquidbase.
@meltsufin I ended up just adding this manually in application-prod.properties
: jdbc:mysql://google/xxxx?socketFactory=com.google.cloud.sql.mysql.SocketFactory&cloudSqlInstance=xxxx:europe-west3:xxxx
. However I can no longer help figuring out this problem because I also ended up migrating to AWS. I hope you can figure it out, if you don't close this issue now
@meltsufin Thanks for the update.
I've been able to reproduce this issue by simply adding the spring.datasource.url
to our MySQL sample: https://github.com/spring-cloud/spring-cloud-gcp/blob/master/spring-cloud-gcp-samples/spring-cloud-gcp-sql-mysql-sample/src/main/resources/application.properties
For some reason our DataSourceProperties
bean overriding using @Primary
is not working anymore in GcpCloudSqlAutoConfiguration
.
Fixed in #2558
It connects to the Google cloud database but then liquibase tries to boot up and it picks the h2 database. I need h2 only for local and integration tests.
application.properties
application-prod.properties
build.gradle.kts