Skip to content

Troubles with the tutorial: Using Cloud SQL for MySQL (App Engine Flexible Environment) #664

Closed

Description

@omidkrad

Hi, I followed steps in Using Cloud SQL for MySQL (App Engine Flexible Environment)

Everything worked and deployed successfully (8 min 21 sec for deploying?!!) until gcloud app browse that goes to the URL with "Internal Server Error" message.

And the log shows Error: connect ECONNREFUSED 127.0.0.1:3306

Question 1: Why does deploy of a simple app take so long to complete even on subsequent runs?

When testing locally using Cloud SQL Proxy we know that 127.0.0.1 is proxied to the Cloud SQL database that we specify in the command line like this:

./cloud_sql_proxy -instances=$INSTANCE_CONNECTION_NAME=tcp:3306 -credential_file=$GCLOUD_CERTIFICATE_FILE

but the tutorial does not explain how possibly after deployment it is supposed to connect to the database instance, since we don't have the proxy configuration on the server. And so it fails with the above error as one may expect.

Question 2: How is the app supposed to connect to the sql instance when deployed?

App.flexible.yaml file says "Do not add this file to your source control." Is that really the recommended way to handle app.yaml files? It does not make sense that the application configuration file should be maintained outside of the repository.

Question 3: What is the correct way to manage app.yaml and sensitive data in it?

Thanks!

Activity

  1. omidkrad commented on Jun 15, 2018

    @omidkrad
    Author

    I found the answer to my Question 2, the instance name is set in App.flexible.yaml env_variables.INSTANCE_CONNECTION_NAME. The confusing part in the doc is where it says "If you configured the proxy to use Unix sockets, set this additional environment variable" which implies that it may not be needed if using TCP Sockets. I think the documentation should mention that it is needed for deployment.

  2. fhinkel commented on Nov 10, 2018

    @fhinkel
    Contributor

    I'd recommend using the App Engine Standard Environment: https://cloud.google.com/appengine/docs/standard/nodejs/using-cloud-sql

    Deployment only takes a few seconds instead of 10 minutes.

  3. akedevs commented on Sep 16, 2019

    @akedevs

    Too hard inplement this solution , 1 month try to connect local and when deploy still
    error , I don't know why doucment on github never work .

  4. added a commit that references this issue on Feb 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions