mio-ops/profiles/monitoring.nix

40 lines
1.1 KiB
Nix
Raw Normal View History

2020-05-28 04:21:36 +00:00
# NixOps configuration for the monitoring host
{ config, pkgs, lib, ... }:
{
2021-11-16 04:57:23 +00:00
imports = [ ./grafana.nix ./prometheus.nix ];
2020-05-28 04:21:36 +00:00
services = {
nginx = {
2021-11-16 04:57:23 +00:00
enable = true; # Enable Nginx
2020-05-28 04:21:36 +00:00
recommendedGzipSettings = true;
recommendedOptimisation = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
2021-11-16 04:57:23 +00:00
virtualHosts."monitoring.mcwhirter.io" = { # Monitoring hostname
enableACME = true; # Use ACME certs
forceSSL = true; # Force SSL
2020-05-28 04:21:36 +00:00
locations = {
2021-11-16 04:57:23 +00:00
"/grafana/".proxyPass = "http://localhost:3000/"; # Proxy Grafana
2020-05-28 04:21:36 +00:00
"/prometheus/".extraConfig = ''
proxy_pass http://localhost:9090/prometheus/;
proxy_set_header Host $host;
proxy_set_header REMOTE_ADDR $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
'';
};
};
};
};
security.acme = {
acceptTerms = true;
2021-11-16 04:57:23 +00:00
certs = { "monitoring.mcwhirter.io".email = "craige@mcwhirter.io"; };
2020-05-28 04:21:36 +00:00
};
}