Helpful.Hosting.WorkerService.Windows/Systemd

Go here for the code and readme etc.

It has been a LONG time since I last sat down to blog. COVID has hit everyone in different ways, and although my family and I have managed to remain broadly free of infection, inspiration hasn’t been to visit for some time.

A couple of years ago, I put together a wrapper around TopShelf targeting DotNet Core, intended to provide a bit of a quick-start for those who were happy with the provided implementations of logging, healthchecking, and lifetime management I baked into it. I used it with a few clients, but I was always uneasy about how it was very much targeted at a Windows Server deployment, not Linux. I don’t feel like that is inline with the spirit of DotNet Core.

It was sometime in 2020 when I saw this post from Scott Hanselman, explaining how to get a Worker Service to build as either a Windows Service or a Linux systemd service. This made me think that someone should create an easy way to spin up one of these services, similar to how easy TopShelf made things. Because I’m often building services and don’t like to repeat myself, and also to give a more gradual introduction to Windows Service development for newcomers, I thought I’d have a crack at it.

And then COVID hit the world. And I lost a bit of focus.

But now it’s done! Or at least, it’s good enough for people to start using. I have a few usual suspects trying it out and offering suggestions. It’s definitely ready for people to start using in anger, and I’m very open to ideas, opinions and PR’s from anyone – just please be polite.

I did a quick demo the other day, and using the Windows version of the package, I went from no code, to a service ready to install in about 4 minutes – most of that was waiting for Visual Studio to load Resharper.

You can see the code and find out how to use it all, HERE!

You’re best heading over to the github repo with the above link and soaking up the fabulously written readme, but here’s a quick rundown of some features:

  • Very quickstart for 3 simple types of services:
    • A web api
    • A background timer
    • A combination of the two
  • A pretty straight forward way to override the defaults and build something much more fun.
  • Swagger
  • Logging with Serilog.
  • Logging correlation with Helpful.Logging.Standard.
  • An HTTP healthcheck endpoint reporting assembly name and version.
  • Multiple examples of how to use the package in different ways.
  • Did I mention really really really quickstart?

There are still a few things I want to do with the package. I’d love to get a sample deploying into ECS onto a Linux box – I’m sure I’ll get round to it in time. I really hope this proves useful to some of you. Please let me know if it does.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s