router: services: caddy subpath proxies for grafana and adguardhome

This commit is contained in:
Yuri Tatishchev 2025-05-11 18:40:49 -07:00
parent 05d558e836
commit 2aa3d87184
Signed by: CaZzzer
SSH Key Fingerprint: SHA256:sqXB3fe0LMpfH+IeM/vlmxKdso52kssrIJBlwKXVe1U

View File

@ -30,7 +30,11 @@ in
# https://wiki.nixos.org/wiki/Grafana#Declarative_configuration
services.grafana = {
enable = true;
settings.server.http_port = 3001;
settings.server = {
http_port = 3001;
serve_from_sub_path = true;
root_url = "%(protocol)s://%(domain)s:%(http_port)s/grafana/";
};
provision = {
enable = true;
datasources.settings.datasources = [
@ -46,8 +50,18 @@ in
services.caddy = {
enable = true;
virtualHosts."grouter.${domain}".extraConfig = ''
reverse_proxy localhost:${toString config.services.grafana.settings.server.http_port}
tls internal
@grafana path /grafana /grafana/*
handle @grafana {
reverse_proxy localhost:${toString config.services.grafana.settings.server.http_port}
}
redir /adghome /adghome/
handle_path /adghome/* {
reverse_proxy localhost:${toString config.services.adguardhome.port}
basic_auth {
Bob $2a$14$HsWmmzQTN68K3vwiRAfiUuqIjKoXEXaj9TOLUtG2mO1vFpdovmyBy
}
}
'';
};
}