Files
AZ-NIX-SERVERS/hosts/AZ-CLD-1/services/containers/homarr.nix
T
m3ta-chiron cff5600659 feat: Wartungsmodus fuer einzelne Dienste auf AZ-CLD-1
- Freundliche Wartungsseite (AZ-Branding, eingebettetes Logo, Auto-Reload,
  Dienst-Erkennung per Hostname) unter services/maintenance/www/
- nginx auf 127.0.0.1:3090 liefert die Seite mit 503 + Retry-After +
  no-store fuer alle Pfade
- Traefik: File-Provider auf ueberwachtes Verzeichnis /var/lib/traefik/dynamic
  umgestellt (staticConfigFile-Override); Basis-Konfig wird per preStart als
  00-base.toml hineingelinkt
- maintenance-CLI (on/off/status/list): schaltet pro Dienst Router mit
  Prioritaet 1000 auf den Wartungs-Service, wirksam in ~1-2 s ohne Rebuild
- Auto-Aus per transientem systemd-Timer (Default 4 h) + stuendlicher
  Expiry-Sweep als Reboot-Nachversicherung
- ntfy-Push bei on/off (opt-in via Token-Datei)
- errors-Middleware error-pages (502-504) an allen HTTP-Routern: Auch bei
  ungeplanten Ausfaellen erscheint die Wartungsseite statt Traefik-Standardfehler
2026-10-02 11:13:48 +02:00

50 lines
1.5 KiB
Nix

{config, ...}: let
serviceName = "homarr";
servicePort = config.m3ta.ports.get serviceName;
in {
virtualisation.oci-containers.containers.${serviceName} = {
image = "ghcr.io/homarr-labs/homarr:latest";
environment = {
TZ = "Europe/Berlin";
BASE_URL = "https://dash.az-gruppe.com";
NEXTAUTH_URL = "https://dash.az-gruppe.com";
AUTH_PROVIDERS = "oidc";
AUTH_OIDC_CLIENT_NAME = "Azure";
AUTH_OIDC_SCOPE_OVERWRITE = "openid email profile";
AUTH_OIDC_GROUPS_ATTRIBUTE = "roles";
AUTH_OIDC_GROUPS_LOCAL_MANAGEMENT = "true";
};
environmentFiles = [config.age.secrets.homarr-env.path];
ports = ["127.0.0.1:${toString servicePort}:7575"];
volumes = ["homarr_data:/appdata"];
extraOptions = ["--ip=10.89.0.13" "--network=web" "--dns=8.8.8.8" "--dns=8.8.4.4"];
};
# Traefik configuration
services.traefik.dynamicConfigOptions.http = {
services.${serviceName}.loadBalancer.servers = [
{
url = "http://localhost:${toString servicePort}/";
}
];
middlewares."${serviceName}-headers".headers = {
customRequestHeaders = {
X-Forwarded-Proto = "https";
X-Forwarded-Port = "443";
};
};
routers.${serviceName} = {
rule = "Host(`dash.az-gruppe.com`)";
tls = {
certResolver = "ionos";
};
service = serviceName;
entrypoints = "websecure";
middlewares = ["error-pages" "${serviceName}-headers"];
};
};
}