From 6315ab62af0a2812da89f720989fdcb79b1c5e49 Mon Sep 17 00:00:00 2001 From: coolneng Date: Tue, 11 May 2021 12:55:34 +0200 Subject: [PATCH] Create Mono systemd service --- modules/webstack.nix | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/modules/webstack.nix b/modules/webstack.nix index abd5277..1d9a4df 100644 --- a/modules/webstack.nix +++ b/modules/webstack.nix @@ -96,4 +96,26 @@ host all all ::1/128 trust ''; }; + + # Run Mono server + systemd.services.mono-server = { + description = "Mono server to run ASP .NET applications"; + wantedBy = [ "default.target" ]; + path = with pkgs; [ mono6 ]; + script = '' + lockfile=/tmp/mono-service + ${pkgs.mono6}/bin/mono-service -d:/vault/backups/frontend/inetpub/wwwroot/gcw -l:$lockfile + ${pkgs.mono6}/bin/mono-service -d:/vault/backups/frontend/inetpub/wwwroot/few -l:$lockfile + ''; + serviceConfig = { + Type = "oneshot"; + RemainAfterExit = "yes"; + User = "nginx"; + Group = "nginx"; + ExecStop = '' + kill `cat $lockfile` + ''; + }; + before = [ "nginx.service" ]; + }; }