Database connection from Google App Engine - google-app-engine

I'm developping an application on Google App Engine and Google CloudSQL, but I met a curious behaviour today.
I have two CloudSQL instances, one is for developpment use and another is for commercial use.
I set my persistence.xml and "App Engine Settings -> Google Cloud SQL" developpment instance, and set "App Engine Settings -> Deployment -> version" developpment version name, and deployed my application.
Then I changed those settings to the commercial instance and set version commercial version name, and deployed my application.
But curiously the commercial version is connected to developpment database instance.
Can anyone guess the reason?

Related

Google App Engine authorization to Google Cloud SQL Instance (Second Generation)

When trying to connect my Google App Engine to my Google Cloud SQL Instance (Second Generation), I cannot find the "...Authorized App Engine applications section..." (https://cloud.google.com/appengine/docs/php/cloud-sql/#PHP_Build_a_starter_application_and_database).
Am I just blind, or does this not exist anymore?
If it doesn't exist, how does one connect a Google App Engine to a Google Cloud SQL (Second Generation)?
Please review the limitations of Google Cloud SQL Second Generation.
Because Cloud SQL Second Generation instances are in beta, the following features are not available:
Service Level Agreement (SLA)
MySQL 5.5
MySQL 5.6 is supported.
Google App Engine connectivity. Connectivity is supported for other clients, including Compute Engine, Managed VMs, Container Engine, and your workstation.
....
I'd like to mention that although Google App Engine connectivity is not yet supported for the Cloud SQL Second Generation like the way is supported for Cloud SQL 1st Gen, however this doesn't mean that you cannot use Cloud SQL 2nd Gen with your App Engine applications.
You can use access control model which is described in this article as used for other applications. Since IP address of your App Engine application will be not a static address, you will need to authorize 0.0.0.0/0 IP range as an allowed network and use Allow only SSL connections feature of the Cloud SQL to allow only SSL connections. Configure SSL and generate keys and client certificate for your application and establish a secure connections using SSL.
Right now, App Engine cannot be used with CloudSQL Gen2. It should be possible once the CloudSQL Gen2 graduate to General Availability but right now, if you need to use it with App Engine, you'll need to stick with CloudSQL v1

Appengine to MySQL Database hosted in Compute Engine

Somebody knows if is it possible connect an application from Appengine to a mysql database hosted in compute engine?
I'm trying to do this with python and i have this error:
Can't create TCP/IP socket (-1)
I'm using SqlAlchemy ORM which use the next configuration:
create_engine('mysql+mysqldb://root#ip/database')
and locally works but when i deploy the application to appengine doesn't work.
Thanks
Google App Engine, by default, runs code in a sandboxed environment, meaning that certain aspects of the Python runtime environment are restricted, or respond differently than they would otherwise. One of these aspects is outbound network connectivity—while GAE supports sockets, there are certain restrictions, and sockets are only available for paid apps.
The recommended options for storing information in a GAE app include the App Engine Datastore, Google Cloud SQL, and Google Cloud Storage. Google Cloud SQL is MySQL, and works with SQLAlchemy, so that's probably your best option.
If you absolutely need to run your own MySQL server (rather than using Google Cloud SQL) and connect to it from a GAE app, the other option is to use the managed VM environment, which permits unrestricted network access (since it's essentially a Google Compute Engine VM with the App Engine runtime on top).

How to tell whether it is a "development server"?

Some of the Google App Engine documentation make reference to the term "development server". What is a development server? Besides development server, what are the other types of servers?
Is abc-def-123.appspot.com on a development server? If it is, how do I deploy to a non-developmental server? Is it just by Enable Billing in the Developers Console ?
The development server runs locally and allows you to run your AppEngine application entirely on your local machine during development. Other "servers" are the AppEngine production servers where you deploy your application when it's ready.
You use the gcloud tool for such tasks.
When the app runs on a development the application id gets a dev~ prefix.

How to merge google cloud sql and google app engine projects?

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

Enable Cloud SQL for GAE Legacy Project?

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.

Resources