I deploy a native quarkus application under cloud run. This application need to connect to a cloud sql postgresql database. On the configuration panel's cloud run, i create a Cloud SQL connections (db-instance-name eq. cloud sql) and some variable as DB_USER, DB_PASSWORD, DB_NAME On Quarkus, i define properties as below :
quarkus.datasource.jdbc.url=jdbc:postgresql:///${DBNAME}:5432
quarkus.datasource.driver=org.postgresql.Driver
quarkus.datasource.username=${DB_USER}
quarkus.datasource.password=${DB_PASSWORD}
My pom.xml
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-orm-panache</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jdbc-postgresql</artifactId>
</dependency>
<dependency>
<groupId>com.google.cloud.sql</groupId>
<artifactId>postgres-socket-factory</artifactId>
<version>1.0.16</version>
</dependency>
When cloud run is starting, an exception occured :
WARN [io.agr.pool] (Agroal_18109070341) Datasource '<default>': Connection to :5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections
I have to say that cloud run is deployed by cloud build.
Could you help me to fix this issue... Thanks