I'm trying to connect to Google Cloud SQL for MySql through Google Cloud Run. I've been through many posts at SO and also the Google documentation. But doesn't seem to get it working for myself. I admit that I have never containerized any application and I am predominantly a data person.
Note: I already have Cloud SQL instance created which I can connect through Cloud shell.
1) My code is based on Google documentation at
https://cloud.google.com/sql/docs/mysql/connect-run
and the github code at
2) Build the image
gcloud builds submit --tag gcr.io/my-project/my-test-image
3) Deploy the image
gcloud run deploy --image gcr.io/my-project/my-test-image
4) When I try to invoke the service in Cloud Shell using the following, I get output as "Service Unavailable"
curl -H "Authorization: Bearer $(gcloud auth print-identity-token)" https://my-service.run.app
Can anyone please help me to resolve this?
Changes - I had not provided the mysql instance name. I corrected it and now I'm getting error as below -
[INFO] Listening at: http://0.0.0.0:8080 (1)"
"Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/pymysql/connections.py", line 571, in connect sock.connect(self.unix_socket) FileNotFoundError: [Errno 2] No such file or directory"
I don't understand why it's listening at 0.0.0.0:8080. I removed the host and port from my code and I still get this "info" and the error I get is that "FileNotFoundError". I'm not sure which file it needs. Does it need some kind of connections file? If yes what's the format of the file?