snowflake/hosts/yuki/services/traefik.nix

188 lines
6.5 KiB
Nix
Raw Normal View History

{config, ...}: {
networking.firewall.allowedTCPPorts = [80 443 8080];
sops.secrets.cloudflare-api-key = {};
systemd.services.traefik = {
environment = {
CLOUDFLARE_EMAIL = "jch0tm2e@notohh.dev";
};
serviceConfig = {
EnvironmentFile = [config.sops.secrets.cloudflare-api-key.path];
};
};
2023-06-11 18:24:13 -04:00
services.traefik = {
enable = true;
dynamicConfigOptions = {
http = {
routers = let
fqdn = "internal.flake.sh";
in {
# local
2023-06-11 18:24:13 -04:00
api = {
rule = "PathPrefix(`/api/`)";
entryPoints = ["websecure"];
service = "api@internal";
};
2023-11-11 16:27:11 -05:00
homepage = {
rule = "Host(`dashboard.${fqdn}`)";
entrypoints = ["websecure"];
2023-11-11 16:27:11 -05:00
service = "homepage";
tls.domains = [{main = "*.${fqdn}";}];
tls.certresolver = "production";
2023-06-14 03:58:30 -04:00
};
stash = {
rule = "Host(`stash.${fqdn}`)";
entrypoints = ["websecure"];
service = "stash";
tls.domains = [{main = "*.${fqdn}";}];
tls.certresolver = "production";
};
2023-09-17 14:06:53 -04:00
jellyfin = {
rule = "Host(`jellyfin.${fqdn}`)";
entrypoints = ["websecure"];
2023-09-17 14:06:53 -04:00
service = "jellyfin";
tls.domains = [{main = "*.${fqdn}";}];
tls.certresolver = "production";
2023-09-17 14:06:53 -04:00
};
jellyseerr = {
rule = "Host(`jellyseerr.${fqdn}`)";
entrypoints = ["websecure"];
2023-09-17 14:06:53 -04:00
service = "jellyseerr";
tls.domains = [{main = "*.${fqdn}";}];
tls.certresolver = "production";
2023-09-17 14:06:53 -04:00
};
2023-11-11 16:27:11 -05:00
wallos = {
rule = "Host(`wallos.${fqdn}`)";
entrypoints = ["websecure"];
2023-11-11 16:27:11 -05:00
service = "wallos";
tls.domains = [{main = "*.${fqdn}";}];
tls.certresolver = "production";
2023-11-11 16:27:11 -05:00
};
2024-01-23 22:06:44 -05:00
hass = {
rule = "Host(`hass.${fqdn}`)";
entrypoints = ["websecure"];
2024-01-23 22:06:44 -05:00
service = "hass";
tls.domains = [{main = "*.${fqdn}";}];
tls.certresolver = "production";
2024-01-23 22:06:44 -05:00
};
2024-01-30 19:28:30 -05:00
paperless = {
rule = "Host(`paperless.${fqdn}`)";
entrypoints = ["websecure"];
2024-01-30 19:28:30 -05:00
service = "paperless";
tls.domains = [{main = "*.${fqdn}";}];
tls.certresolver = "production";
};
2024-02-01 07:39:28 -05:00
miniflux = {
rule = "Host(`rss.${fqdn}`)";
2024-02-01 07:39:28 -05:00
entrypoints = ["websecure"];
service = "miniflux";
tls.domains = [{main = "*.${fqdn}";}];
2024-02-01 07:39:28 -05:00
tls.certresolver = "production";
};
# kariru
sonarr = {
rule = "Host(`sonarr.${fqdn}`)";
entryPoints = ["websecure"];
service = "sonarr";
tls.domains = [{main = "*.${fqdn}";}];
tls.certresolver = "production";
};
radarr = {
rule = "Host(`radarr.${fqdn}`)";
entryPoints = ["websecure"];
service = "radarr";
tls.domains = [{main = "*.${fqdn}";}];
tls.certresolver = "production";
};
readarr = {
rule = "Host(`readarr.${fqdn}`)";
entryPoints = ["websecure"];
service = "readarr";
tls.domains = [{main = "*.${fqdn}";}];
tls.certresolver = "production";
};
lidarr = {
rule = "Host(`lidarr.${fqdn}`)";
entryPoints = ["websecure"];
service = "lidarr";
tls.domains = [{main = "*.${fqdn}";}];
tls.certresolver = "production";
};
bazarr = {
rule = "Host(`bazarr.${fqdn}`)";
entryPoints = ["websecure"];
service = "bazarr";
tls.domains = [{main = "*.${fqdn}";}];
tls.certresolver = "production";
};
whisparr = {
rule = "Host(`whisparr.${fqdn}`)";
entryPoints = ["websecure"];
service = "whisparr";
tls.domains = [{main = "*.${fqdn}";}];
tls.certresolver = "production";
};
prowlarr = {
rule = "Host(`prowlarr.${fqdn}`)";
entrypoints = ["websecure"];
service = "prowlarr";
tls.domains = [{main = "*.${fqdn}";}];
tls.certresolver = "production";
2024-01-30 19:28:30 -05:00
};
2023-06-11 18:24:13 -04:00
};
services = let
kariruHost = "192.168.1.54:";
in {
# local
stash.loadBalancer.servers = [{url = "http://localhost:9999";}];
2023-11-11 16:27:11 -05:00
homepage.loadBalancer.servers = [{url = "http://localhost:7676";}];
2023-09-17 14:06:53 -04:00
jellyfin.loadBalancer.servers = [{url = "http://localhost:8096";}];
jellyseerr.loadBalancer.servers = [{url = "http://localhost:5055";}];
2023-11-11 16:27:11 -05:00
wallos.loadBalancer.servers = [{url = "http://localhost:8282";}];
2024-01-23 22:06:44 -05:00
hass.loadBalancer.servers = [{url = "http://localhost:8123";}];
paperless.loadBalancer.servers = [{url = "http://localhost:28981";}];
2024-02-01 07:39:28 -05:00
miniflux.loadBalancer.servers = [{url = "http://localhost:9000";}];
# kariru
sonarr.loadBalancer.servers = [{url = "http://${kariruHost}8989";}];
radarr.loadBalancer.servers = [{url = "http://${kariruHost}7878";}];
readarr.loadBalancer.servers = [{url = "http://${kariruHost}8787";}];
lidarr.loadBalancer.servers = [{url = "http://${kariruHost}8686";}];
bazarr.loadBalancer.servers = [{url = "http://${kariruHost}6767";}];
whisparr.loadBalancer.servers = [{url = "http://${kariruHost}6969";}];
prowlarr.loadBalancer.servers = [{url = "http://${kariruHost}9696";}];
2023-06-11 18:24:13 -04:00
};
};
};
staticConfigOptions = {
log.level = "DEBUG";
api.dashboard = true;
api.insecure = true;
2023-06-11 18:24:13 -04:00
global = {
checkNewVersion = false;
sendAnonymousUsage = false;
};
entryPoints = {
websecure = {
address = ":443";
forwardedHeaders.insecure = true;
};
web = {
address = ":80";
forwardedHeaders.insecure = true;
};
2023-06-11 18:24:13 -04:00
};
certificatesResolvers = {
production.acme = {
email = "x3xr6n66@notohh.dev";
storage = "/var/lib/traefik/acme.json";
caServer = "https://acme-v02.api.letsencrypt.org/directory";
dnsChallenge = {
provider = "cloudflare";
resolvers = ["1.1.1.1:53" "1.0.0.1:53"];
delayBeforeCheck = "0";
};
};
};
2023-06-11 18:24:13 -04:00
};
};
}