Added prometheus configuration
This commit is contained in:
parent
5e38e0c49c
commit
f15e36d635
44
modules/services/prometheus/default.nix
Normal file
44
modules/services/prometheus/default.nix
Normal 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];
|
||||
};
|
||||
};
|
||||
}
|
|
@ -34,6 +34,10 @@
|
|||
enable = true;
|
||||
acmeCertName = "kilonull.com";
|
||||
};
|
||||
services.prometheus = {
|
||||
enable = true;
|
||||
acmeCertName = "kilonull.com";
|
||||
};
|
||||
services.syncoid = {
|
||||
# sudo -u backups zfs create -o mountpoint=/tank/backups/gospel tank/backups/gospel
|
||||
enable = true;
|
||||
|
|
Loading…
Reference in a new issue