Added prometheus configuration

This commit is contained in:
Alejandro Angulo 2023-09-07 20:21:46 -07:00
parent 5e38e0c49c
commit f15e36d635
Signed by: alejandro-angulo
GPG key ID: 75579581C74554B6
2 changed files with 48 additions and 0 deletions

View file

@ -0,0 +1,44 @@
{
options,
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.aa.services.prometheus;
in {
options.aa.services.prometheus = with types; {
enable = mkEnableOption "prometheus";
acmeCertName = mkOption {
type = str;
default = "";
description = ''
If set to a non-empty string, forces SSL with the supplied acme
certificate.
'';
};
};
config = mkIf cfg.enable {
services.prometheus.enable = true;
services.nginx = {
enable = true;
virtualHosts."prometheus.${cfg.acmeCertName}" =
{
locations."/" = {
proxyPass = "http://${config.services.prometheus.listenAddress}:${toString config.services.prometheus.port}";
};
}
// lib.optionalAttrs (cfg.acmeCertName != "") {
forceSSL = true;
useACMEHost = cfg.acmeCertName;
};
};
networking.firewall = {
allowedTCPPorts = [80 443];
};
};
}

View file

@ -34,6 +34,10 @@
enable = true; enable = true;
acmeCertName = "kilonull.com"; acmeCertName = "kilonull.com";
}; };
services.prometheus = {
enable = true;
acmeCertName = "kilonull.com";
};
services.syncoid = { services.syncoid = {
# sudo -u backups zfs create -o mountpoint=/tank/backups/gospel tank/backups/gospel # sudo -u backups zfs create -o mountpoint=/tank/backups/gospel tank/backups/gospel
enable = true; enable = true;