treewide: use localhost instead of ipv4

This commit is contained in:
Felix Buehler 2024-12-27 20:30:21 +01:00
parent 68a379bb34
commit c105a223a7
24 changed files with 42 additions and 53 deletions

View file

@ -33,7 +33,7 @@ in
job_name = "smartctl"; job_name = "smartctl";
static_configs = [ static_configs = [
{ {
targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.smartctl.port}" ]; targets = [ "localhost:${toString config.services.prometheus.exporters.smartctl.port}" ];
labels = { labels = {
instance = config.networking.hostName; instance = config.networking.hostName;
}; };

View file

@ -34,7 +34,6 @@ in
prometheus = { prometheus = {
alertmanager = { alertmanager = {
enable = true; enable = true;
listenAddress = "127.0.0.1";
inherit (cfg) port; inherit (cfg) port;
configuration = import ./config.nix; configuration = import ./config.nix;
webExternalUrl = "https://alerts.${domain}"; webExternalUrl = "https://alerts.${domain}";
@ -48,7 +47,7 @@ in
job_name = "alertmanager"; job_name = "alertmanager";
static_configs = [ static_configs = [
{ {
targets = [ "127.0.0.1:${toString cfg.port}" ]; targets = [ "localhost:${toString cfg.port}" ];
labels = { labels = {
instance = config.networking.hostName; instance = config.networking.hostName;
}; };
@ -63,7 +62,7 @@ in
{ {
name = "Alertmanager"; name = "Alertmanager";
type = "alertmanager"; type = "alertmanager";
url = "http://127.0.0.1:${toString cfg.port}"; url = "http://localhost:${toString cfg.port}";
jsonData = { jsonData = {
implementation = "prometheus"; implementation = "prometheus";
handleGrafanaManagedAlerts = config.services.prometheus.enable; handleGrafanaManagedAlerts = config.services.prometheus.enable;

View file

@ -25,7 +25,7 @@ in
prometheus.exporters.exportarr-bazarr = { prometheus.exporters.exportarr-bazarr = {
inherit (config.services.prometheus) enable; inherit (config.services.prometheus) enable;
port = port + 1; port = port + 1;
url = "http://127.0.0.1:${toString port}"; url = "http://localhost:${toString port}";
inherit (cfg) apiKeyFile; inherit (cfg) apiKeyFile;
}; };
prometheus.scrapeConfigs = [ prometheus.scrapeConfigs = [
@ -33,7 +33,7 @@ in
job_name = "bazarr"; job_name = "bazarr";
static_configs = [ static_configs = [
{ {
targets = [ "127.0.0.1:${toString port + 1}" ]; targets = [ "localhost:${toString port + 1}" ];
labels = { labels = {
instance = config.networking.hostName; instance = config.networking.hostName;
}; };

View file

@ -75,7 +75,7 @@ in
} }
{ {
target_label = "__address__"; target_label = "__address__";
replacement = "127.0.0.1:${toString config.services.prometheus.exporters.blackbox.port}"; replacement = "localhost:${toString config.services.prometheus.exporters.blackbox.port}";
} }
]; ];
} }

View file

@ -57,7 +57,7 @@ in
job_name = "blocky"; job_name = "blocky";
static_configs = [ static_configs = [
{ {
targets = [ "127.0.0.1:${toString cfg.httpPort}" ]; targets = [ "localhost:${toString cfg.httpPort}" ];
labels = { labels = {
instance = config.networking.hostName; instance = config.networking.hostName;
}; };

View file

@ -48,7 +48,7 @@ in
job_name = "fritzbox"; job_name = "fritzbox";
static_configs = [ static_configs = [
{ {
targets = [ "127.0.0.1:${toString cfg.port}" ]; targets = [ "localhost:${toString cfg.port}" ];
labels = { labels = {
instance = config.networking.hostName; instance = config.networking.hostName;
}; };

View file

@ -44,7 +44,7 @@ in
job_name = "gitea"; job_name = "gitea";
static_configs = [ static_configs = [
{ {
targets = [ "127.0.0.1:${toString cfg.port}" ]; targets = [ "localhost:${toString cfg.port}" ];
labels = { labels = {
instance = config.networking.hostName; instance = config.networking.hostName;
}; };

View file

@ -43,7 +43,6 @@ in
domain = "visualization.${domain}"; domain = "visualization.${domain}";
root_url = "https://visualization.${domain}/"; root_url = "https://visualization.${domain}/";
http_port = cfg.port; http_port = cfg.port;
http_addr = "127.0.0.1";
}; };
security = { security = {
@ -70,7 +69,7 @@ in
job_name = "grafana"; job_name = "grafana";
static_configs = [ static_configs = [
{ {
targets = [ "127.0.0.1:${toString cfg.port}" ]; targets = [ "localhost:${toString cfg.port}" ];
labels = { labels = {
instance = config.networking.hostName; instance = config.networking.hostName;
}; };

View file

@ -43,7 +43,6 @@ in
settings = { settings = {
domain = "notes.${domain}"; domain = "notes.${domain}";
inherit (cfg) port; inherit (cfg) port;
host = "127.0.0.1";
protocolUseSSL = true; protocolUseSSL = true;
db = { db = {
dialect = "sqlite"; dialect = "sqlite";
@ -58,7 +57,7 @@ in
job_name = "hedgedoc"; job_name = "hedgedoc";
static_configs = [ static_configs = [
{ {
targets = [ "127.0.0.1:${toString cfg.port}" ]; targets = [ "localhost:${toString cfg.port}" ];
labels = { labels = {
instance = config.networking.hostName; instance = config.networking.hostName;
}; };

View file

@ -99,7 +99,7 @@ in
unit_system = "metric"; unit_system = "metric";
time_zone = cfg.timezone; time_zone = cfg.timezone;
external_url = "https://automation.${domain}"; external_url = "https://automation.${domain}";
internal_url = "http://127.0.0.1:${toString cfg.port}"; internal_url = "http://localhost:${toString cfg.port}";
}; };
http = { http = {
server_port = cfg.port; server_port = cfg.port;
@ -126,7 +126,7 @@ in
metrics_path = "/api/prometheus"; metrics_path = "/api/prometheus";
static_configs = [ static_configs = [
{ {
targets = [ "127.0.0.1:${toString cfg.port}" ]; targets = [ "localhost:${toString cfg.port}" ];
labels = { labels = {
instance = config.networking.hostName; instance = config.networking.hostName;
}; };

View file

@ -36,7 +36,7 @@ in
job_name = "jellyfin"; job_name = "jellyfin";
static_configs = [ static_configs = [
{ {
targets = [ "127.0.0.1:${toString cfg.port}" ]; targets = [ "localhost:${toString cfg.port}" ];
labels = { labels = {
instance = config.networking.hostName; instance = config.networking.hostName;
}; };

View file

@ -90,13 +90,13 @@ in
enable = true; enable = true;
configuration = { configuration = {
server = { server = {
http_listen_address = "127.0.0.1"; http_listen_address = "localhost";
http_listen_port = cfg.port; http_listen_port = cfg.port;
}; };
auth_enabled = false; auth_enabled = false;
common = { common = {
instance_addr = "127.0.0.1"; instance_addr = "localhost";
ring.kvstore.store = "inmemory"; ring.kvstore.store = "inmemory";
replication_factor = 1; replication_factor = 1;
@ -113,7 +113,7 @@ in
local.directory = "${config.services.loki.dataDir}/ruler"; local.directory = "${config.services.loki.dataDir}/ruler";
}; };
rule_path = "${config.services.loki.dataDir}/rules"; rule_path = "${config.services.loki.dataDir}/rules";
alertmanager_url = "http://127.0.0.1:${toString config.my.services.alertmanager.port}"; alertmanager_url = "http://localhost:${toString config.my.services.alertmanager.port}";
enable_alertmanager_v2 = true; enable_alertmanager_v2 = true;
}; };
@ -151,7 +151,7 @@ in
name = "Loki"; name = "Loki";
type = "loki"; type = "loki";
access = "proxy"; access = "proxy";
url = "http://127.0.0.1:${toString cfg.port}"; url = "http://localhost:${toString cfg.port}";
} }
]; ];
dashboards.settings.providers = [ dashboards.settings.providers = [
@ -169,7 +169,7 @@ in
job_name = "loki"; job_name = "loki";
static_configs = [ static_configs = [
{ {
targets = [ "127.0.0.1:${toString cfg.port}" ]; targets = [ "localhost:${toString cfg.port}" ];
labels = { labels = {
instance = config.networking.hostName; instance = config.networking.hostName;
}; };

View file

@ -50,7 +50,6 @@ in
settings = cfg.settings // { settings = cfg.settings // {
Port = cfg.port; Port = cfg.port;
Address = "127.0.0.1";
MusicFolder = cfg.musicFolder; MusicFolder = cfg.musicFolder;
LogLevel = "info"; LogLevel = "info";
Prometheus.Enabled = config.services.prometheus.enable; Prometheus.Enabled = config.services.prometheus.enable;
@ -63,7 +62,7 @@ in
job_name = "navidrome"; job_name = "navidrome";
static_configs = [ static_configs = [
{ {
targets = [ "127.0.0.1:${toString cfg.port}" ]; targets = [ "localhost:${toString cfg.port}" ];
labels = { labels = {
instance = config.networking.hostName; instance = config.networking.hostName;
}; };

View file

@ -121,7 +121,7 @@ in
job_name = "nextcloud"; job_name = "nextcloud";
static_configs = [ static_configs = [
{ {
targets = [ "127.0.0.1:${toString cfg.exporterPort}" ]; targets = [ "localhost:${toString cfg.exporterPort}" ];
labels = { labels = {
instance = config.networking.hostName; instance = config.networking.hostName;
}; };

View file

@ -24,7 +24,7 @@ let
default = null; default = null;
example = 8080; example = 8080;
description = '' description = ''
Which port to proxy to, through 127.0.0.1, for this virtual host. Which port to proxy to, through localhost, for this virtual host.
This option is incompatible with `root`. This option is incompatible with `root`.
''; '';
}; };
@ -45,7 +45,7 @@ let
example = literalExpression '' example = literalExpression ''
{ {
locations."/socket" = { locations."/socket" = {
proxyPass = "http://127.0.0.1:8096/"; proxyPass = "http://localhost:8096/";
proxyWebsockets = true; proxyWebsockets = true;
}; };
} }
@ -89,7 +89,7 @@ in
port = 8096; port = 8096;
extraConfig = { extraConfig = {
locations."/socket" = { locations."/socket" = {
proxyPass = "http://127.0.0.1:8096/"; proxyPass = "http://localhost:8096/";
proxyWebsockets = true; proxyWebsockets = true;
}; };
}; };
@ -330,7 +330,7 @@ in
enable = true; enable = true;
configuration = { configuration = {
listen = { listen = {
addr = "127.0.0.1"; addr = "localhost";
inherit (cfg.sso) port; inherit (cfg.sso) port;
}; };
audit_log = { audit_log = {
@ -403,16 +403,13 @@ in
# services.prometheus = lib.mkIf cfg.monitoring.enable { # services.prometheus = lib.mkIf cfg.monitoring.enable {
prometheus = { prometheus = {
exporters.nginx = { exporters.nginx.enable = true;
enable = true;
listenAddress = "127.0.0.1";
};
scrapeConfigs = [ scrapeConfigs = [
{ {
job_name = "nginx"; job_name = "nginx";
static_configs = [ static_configs = [
{ {
targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.nginx.port}" ]; targets = [ "localhost:${toString config.services.prometheus.exporters.nginx.port}" ];
labels = { labels = {
instance = config.networking.hostName; instance = config.networking.hostName;
}; };

View file

@ -31,7 +31,7 @@ in
default = { }; default = { };
example = literalExpression '' example = literalExpression ''
{ {
listen = { addr = "127.0.0.1"; port = 8080; }; listen = { addr = "localhost"; port = 8080; };
providers.token.tokens = { providers.token.tokens = {
myuser = "MyToken"; myuser = "MyToken";

View file

@ -25,11 +25,9 @@ in
]; ];
extraFlags = [ "--collector.textfile.directory=/etc/prometheus-node-exporter-text-files" ]; extraFlags = [ "--collector.textfile.directory=/etc/prometheus-node-exporter-text-files" ];
port = 9100; port = 9100;
listenAddress = "127.0.0.1";
}; };
systemd = { systemd = {
enable = true; enable = true;
listenAddress = "127.0.0.1";
}; };
}; };
@ -38,7 +36,7 @@ in
job_name = "node"; job_name = "node";
static_configs = [ static_configs = [
{ {
targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.node.port}" ]; targets = [ "localhost:${toString config.services.prometheus.exporters.node.port}" ];
labels = { labels = {
instance = config.networking.hostName; instance = config.networking.hostName;
}; };
@ -49,7 +47,7 @@ in
job_name = "systemd"; job_name = "systemd";
static_configs = [ static_configs = [
{ {
targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.systemd.port}" ]; targets = [ "localhost:${toString config.services.prometheus.exporters.systemd.port}" ];
labels = { labels = {
instance = config.networking.hostName; instance = config.networking.hostName;
}; };

View file

@ -67,14 +67,14 @@ in
job_name = "immich"; job_name = "immich";
static_configs = [ static_configs = [
{ {
targets = [ "127.0.0.1:${toString (cfg.port + 1)}" ]; targets = [ "localhost:${toString (cfg.port + 1)}" ];
labels = { labels = {
instance = config.networking.hostName; instance = config.networking.hostName;
service = "api"; service = "api";
}; };
} }
{ {
targets = [ "127.0.0.1:${toString (cfg.port + 2)}" ]; targets = [ "localhost:${toString (cfg.port + 2)}" ];
labels = { labels = {
instance = config.networking.hostName; instance = config.networking.hostName;
service = "server"; service = "server";

View file

@ -89,7 +89,6 @@ in
enable = true; enable = true;
webExternalUrl = "https://monitor.${domain}"; webExternalUrl = "https://monitor.${domain}";
inherit (cfg) port; inherit (cfg) port;
listenAddress = "127.0.0.1";
inherit (cfg) retentionTime; inherit (cfg) retentionTime;
@ -124,7 +123,7 @@ in
job_name = "prometheus"; job_name = "prometheus";
static_configs = [ static_configs = [
{ {
targets = [ "127.0.0.1:${toString cfg.port}" ]; targets = [ "localhost:${toString cfg.port}" ];
labels = { labels = {
instance = config.networking.hostName; instance = config.networking.hostName;
}; };
@ -140,7 +139,7 @@ in
name = "Prometheus"; name = "Prometheus";
type = "prometheus"; type = "prometheus";
isDefault = true; isDefault = true;
url = "http://127.0.0.1:${toString config.services.prometheus.port}"; url = "http://localhost:${toString config.services.prometheus.port}";
jsonData = { jsonData = {
prometheusType = "Prometheus"; prometheusType = "Prometheus";
prometheusVersion = toString pkgs.prometheus.version; prometheusVersion = toString pkgs.prometheus.version;

View file

@ -21,7 +21,6 @@ in
enable = true; enable = true;
configuration = { configuration = {
server = { server = {
http_listen_address = "127.0.0.1";
http_listen_port = cfg.port; http_listen_port = cfg.port;
grpc_listen_port = 0; # without it collides with loki; only used for pushing (not used) grpc_listen_port = 0; # without it collides with loki; only used for pushing (not used)
}; };
@ -30,7 +29,7 @@ in
}; };
clients = [ clients = [
{ {
url = "http://127.0.0.1:${toString config.services.loki.configuration.server.http_listen_port}/loki/api/v1/push"; url = "http://localhost:${toString config.services.loki.configuration.server.http_listen_port}/loki/api/v1/push";
} }
]; ];
scrape_configs = [ scrape_configs = [

View file

@ -25,7 +25,7 @@ in
prometheus.exporters.exportarr-prowlarr = { prometheus.exporters.exportarr-prowlarr = {
inherit (config.services.prometheus) enable; inherit (config.services.prometheus) enable;
port = port + 1; port = port + 1;
url = "http://127.0.0.1:${toString port}"; url = "http://localhost:${toString port}";
inherit (cfg) apiKeyFile; inherit (cfg) apiKeyFile;
}; };
prometheus.scrapeConfigs = [ prometheus.scrapeConfigs = [
@ -33,7 +33,7 @@ in
job_name = "prowlarr"; job_name = "prowlarr";
static_configs = [ static_configs = [
{ {
targets = [ "127.0.0.1:${toString port + 1}" ]; targets = [ "localhost:${toString port + 1}" ];
labels = { labels = {
instance = config.networking.hostName; instance = config.networking.hostName;
}; };

View file

@ -25,7 +25,7 @@ in
prometheus.exporters.exportarr-radarr = { prometheus.exporters.exportarr-radarr = {
inherit (config.services.prometheus) enable; inherit (config.services.prometheus) enable;
port = port + 1; port = port + 1;
url = "http://127.0.0.1:${toString port}"; url = "http://localhost:${toString port}";
inherit (cfg) apiKeyFile; inherit (cfg) apiKeyFile;
}; };
prometheus.scrapeConfigs = [ prometheus.scrapeConfigs = [
@ -33,7 +33,7 @@ in
job_name = "radarr"; job_name = "radarr";
static_configs = [ static_configs = [
{ {
targets = [ "127.0.0.1:${toString port + 1}" ]; targets = [ "localhost:${toString port + 1}" ];
labels = { labels = {
instance = config.networking.hostName; instance = config.networking.hostName;
}; };

View file

@ -25,7 +25,7 @@ in
prometheus.exporters.exportarr-sonarr = { prometheus.exporters.exportarr-sonarr = {
inherit (config.services.prometheus) enable; inherit (config.services.prometheus) enable;
port = port + 1; port = port + 1;
url = "http://127.0.0.1:${toString port}"; url = "http://localhost:${toString port}";
inherit (cfg) apiKeyFile; inherit (cfg) apiKeyFile;
}; };
prometheus.scrapeConfigs = [ prometheus.scrapeConfigs = [
@ -33,7 +33,7 @@ in
job_name = "sonarr"; job_name = "sonarr";
static_configs = [ static_configs = [
{ {
targets = [ "127.0.0.1:${toString port + 1}" ]; targets = [ "localhost:${toString port + 1}" ];
labels = { labels = {
instance = config.networking.hostName; instance = config.networking.hostName;
}; };

View file

@ -34,7 +34,7 @@ in
job_name = "docker"; job_name = "docker";
static_configs = [ static_configs = [
{ {
targets = [ "127.0.0.1:${toString config.services.cadvisor.port}" ]; targets = [ "localhost:${toString config.services.cadvisor.port}" ];
labels = { labels = {
instance = config.networking.hostName; instance = config.networking.hostName;
}; };