cloud-sql-proxy
cloud-sql-proxy copied to clipboard
Executable support for running as a Windows service
Currently the best approach to using the proxy as a windows service is to wrap it a utility like NSSM, as mentioned in this SO post. This is because Windows expects a "ServiceMain" call back function to be handled by the process.
It looks like Go may include support for this based on this example, so we should investigate if this would work and make sense in the proxy.
Hi, has there been any update on this? We have some client's who need to connect from a windows server, but aren't too keen to use nssm.
Do they have a particular reason for being adverse to nssm? It seems fairly standard
I think they're concerned about security implications of installing something from a source they don't necessarily trust.
Follow up RE: security, NSSM is open source and can be inspected, compiled, and distributed by the org themselves. There seems to be little reason for not trusting it given the transparency involved here.
As far as I can tell, the golang.org/x/sys/windows/svc is still the best way to do this. We would need to implement the scv.Handler interface and make sure the main func executes it with svc.Run. We would also need to update the status and respond to signals with the given channels.
Possibly worth looking at as an alternative to x/sys/windows/svc: https://github.com/kardianos/service.
Bumping up the priority of this Windows item as well given customer interest.
And bumping it back down after some further discussion. Feel free to thumbs-up this issue if it's interesting for you.