I'm trying to enable and create a Google Cloud SQL instance per: https://developers.google.com/cloud-sql/docs/before_you_begin#enroll
However, the "Cloud SQL" menu item does not appear when I open my project in Google Cloud Console as referenced in step #3.
I noticed that if I navigate to Cloud Development -> Push-to-deploy I get the error message: "Push-to-deploy is not available for this project because it is a legacy project."
How can I get Cloud SQL working with my project?
Cloud SQL Instances are not restricted to work only with AppEngine apps in the same project. You can just create a new project at https://cloud.google.com/console (which will have Cloud SQL enabled), and from that project create a new Cloud SQL Database. Just make sure you replace the default authorized AppEngine project with the old one on the Create screen.
Related
I have a Google App Engine application that operates perfectly when run locally using localhost:8080, but after I deploy to the cloud using gcloud app deploy, I receive the following error:
Warning: PDO::__construct(): MySQL server has gone away in /base/data/home/apps/s~fileabcd/20190320t221240.123456737151234567/gac_abcd.php on line 7
Warning: PDO::__construct(): Error while reading greeting packet. PID=-1 in /base/data/home/apps/s~fileabcd/20190320t221240.123456737151234567/gac_abcd.php on line 7
Any ideas why this is happening?
I discovered the reason why my Google App Engine (GAE) application functioned properly on localhost, but threw a MySQL server has gone away error after being deployed to [PROJECT-ID].appspot.com.
The reason is because my application was connecting to a Cloud SQL instance in a different project, and in order to do this you must grant the default appengine service account ([PROJECT-ID]#appspot.gserviceaccount.com) one of the following IAM roles:
Cloud SQL Client
Cloud SQL Editor
Cloud SQL Admin
After I added the App Engine default service account as a Cloud SQL Client Role in the project containing the Cloud SQL instance, everything worked perfectly.
From the Cloud SQL documentation.
I've followed the following tutorial step by step.
I've tried the following:
Installing the App Engine phpMyAdmin on the same project as my Cloud SQL server.
Installing it a different project and adding the right IAM roles (Cloud SQL Admin)
I can't for the life of me get it to connect. I get the following error:
It's unclear how you are trying to connect based on the info you have provided. To connect on App Engine, you need to use the provided unix domain socket at /cloudsql/<INSTANCE_CONNECTION_NAME> (the instance connection name can be found on your instances details page, and is in the format <project>:<region>:<instance>).
For more details on connecting from App Engine, check out the Connecting from App Engine page.
I am building a backend for an application with Google App Engine and Cloud SQL.
I do have:
A webserver as a proxy in front of my API server which handles sessions (using Cloud SQL and memcache) and calls the API
An API server which has access to the resource in the Cloud SQL instance
oAuth server which also needs Cloud SQL and memcache for tokens etc.
So my questions: Do I need three Cloud SQL project, which all have their own replica? Or is it ok to have one Cloud SQL project and all three App Engine projects access this Cloud SQL instance through the Cloud SQL proxy?
All projects will be located in the us-central region.
Would love to hear some thoughts.
Thanks!
I’m adding this information as a formal answer for the community. All credit goes to Dan Cornilescu.
You do not need to create 3 different projects. You can have 3 Google App Engine services running and a single Cloud SQL instance in the same project. That seems to be the best option for your situation. Using multiple services within a single project has its advantages one of them being increased performance.
Note that you could also have multiple Cloud SQL instances running in the same project. You can follow this document that talks more about creating a Cloud SQL instance:
Creating Instances
In case you need more information about Google App Engine services, this is a good resource:
Microservices Architecture on Google App Engine
we're using Google App Engine and Cloud SQL for a django web app. We want to run migrations during the build; however, GAE uses Container Registry to build the app, and Container Registry not authenticated to access Cloud SQL. So, as expected, the migrations fail to due to a rejected connection.
How does someone authorize Container Registry to access Cloud SQL?
When you say:
GAE uses Container Registry to build the app, and Container Registry not authenticated to access Cloud SQL.
I assume that you mean:
GAE uses Container Builder to build the app, and the Container Builder Service Account is not authenticated to access Cloud SQL.
Assuming that's what you need, this document explains how to use IAM to grant additional permissions to the Service Account: https://cloud.google.com/container-builder/docs/how-to/service-account-permissions
If you are in fact asking a different question, please clarify, including an example that demonstrates the problem you are having.
Our app engine project uses google cloud sql database. Historically cloud SQL was a separate project, and app engine application had permissions to work with it.
Now Google uses a new google cloud console. We see 2 different projects with different project ids.
How can we merge the cloud SQL and app engine projects?
The DB size is about 25Gb and it is used every second so we can't move it to app engine project.
And we can't add app engine project source to Cloud SQL project, there is no App Engine link in new console.
Thanks