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

Executable support for running as a Windows service

Open kurtisvg opened this issue 6 years ago • 5 comments
trafficstars

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.

kurtisvg avatar May 15 '19 15:05 kurtisvg

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.

Rob1080 avatar Jun 04 '20 12:06 Rob1080

Do they have a particular reason for being adverse to nssm? It seems fairly standard

kurtisvg avatar Jun 04 '20 14:06 kurtisvg

I think they're concerned about security implications of installing something from a source they don't necessarily trust.

Rob1080 avatar Jun 04 '20 15:06 Rob1080

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.

kurtisvg avatar Dec 20 '21 15:12 kurtisvg

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.

kurtisvg avatar Dec 20 '21 16:12 kurtisvg

Possibly worth looking at as an alternative to x/sys/windows/svc: https://github.com/kardianos/service.

enocom avatar Oct 14 '22 16:10 enocom

Bumping up the priority of this Windows item as well given customer interest.

enocom avatar Oct 21 '22 19:10 enocom

And bumping it back down after some further discussion. Feel free to thumbs-up this issue if it's interesting for you.

enocom avatar Nov 16 '22 21:11 enocom