2020-05-28 04:21:36 +00:00
|
|
|
# NixOps configuration for the monitoring host
|
|
|
|
{
|
2022-03-07 14:26:15 +00:00
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}: {
|
|
|
|
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;
|
2022-03-07 14:26:15 +00:00
|
|
|
virtualHosts."monitoring.mcwhirter.io" = {
|
|
|
|
# Monitoring hostname
|
2021-11-16 04:57:23 +00:00
|
|
|
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;
|
2022-03-07 14:26:15 +00:00
|
|
|
certs = {"monitoring.mcwhirter.io".email = "craige@mcwhirter.io";};
|
2020-05-28 04:21:36 +00:00
|
|
|
};
|
|
|
|
}
|