Is there a way to allow cloudbuild steps to access the Cloud SQL in GCP
E

1

11

I'm setting up a cloud build trigger in order to deploy a PHP/Symfony Application. When the docker file runs the php app/console assetic:dump command in order to create the assets I get the following error.

SQLSTATE[HY000] [2002] Connection timed out 
[PDOException] 

SQLSTATE[HY000] [2002] Connection timed out
[Doctrine\DBAL\Driver\PDOException] 


An exception occurred in driver: SQLSTATE[HY000] [2002] 
Connection timed out 
[Doctrine\DBAL\Exception\ConnectionException] 

I have resolved to trying to get the docker container to connect to the database instead of trying to fix the symfony application because I don't know enough about the framework or php.

Is it possible to set this up so that I can allow some kind of IP on the CLOUDSQL side to allow these connections?

Epistle answered 4/4, 2019 at 17:32 Comment(3)
I saw in another SO post, you can use an extra build step to run the cloud sql proxy and connect that way: stackoverflow.com/a/52366671 But I'm also hoping a simpler solution is possible...Capitulum
Did the solution provided by chmod_007 work for you?Belostok
@Belostok I have yet to be able to try it out yet.Epistle
B
1

A solution to setup the proxy in the same step is described in the answer here:

Run node.js database migrations on Google Cloud SQL during Google Cloud Build

Beautify answered 29/10, 2020 at 21:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.