diff --git a/machines/storage01/_configuration.nix b/machines/storage01/_configuration.nix index 89df797..429bd13 100644 --- a/machines/storage01/_configuration.nix +++ b/machines/storage01/_configuration.nix @@ -15,6 +15,7 @@ lib.extra.mkConfig { "garage" "netbird" "peertube" + "prometheus" ]; extraConfig = { diff --git a/machines/storage01/prometheus.nix b/machines/storage01/prometheus.nix new file mode 100644 index 0000000..a58bd96 --- /dev/null +++ b/machines/storage01/prometheus.nix @@ -0,0 +1,43 @@ +{ config, ... }: + +let + host = "prometheus.dgnum.eu"; + port = 9091; +in + +{ + services.prometheus = { + enable = true; + + inherit port; + + checkConfig = "syntax-only"; + enableReload = true; + + listenAddress = "127.0.0.1"; + + webConfigFile = config.age.secrets."prometheus-web_config_file".path; + + webExternalUrl = "https://${host}"; + + scrapeConfigs = [ + { + job_name = "prometheus"; + static_configs = [ { targets = [ "localhost:9090" ]; } ]; + } + ]; + }; + + services.nginx.virtualHosts.${host} = { + enableACME = true; + forceSSL = true; + + locations."/" = { + proxyPass = "http://127.0.0.1:${builtins.toString port}"; + proxyWebsockets = true; + recommendedProxySettings = true; + }; + }; + + age-secrets.autoMatch = [ "prometheus" ]; +} diff --git a/machines/storage01/secrets/prometheus-web_config_file b/machines/storage01/secrets/prometheus-web_config_file new file mode 100644 index 0000000..ed31479 --- /dev/null +++ b/machines/storage01/secrets/prometheus-web_config_file @@ -0,0 +1,24 @@ +age-encryption.org/v1 +-> ssh-ed25519 rHotTw RBYiRMlYSSJqICOKMUSCKb5r5o05rS9WCS4iiC7c1k0 +dWd+dS0UqpFmlSPAsoUPcslPbMhTulikbpzDD9LRCVQ +-> ssh-ed25519 jIXfPA clKVYR1MMXYIjDcmZQuCP69U04wdgyJ0JVWVtT/pkjI +JygjZZkaJwJ4HIYJL31PEL1+5DPmhh+z94NlO1zrG0E +-> ssh-ed25519 QlRB9Q SYHBZy0l+fTuJdzroI6mQPvupbiYp8RuuX/7cg38ZhE +x7aqS5IYPC1bpGYIl7yy/KPBF0Z6xgV1P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