cloud-sql-proxy icon indicating copy to clipboard operation
cloud-sql-proxy copied to clipboard

Feature Request: Better support for running as a daemon process

Open sughodke opened this issue 6 years ago • 2 comments

I'm trying to run cloud_sql_proxy in a Google Colab notebook. We can authenticate and the proxy is actually running.

!./cloud_sql_proxy --instances=my-project:my-region:my-instance

However the notebook will not let me execute other cells, as the cloud_sql_proxy command does not terminate. I would hope that if we send the task to background, the notebook will continue processing.

Note that adding a & to run in the background doesn't seem to work in the notebook. The process continues to run foreground.

Please see https://stackoverflow.com/a/49142801 for a complete example.

sughodke avatar Dec 18 '18 17:12 sughodke

I added this as a comment to the Stackoverflow question, but a workaround that might be simpler than screen is daemonize. It should be sufficient for this use case, although not for #290.

dhduvall avatar Feb 10 '21 01:02 dhduvall

As @dhduvall notes in #290, this now also includes

making sure that systemd doesn't mark the proxy service as online until the proxy is ready to take requests

enocom avatar Feb 10 '21 18:02 enocom

Partially a duplicate of https://github.com/GoogleCloudPlatform/cloud-sql-proxy/issues/1567, which we'll be addressing soon.

For Colab Notebook support, see the Python connector which will be the best option: https://github.com/GoogleCloudPlatform/cloud-sql-python-connector (there's a badge that will take you straight to an example).

enocom avatar Mar 17 '23 01:03 enocom