[cloud_sql_proxy] Running permanently on a Windows production server

已查看 447 次
跳至第一个未读帖子

Gavin Bainbridge

未读,
2017年6月1日 09:15:412017/6/1
收件人 Google Cloud SQL discuss
We have an established app running on a Windows production server and are migrating the database to Google Cloud SQL.

I have tested cloud_sql_proxy manually and it works great, but it has to be running from a command prompt according to Google's docs. This is not ideal in production as the command prompt is quit when the terminal services session terminates.

What is the accepted method of running cloud_sql_proxy on a headless Windows production server without any manual intervention? 

George (Cloud Platform Support)

未读,
2017年6月1日 14:31:452017/6/1
收件人 Google Cloud SQL discuss
Hello Gavin, 

The command prompt is needed to set up and configure the proxy. You can subsequently connect using this proxy's services without CLI, all directly from your apps on your headless server, as described in the "Connecting to Cloud SQL from External Applications" information page

An excellent reply by Alex Martelli to a stackoverflow question seems to provide an overall view and details on what you attempt to do: "Connect to google cloud sql from local development server". 

You are most welcome to come back with more specific questions. 

Gavin Bainbridge

未读,
2017年6月1日 19:35:082017/6/1
收件人 Google Cloud SQL discuss
Hi George

Sorry, that doesn't help at all. I've already read the Google doc you reference and have followed all the instructions, so I know how to use cloud_sql_proxy in a development environment or even manually on a production server. The problem I have is running it on a production Windows web server VM that won't have a logged in user most of the time. I can log in and run the proxy manually in a cli, but it stops as soon as the terminal services session is closed.

It's probably a really dumb question and shows my lack of knowledge with Windows servers, but I just don't know how to have the proxy running outside of a logged in desktop session. The Google doc says it can be used on a production server, but doesn't explain how to run the proxy as a service at boot time. If the proxy is run as a orphan process from the cli and then crashes, what then? I want to set this up and just have it work, even if the server is restarted.

What is the recommended way to do this? I need specifics, not general overview. I'm about to try setting up a task with task scheduler and see if that works.

George (Cloud Platform Support)

未读,
2017年6月2日 17:01:272017/6/2
收件人 Google Cloud SQL discuss
Hi Gavin, 

As you already mentioned, your problem is related to windows servers and how to start a resident application with the server. This looks less like a Groups discussion of general nature, and more a case for stackoverflow or similar forums, where coding experts and enthusiastic programmers are ready to help with advice extracted out of their wealth of experience. 

Kevin Malachowski

未读,
2017年6月2日 17:42:072017/6/2
收件人 Google Cloud SQL discuss
You should create a Windows Service. This is the standard for running long-lived software on Windows-based servers as far as I know. Here's a stack overflow link which appears to have a straightforward answer for you to try: https://stackoverflow.com/questions/3582108/create-windows-service-from-executable
回复全部
回复作者
转发
0 个新帖子