Fix caddy logging
Some checks failed
Run nix flake check / flake-check (push) Failing after 9m1s
Periodic flake update / flake-update (push) Successful in 1m33s

This commit is contained in:
Torjus Håkestad 2025-01-28 00:49:22 +01:00
parent 399c853f0c
commit e366a05204
Signed by: torjus
SSH Key Fingerprint: SHA256:KjAds8wHfD2mBYK2H815s/+ABcSdcIHUndwHEdSxml4
3 changed files with 49 additions and 12 deletions

View File

@ -2,6 +2,7 @@
{ {
services.caddy = { services.caddy = {
enable = true; enable = true;
package = pkgs.unstable.caddy;
configFile = pkgs.writeText "Caddyfile" '' configFile = pkgs.writeText "Caddyfile" ''
{ {
acme_ca https://ca.home.2rjus.net/acme/acme/directory acme_ca https://ca.home.2rjus.net/acme/acme/directory
@ -9,63 +10,83 @@
nzbget.home.2rjus.net { nzbget.home.2rjus.net {
log { log {
output file /var/log/caddy/nzbget.log output file /var/log/caddy/nzbget.log {
mode 644
}
} }
reverse_proxy http://nzbget-jail.home.2rjus.net:6789 reverse_proxy http://nzbget-jail.home.2rjus.net:6789
} }
radarr.home.2rjus.net { radarr.home.2rjus.net {
log { log {
output file /var/log/caddy/radarr.log output file /var/log/caddy/radarr.log {
mode 644
}
} }
reverse_proxy http://radarr-jail.home.2rjus.net:7878 reverse_proxy http://radarr-jail.home.2rjus.net:7878
} }
sonarr.home.2rjus.net { sonarr.home.2rjus.net {
log { log {
output file /var/log/caddy/sonarr.log output file /var/log/caddy/sonarr.log {
mode 644
}
} }
reverse_proxy http://sonarr-jail.home.2rjus.net:8989 reverse_proxy http://sonarr-jail.home.2rjus.net:8989
} }
ha.home.2rjus.net { ha.home.2rjus.net {
log { log {
output file /var/log/caddy/ha.log output file /var/log/caddy/ha.log {
mode 644
}
} }
reverse_proxy http://ha1.home.2rjus.net:8123 reverse_proxy http://ha1.home.2rjus.net:8123
} }
z2m.home.2rjus.net { z2m.home.2rjus.net {
log { log {
output file /var/log/caddy/z2m.log output file /var/log/caddy/z2m.log {
mode 644
}
} }
reverse_proxy http://ha1.home.2rjus.net:8080 reverse_proxy http://ha1.home.2rjus.net:8080
} }
prometheus.home.2rjus.net { prometheus.home.2rjus.net {
log { log {
output file /var/log/caddy/prometheus.log output file /var/log/caddy/prometheus.log {
mode 644
}
} }
reverse_proxy http://monitoring01.home.2rjus.net:9090 reverse_proxy http://monitoring01.home.2rjus.net:9090
} }
alertmanager.home.2rjus.net { alertmanager.home.2rjus.net {
log { log {
output file /var/log/caddy/alertmanager.log output file /var/log/caddy/alertmanager.log {
mode 644
}
} }
reverse_proxy http://monitoring01.home.2rjus.net:9093 reverse_proxy http://monitoring01.home.2rjus.net:9093
} }
grafana.home.2rjus.net { grafana.home.2rjus.net {
log { log {
output file /var/log/caddy/grafana.log output file /var/log/caddy/grafana.log {
mode 644
}
} }
reverse_proxy http://monitoring01.home.2rjus.net:3000 reverse_proxy http://monitoring01.home.2rjus.net:3000
} }
jelly.home.2rjus.net { jelly.home.2rjus.net {
log { log {
output file /var/log/caddy/jelly.log output file /var/log/caddy/jelly.log {
mode 644
}
} }
reverse_proxy http://jelly01.home.2rjus.net:8096 reverse_proxy http://jelly01.home.2rjus.net:8096
} }
http://http-proxy.home.2rjus.net/metrics { http://http-proxy.home.2rjus.net/metrics {
log { log {
output file /var/log/caddy/caddy-metrics.log output file /var/log/caddy/caddy-metrics.log {
mode 644
}
} }
metrics metrics
} }

View File

@ -2,6 +2,7 @@
{ {
services.caddy = { services.caddy = {
enable = true; enable = true;
package = pkgs.unstable.caddy;
configFile = pkgs.writeText "Caddyfile" '' configFile = pkgs.writeText "Caddyfile" ''
{ {
acme_ca https://ca.home.2rjus.net/acme/acme/directory acme_ca https://ca.home.2rjus.net/acme/acme/directory
@ -9,7 +10,9 @@
nix-cache.home.2rjus.net { nix-cache.home.2rjus.net {
log { log {
output file /var/log/caddy/nix-cache.log output file /var/log/caddy/nix-cache.log {
mode 644
}
} }
reverse_proxy http://localhost:5000 reverse_proxy http://localhost:5000
} }

View File

@ -1,4 +1,4 @@
{ ... }: { config, ... }:
{ {
services.promtail = { services.promtail = {
enable = true; enable = true;
@ -36,6 +36,19 @@
} }
]; ];
} }
{
job_name = "varlog";
static_configs = [
{
targets = [ "localhost" ];
labels = {
job = "varlog";
__path__ = "/var/log/**/*.log";
hostname = "${config.networking.hostName}";
};
}
];
}
]; ];
}; };
}; };