0

I've developer version of my symfony 4 application on google app engine (flexible). My code is on github than I make cloud build where I run my tests and build/deploy my application to app engine. Because it's a developer version it will be nice to make automatic database migrations. I've searched but I can't find any solutions/docs how achieve such automation.

I try to make additional build step with bin/console doctrine:migrations:migrate in my build process but it can't access database through unix_socket=/cloudsql/ (method recommended in app engine). I don't want connect through public ip but I wonder if it's even possible to connect by unix socket?

I also wonder if migration step should be run after or before app deploy?

Or maybe there is no need to run this step individually and I can run migrations after deploy on my app engine instances?

kuba_ceg
  • 930
  • 9
  • 16

1 Answers1

0

There is a tool for data migrations for Cloud SQL. You can find here a official guide on how to use it.

Yes it is possible to connect to the Cloud SQL using the unix_socket and you have 2 options : connecting with public IP and connecting with private IP. Here there is an official guide on how to connect to you Cloud SQL instance using the unix_socket. I understood that you are trying to connect using the private IP. Did you whitelisted the IP in the Cloud SQL instance configuration? Could you, please provide me more information about the error you are receiving or how you try to make the connection? I will edit my answer with more details as soon as you provide me those extra info( if needed).

Another good option to connect to the Cloud SQL, as you do not want to use the public IP, would be to use the Cloud SQL Proxy.

Regarding you last questions, your migration steps should be run before the app deploy, otherwise you will probably face some errors from the app.

Andrei Tigau
  • 2,010
  • 1
  • 6
  • 17