test-in-prod / carbonator

Windows service that collects performance counters and reports metrics to a Graphite server
MIT License
76 stars 13 forks source link

Use topshelf for windows service #9

Closed alexis2b closed 8 years ago

alexis2b commented 8 years ago

Hi, I strongly recommend using topshelf (http://topshelf-project.com/) to create a windows service rather than visual studio templates, it makes debugging, testing and installation much easier!

Alexis

test-in-prod commented 8 years ago

Thanks for the recommendation, but I do not see how this will make it any easier in debugging/testing/installation than it currently already is.

To start carbonator in console mode, append --console as an argument. Same goes for Visual Studio (Project Properties -> Debug -> Command line arguments: --console).

Service installation/removal is already provided via included batch scripts which use InstallUtil included in every major .NET framework release already.

alexis2b commented 8 years ago

Hi,

This page has some details on the benefits of TopShelf: http://docs.topshelf-project.com/en/latest/overview/faq.html

At the end of the day, since you have already gone through the effort of writing the code against the standard .NET Service implementation framework I would say it does not bring that much (except maybe easier unit-testability if you wanted to go this way, since the "business logic" is properly separated from the "service pattern").

I like the fact that you don't need InstallUtil to install anymore and can do it with a simple command line parameter, you can also override a lot of the service parameters through the command line.

Just a suggestion, feel free to disregard, you're the boss :-)

Alexis

test-in-prod commented 8 years ago

Fair enough, I'll leave it as-is for now, but Topshelf seems like it would be more useful in a larger service with a lot more things happening.