Search code examples
.net-coredeploymentservicecross-platform

.NET Core 3.1 Cross Plattform Development - WorkerService


I'm trying to find the best solution to deploy a Worker Service to all Platforms: I would like to run my WorkerService on Windows as Service, on Linux as Systemd Service and on MacOS..as? My requirements are simple: Easy to install, automatic start, restart on error and a way to force automatic update on all platforms.

My first intend was to write for every platform install, uninstall and update scripts. I started a proof of concept with PowerShell on Windows and noticed it does not work to execute a script which shuts down the service for updating files.

On Linux the creation of a systemd service is much complex than a service on windows. I need a configuration file and security is different from windows.

For MacOs I found nothing about installing as service. The service on it's self is just some kind of a simple ReverseProxy and needs Network Access. A second idea could be to work with cron jobs for updating.

Are there any existing solutions how to achieve my goals? Ideas?


Solution

  • Well I managed a solution by using on each platform scripts to install and uninstall. With a update script per OS it works to shutdown the service, replace the files and start up again. The service it self triggers the update script after downloading a new release as zip file.