38 lines
993 B
Nix
38 lines
993 B
Nix
|
{ 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/";
|
||
|
};
|
||
|
};
|
||
|
}
|