2020-04-27 18:27:17 +00:00
|
|
|
{ ... }:
|
2020-01-23 19:47:42 +00:00
|
|
|
|
|
|
|
let
|
2020-04-28 13:05:51 +00:00
|
|
|
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;
|
|
|
|
|
2020-10-27 21:02:48 +00:00
|
|
|
staticConfigOptions = {
|
2020-10-28 16:31:18 +00:00
|
|
|
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";
|
2020-10-28 16:31:18 +00:00
|
|
|
http.redirections.entryPoint = {
|
|
|
|
to = "https";
|
|
|
|
scheme = "https";
|
|
|
|
};
|
2020-01-23 19:47:42 +00:00
|
|
|
};
|
2020-10-28 16:31:18 +00:00
|
|
|
https.address = ":443";
|
2020-01-23 19:47:42 +00:00
|
|
|
};
|
2020-10-28 16:31:18 +00:00
|
|
|
};
|
2020-01-23 19:47:42 +00:00
|
|
|
|
2020-10-28 16:31:18 +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
|
|
|
|
2020-10-28 16:31:18 +00:00
|
|
|
grafana = {
|
|
|
|
rule = "Host(`grafana.servnerr.com`)";
|
|
|
|
service = "grafana";
|
|
|
|
tls.certResolver = "letsencrypt";
|
|
|
|
};
|
2020-01-23 19:47:42 +00:00
|
|
|
|
2021-05-09 15:35:22 +00:00
|
|
|
hass = {
|
|
|
|
rule = "Host(`hass.servnerr.com`)";
|
|
|
|
service = "hass";
|
|
|
|
tls.certResolver = "letsencrypt";
|
|
|
|
};
|
|
|
|
|
2020-10-28 16:31:18 +00:00
|
|
|
plex = {
|
|
|
|
rule = "Host(`plex.servnerr.com`)";
|
|
|
|
service = "plex";
|
|
|
|
tls.certResolver = "letsencrypt";
|
|
|
|
};
|
2020-01-23 19:47:42 +00:00
|
|
|
|
2020-10-28 16:31:18 +00:00
|
|
|
prometheus = {
|
|
|
|
rule = "Host(`prometheus.servnerr.com`)";
|
|
|
|
middlewares = [ "prometheus" ];
|
|
|
|
service = "prometheus";
|
|
|
|
tls.certResolver = "letsencrypt";
|
|
|
|
};
|
2020-01-23 19:47:42 +00:00
|
|
|
};
|
|
|
|
|
2020-10-28 16:31:18 +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
|
|
|
|
2020-10-28 16:31:18 +00:00
|
|
|
services = {
|
|
|
|
alertmanager.loadBalancer.servers =
|
|
|
|
[{ url = "http://servnerr-3.${vars.domain}:9093"; }];
|
|
|
|
grafana.loadBalancer.servers =
|
|
|
|
[{ url = "http://servnerr-3.${vars.domain}:3000"; }];
|
2021-05-09 15:35:22 +00:00
|
|
|
hass.loadBalancer.servers =
|
|
|
|
[{ url = "http://servnerr-3.${vars.domain}:8123"; }];
|
2020-10-28 16:31:18 +00:00
|
|
|
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
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|