Add traefik route with auth for syncthing-webinterface

Add auth to adguardhome and grafana traefik routes as well
This commit is contained in:
Evie Litherland-Smith 2023-10-26 17:22:47 +01:00
parent 825002f0ec
commit d5b54b8551
4 changed files with 50 additions and 47 deletions

View file

@ -1,50 +1,37 @@
{ config, lib, pkgs, user, ... }: { config, lib, pkgs, user, ... }:
let devices = [ "Ion" "Legion" "Northstar" "Ronin" "Vanguard" ]; let devices = [ "Ion" "Legion" "Northstar" "Ronin" "Vanguard" ];
in { in {
imports = [ ../traefik/syncthing.nix ];
services.syncthing = { services.syncthing = {
enable = true; enable = true;
systemService = true; systemService = true;
overrideDevices = false; overrideDevices = false;
overrideFolders = true; overrideFolders = true;
openDefaultPorts = true; openDefaultPorts = true;
settings = { settings.folders = {
devices = { "Documents" = {
"Ion".id = inherit devices;
"7DD4NPH-6T2ET5A-4FCLFWW-CS6UR2W-IO5XQXC-DM5B2Q4-6X7DGU2-UKKVEAB"; id = "gvggx-6telk";
"Legion".id = path = "~/Documents";
"6OX54CG-EAQMXKA-K7TXB5P-G5A27HB-52JE2FA-XNAYZU6-YMIDBXP-RKPBJQV"; ignorePerms = true;
"Northstar".id =
"HNK5Z72-757G3BP-I4PBWXY-FM5FWCM-ES4XP56-E5ULWB5-RGRCBUI-RHWRXQV";
"Ronin".id =
"ZOL5YHK-ZZZULIE-UHGVKHW-H5E4BP7-S4CZBOX-OIZVUCV-RZUXOKA-QVBUBAJ";
"Vanguard".id =
"I366QNQ-D3FTDRX-RNOTXMW-YITZXOF-DSCDMQD-63Q72LI-ME2Y4HZ-T34RMQK";
}; };
folders = { "Music" = {
"Documents" = { inherit devices;
inherit devices; id = "munzw-vnxhl";
id = "gvggx-6telk"; path = "~/Music";
path = "~/Documents"; ignorePerms = true;
ignorePerms = true; };
}; "Pictures" = {
"Music" = { inherit devices;
inherit devices; id = "ziuj8-rm6dn";
id = "munzw-vnxhl"; path = "~/Pictures";
path = "~/Music"; ignorePerms = true;
ignorePerms = true; };
}; "Videos" = {
"Pictures" = { inherit devices;
inherit devices; id = "mbsop-qteua";
id = "ziuj8-rm6dn"; path = "~/Videos";
path = "~/Pictures"; ignorePerms = true;
ignorePerms = true;
};
"Videos" = {
inherit devices;
id = "mbsop-qteua";
path = "~/Videos";
ignorePerms = true;
};
}; };
}; };
}; };

View file

@ -7,6 +7,7 @@
rule = "Host(`guard.xenia.me.uk`)"; rule = "Host(`guard.xenia.me.uk`)";
entryPoints = [ "http" "https" ]; entryPoints = [ "http" "https" ];
service = "adguard-webinterface"; service = "adguard-webinterface";
middlewares = [ "auth" ];
tls = { certResolver = "default"; }; tls = { certResolver = "default"; };
}; };
services.adguard-webinterface.loadBalancer.servers = services.adguard-webinterface.loadBalancer.servers =

View file

@ -2,16 +2,15 @@
{ {
imports = [ ./default.nix ]; imports = [ ./default.nix ];
services.traefik.dynamicConfigOptions = { services.traefik.dynamicConfigOptions.http = {
http = { routers.grafana = {
routers.grafana = { rule = "Host(`grafana.xenia.me.uk`)";
rule = "Host(`grafana.xenia.me.uk`)"; entryPoints = [ "http" "https" ];
entryPoints = [ "http" "https" ]; service = "grafana-webinterface";
service = "grafana-webinterface"; middlewares = [ "auth" ];
tls = { certResolver = "default"; }; tls = { certResolver = "default"; };
};
services.grafana-webinterface.loadBalancer.servers =
[{ url = "http://localhost:3100"; }];
}; };
services.grafana-webinterface.loadBalancer.servers =
[{ url = "http://localhost:3100"; }];
}; };
} }

View file

@ -0,0 +1,16 @@
{ config, lib, pkgs, ... }:
{
imports = [ ./default.nix ];
services.traefik.dynamicConfigOptions.http = {
routers.syncthing = {
rule = "Host(`sync.xenia.me.uk`)";
entryPoints = [ "http" "https" ];
service = "syncthing-webinterface";
middlewares = [ "auth" ];
tls = { certResolver = "default"; };
};
services.syncthing-webinterface.loadBalancer.servers =
[{ url = "http://localhost:8384"; }];
};
}