From 0f62e84479a0a84aa81dc980612cd3310538851a Mon Sep 17 00:00:00 2001 From: clerie Date: Tue, 7 Dec 2021 19:09:50 +0100 Subject: [PATCH] Make status page public availiable --- hosts/web-2/configuration.nix | 1 + hosts/web-2/uptimestatus.nix | 37 +++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 hosts/web-2/uptimestatus.nix diff --git a/hosts/web-2/configuration.nix b/hosts/web-2/configuration.nix index 067442b..5c8d222 100644 --- a/hosts/web-2/configuration.nix +++ b/hosts/web-2/configuration.nix @@ -15,6 +15,7 @@ ./public.nix ./radicale.nix ./reichartstrasse.nix + ./uptimestatus.nix ./wetter.nix ./znc.nix ]; diff --git a/hosts/web-2/uptimestatus.nix b/hosts/web-2/uptimestatus.nix new file mode 100644 index 0000000..27b7f1e --- /dev/null +++ b/hosts/web-2/uptimestatus.nix @@ -0,0 +1,37 @@ +{ pkgs, ... }: + +{ + 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"; + }; + environment = { + UPTIMESTATUS_SETTINGS = pkgs.writeText "wetter.cfg" '' + PROMETHEUS_API_BASE="https://prometheus.monitoring.clerie.de" + ''; + }; + script = "gunicorn -w 4 -b [::1]:8236 uptimestatus:app"; + path = with pkgs; [ (python3.withPackages (ps: [ ps.gunicorn uptimestatus ])) ]; + }; + + services.nginx.virtualHosts = { + "status.clerie.de" = { + enableACME = true; + forceSSL = true; + locations."/".proxyPass = "http://[::1]:8236/"; + }; + }; +}