3

If I understand the "Cloud SQL Connections" tab in Cloud Run should instantiate the Cloud SQL Proxy.

What is the sql server connectionstring that I should use to make this work?

Setup : (All in the the same GCP Project): 1. Create a Cloud Sql instance of SQL Server 2. Upload your docker image to Google Container registry. Written using .netcore with code to connect to the SQL Server created in step 1 2. Create a Service instance in Google Cloud Run. 3. Specify Cloud SQL Connections and select your sql server instance from the list and deploy.

Ralph
  • 309
  • 1
  • 8
  • Hi @Daemon, why do u feel it’s broad. Have you played around with Google Clound Run environment, cloud sql proxy and cloud sql server? I’ve put down background, what Did not work and what I already know and is working correctly. – Ralph Mar 20 '20 at 16:36
  • Hello Ralph, are you following a guide? If you can provide the steps to reproduce it, maybe we can help you. I have a couple of experience with Cloud SQL and C# :) – Mario Mar 20 '20 at 23:56
  • Hello Mario, here goes. https://cloud.google.com/sql/docs/mysql/connect-run My database is cloud sql server. I know that the cloud sql proxy works as I can get SSMS to connect. Cloud proxy link: https://cloud.google.com/sql/docs/sqlserver/sql-proxy – Ralph Mar 21 '20 at 01:47
  • 1) Connecting to Cloud SQL Proxy running on your development system does not mean that you have configured the proxy in Cloud Run correctly. 2) The instance name is listed on the Cloud SQL page for your instance. 3) Cloud Run does not support accessing Cloud SQL via the proxy using IP addressing. You must use Unix sockets. 4) Edit your question and show your source code, Dockerfile and deploy command line. Do link to outside links, everything should be in your question. 5) We do not need to read a guide, we need your files and build commands to help you. This is a Stack Overflow requirement. – John Hanley Mar 23 '20 at 06:12
  • https://stackoverflow.com/help/minimal-reproducible-example – John Hanley Mar 23 '20 at 06:13

1 Answers1

0

I do not think it is supported yet. There is no documentation for Cloud SQL Server.

According to the official documentation :

Once correctly configured, you can connect your service to your Cloud SQL instance's unix domain socket using the format: /cloudsql/INSTANCE_CONNECTION_NAME.

Note: Cloud Run (fully managed) does not support connecting to the Cloud SQL instance using TCP. Your code should not try to access the instance using an IP address such as 127.0.0.1 or 172.17.0.1.

Also:

Note: The Cloud SQL Proxy does not support Unix sockets on Windows.

I tried to do it using Cloud SQL Proxy with tcp and got:

 System.Net.Internals.SocketExceptionFactory+ExtendedSocketException (111): Connection refused 127.0.0.1:1433
marian.vladoi
  • 7,663
  • 1
  • 15
  • 29