1
0
Fork 0
mirror of https://github.com/mdlayher/homelab.git synced 2024-12-14 11:47:32 +00:00
mdlayher-homelab/nixos/routnerr-2/traefik.nix

89 lines
2.4 KiB
Nix
Raw Normal View History

{ ... }:
2020-01-23 19:47:42 +00:00
let
secrets = import ./lib/secrets.nix;
2020-04-28 13:22:01 +00:00
vars = import ./lib/vars.nix;
2020-01-23 19:47:42 +00:00
in {
services.traefik = {
enable = true;
staticConfigOptions = {
certificatesResolvers.letsencrypt.acme = {
email = "mdlayher@gmail.com";
storage = "/var/lib/traefik/acme.json";
httpChallenge.entryPoint = "http";
};
2020-01-23 19:47:42 +00:00
entryPoints = {
# External entry points.
http = {
address = ":80";
http.redirections.entryPoint = {
to = "https";
scheme = "https";
};
2020-01-23 19:47:42 +00:00
};
https.address = ":443";
2020-01-23 19:47:42 +00:00
};
};
2020-01-23 19:47:42 +00:00
dynamicConfigOptions = {
http = {
routers = {
alertmanager = {
rule = "Host(`alertmanager.servnerr.com`)";
middlewares = [ "alertmanager" ];
service = "alertmanager";
tls.certResolver = "letsencrypt";
};
2020-01-23 19:47:42 +00:00
grafana = {
rule = "Host(`grafana.servnerr.com`)";
service = "grafana";
tls.certResolver = "letsencrypt";
};
2020-01-23 19:47:42 +00:00
hass = {
rule = "Host(`hass.servnerr.com`)";
service = "hass";
tls.certResolver = "letsencrypt";
};
plex = {
rule = "Host(`plex.servnerr.com`)";
service = "plex";
tls.certResolver = "letsencrypt";
};
2020-01-23 19:47:42 +00:00
prometheus = {
rule = "Host(`prometheus.servnerr.com`)";
middlewares = [ "prometheus" ];
service = "prometheus";
tls.certResolver = "letsencrypt";
};
2020-01-23 19:47:42 +00:00
};
middlewares = {
alertmanager.basicAuth.users =
[ "${secrets.traefik.alertmanager_auth}" ];
prometheus.basicAuth.users = [ "${secrets.traefik.prometheus_auth}" ];
};
2020-01-23 19:47:42 +00:00
services = {
alertmanager.loadBalancer.servers =
[{ url = "http://servnerr-3.${vars.domain}:9093"; }];
grafana.loadBalancer.servers =
[{ url = "http://servnerr-3.${vars.domain}:3000"; }];
hass.loadBalancer.servers =
[{ url = "http://servnerr-3.${vars.domain}:8123"; }];
plex.loadBalancer.servers =
[{ url = "http://servnerr-3.${vars.domain}:32400"; }];
prometheus.loadBalancer.servers =
[{ url = "http://servnerr-3.${vars.domain}:9090"; }];
};
2020-01-23 19:47:42 +00:00
};
};
};
}