diff --git a/hosts/monitoring-3/configuration.nix b/hosts/monitoring-3/configuration.nix index 1fa52bf..dee48b5 100644 --- a/hosts/monitoring-3/configuration.nix +++ b/hosts/monitoring-3/configuration.nix @@ -120,6 +120,27 @@ in { }; }; + users.users.uptimestatus = { + description = "Uptime Status Service"; + group = "uptimestatus"; + home = "/var/lib/uptimestatus/"; + useDefaultShell = true; + isSystemUser = true; + }; + users.groups.uptimestatus = {}; + + systemd.services.uptimestatus = { + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + RuntimeDirectory = "uptimestatus"; + StateDirectory = "uptimestatus"; + User = "uptimestatus"; + Group = "uptimestatus"; + }; + script = "gunicorn -w 4 -b [::1]:8235 uptimestatus:app"; + path = with pkgs; [ (python38.withPackages (ps: [ ps.gunicorn uptimestatus ])) ]; + }; + services.nginx = { enable = true; @@ -134,6 +155,11 @@ in { forceSSL = true; locations."/".proxyPass = "http://[::1]:3001/"; }; + "status.monitoring.clerie.de" = { + enableACME = true; + forceSSL = true; + locations."/".proxyPass = "http://[::1]:8235/"; + }; }; }; diff --git a/pkgs/overlay.nix b/pkgs/overlay.nix index 0315f01..ddb38c9 100644 --- a/pkgs/overlay.nix +++ b/pkgs/overlay.nix @@ -3,6 +3,7 @@ self: super: { flask-excel = self.python3.pkgs.callPackage ./flask-excel {}; pyexcel-xlsx = self.python3.pkgs.callPackage ./pyexcel-xlsx {}; pyexcel-webio = self.python3.pkgs.callPackage ./pyexcel-webio {}; + uptimestatus = self.python3.pkgs.callPackage ./uptimestatus {}; wetter = self.python3.pkgs.callPackage ./wetter { inherit (self) python2 pkgconfig libsass; }; diff --git a/pkgs/uptimestatus/default.nix b/pkgs/uptimestatus/default.nix new file mode 100644 index 0000000..956e71e --- /dev/null +++ b/pkgs/uptimestatus/default.nix @@ -0,0 +1,32 @@ +{ + buildPythonPackage, + flask, + requests, + python3, +}: + +let + src = fetchGit { + url = "https://git.clerie.de/clerie/uptime-status.git"; + rev = "caacaced97617838bbd9b7b91a4e3d06e411139b"; + }; + pname = "uptimestatus"; + version = "0.0.1"; + + +in buildPythonPackage rec { + inherit src pname version; + + propagatedBuildInputs = [ + flask + requests + ]; + + postInstall = '' + mkdir -p $out/${python3.sitePackages}/uptimestatus + cp -r uptimestatus/static $out/${python3.sitePackages}/uptimestatus/static + cp -r uptimestatus/templates $out/${python3.sitePackages}/uptimestatus/templates + ''; + + doCheck = false; +}