snowflake/hosts/sakura/services/traefik.nix

84 lines
2.2 KiB
Nix
Raw Normal View History

2023-06-11 18:19:51 -04:00
{config, ...}: {
2023-05-28 22:00:50 -04:00
sops.secrets.cloudflare-api-key = {};
systemd.services.traefik = {
environment = {
CLOUDFLARE_EMAIL = "jch0tm2e@notohh.dev";
};
2023-06-11 18:19:51 -04:00
serviceConfig = {
EnvironmentFile = [config.sops.secrets.cloudflare-api-key.path];
};
2023-05-28 22:00:50 -04:00
};
services.traefik = {
enable = true;
dynamicConfigOptions = {
http = {
2023-06-23 22:34:32 -04:00
middlewares.authelia = {
forwardauth = {
address = "http://localhost:9091/api/verify?rd=https://passport.notohh.dev/";
trustForwardHeader = true;
};
};
2023-05-28 22:00:50 -04:00
routers = {
api = {
rule = "PathPrefix(`/api/`)";
2023-06-23 22:34:32 -04:00
entrypoints = ["websecure"];
2023-05-28 22:00:50 -04:00
service = "api@internal";
};
dashdot = {
rule = "Host(`dashdot.sakura.internal.flake.sh`)";
entrypoints = ["web"];
service = "dashdot";
};
2023-05-28 22:00:50 -04:00
};
services = {
dashdot.loadBalancer.servers = [{url = "http://localhost:4000";}];
2023-05-28 22:00:50 -04:00
};
};
};
staticConfigOptions = {
log.level = "DEBUG";
api.dashboard = false;
api.insecure = false;
global = {
checkNewVersion = false;
sendAnonymousUsage = false;
};
entryPoints = {
2023-06-13 03:59:30 -04:00
websecure = {
address = ":443";
};
web = {
address = ":80";
};
2023-05-28 22:00:50 -04:00
};
2023-06-19 18:43:32 -04:00
metrics = {
prometheus = {
addServicesLabels = true;
};
};
2023-05-28 22:00:50 -04:00
certificatesResolvers = {
staging.acme = {
email = "x3xr6n66@notohh.dev";
storage = "/var/lib/traefik/acme.json";
caServer = "https://acme-staging-v02.api.letsencrypt.org/directory";
dnsChallenge = {
provider = "cloudflare";
resolvers = ["1.1.1.1:53" "1.0.0.1:53"];
delayBeforeCheck = "0";
};
};
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";
};
};
};
};
};
}