-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[cloud-run-django]: Codelab does not work with MySQL Cloud #964
Comments
You've renamed the secret for your settings from Try changing that and see if it works. # Pull django-environ settings file, stored in Secret Manager
-SETTINGS_NAME = "application_settings"
+SETTINGS_NAME = "mysql_application_settings" |
Hi Katie! Thanks for the reply! I forgot to mention but, actually, i had set the correct secret in the
This problem could be reproduced with less modifications if I had kept the secret name. Sorry for the confusion. |
I think it might be a problem with that secret value, still, as the culprit seems to me that it's trying to connect on a local MySQL socket From your own logs
All that should need to change for a different database is:
Debugging this further, however, it looks like an issue is with django-environ not parsing sockets in the mysql form. I ended up adding custom parsing to my settings file to ensure that the socket form in mysql connection strings was supported:
Let me know if this helps! |
As you pointed, the django-environ wasn't parsing the DATABASE_URL correctly. I'll report this issue with the django-environ team. Thank you VERY MUCH Katie! |
Congratulations for this codelab. It's very well written and I managed to complete it without a hitch.
The reason I'm issuing this ticket is because I couldn't reproduce the steps with MySQL 5.7 Cloud SQL. With Postgres it worked perfectly.
What am I doing wrong?
Here are the steps to reproduce the problem:
STEP 5
Create MySQL Cloud instance
Mysql instance will be named
mysqlinstance
Create database
Create user
Create secret
Access for CLOUDRUN and CLOUDBUILD users
STEP 6
Added mysqlclient dependency
requirements.txt
STEP 7
Added
apt-get install
for dependencies needed by mysqlclient.Dockerfile
STEP 8
Changed reference to
mysqlinstance
in cloudmigrate.yamlcloudmigrate.yaml
RESULTS
Build runs successfully
gcloud builds submit --tag gcr.io/$PROJECT_ID/django-cloudrun
Migrate fails
gcloud builds submit --config cloudmigrate.yaml --substitutions _REGION=$REGION
I'm sorry for opening this ticket here, since everything is fine with the codelab itself. This was cleanest way to reproduce this problem that is happening in another project that I'm planning to move to Cloud Run.
Any help is apreciated.
Thanks in advance.
The text was updated successfully, but these errors were encountered: