0

I have the following Dockerfile:

FROM gcr.io/google-appengine/openjdk

...

EXPOSE 8080

WORKDIR /app
ENTRYPOINT exec java $JAVA_OPTS $SERVICE_OPTS -jar Server.jar

This starts a Spring Boot project, served by a Tomcat server. In order to start, spring boot needs database access for it's JPA components:

# Spring Datasource
spring.datasource.url=jdbc:google:mysql://INSTANCE_NAME/DATABASE?user=db-user&password=*******
spring.datasource.driverClassName=com.mysql.jdbc.Driver
spring.datasource.username=db-user
spring.datasource.password=********

My app.yaml:

runtime: custom
env: flex

beta_settings:
     cloud_sql_instances: INSTANCE_NAME

I still haven't figured out how to establish the cloud sql connection. Any ideas?

KGo
  • 18,536
  • 11
  • 31
  • 47
Sebastian Ullrich
  • 1,007
  • 11
  • 21
  • I already went through all topics regarding this issue. I still haven't found a solution to my problem yet. – Sebastian Ullrich Sep 20 '17 at 13:27
  • Please follow the instructions here: https://cloud.google.com/appengine/docs/flexible/java/using-cloud-sql The key is that you need to use the mysql-socket-factory library. – Vadim Sep 20 '17 at 17:19
  • `spring.datasource.url` should just be the uri: `jdbc:mysql://:/`. If you are proxying from local machine, you can just do `jdbc:mysql://localhost:3306/yourdb`. – khan Jan 13 '18 at 01:43

0 Answers0