Gitea: use traefik as reverse proxy

This commit is contained in:
Toast 2023-08-31 17:19:40 +02:00
parent 329ac39050
commit 6f7941aa74

View file

@ -9,11 +9,32 @@
server = { server = {
#server.SSH_PORT = 69; #server.SSH_PORT = 69;
DISABLE_REGISTRATION = lib.mkDefault true; DISABLE_REGISTRATION = lib.mkDefault true;
ROOT_URL = "http://everest.local:3000"; ROOT_URL = "http://everest/gitea/";
}; };
}; };
}; };
networking.firewall = { # Set up traefik as the reverse proxy for Gitea
allowedTCPPorts = [ 3000 ]; services.traefik = {
dynamicConfigOptions = {
http = {
routers = {
/*
Gitea works best as a subdomain, but I do not have a dns server (yet),
and since tailscale doesn't support adding subdomains with MagicDNS I'll
just put it in a subpath for now
*/
gitea-subpath = {
middlewares = [ "gitea-strip-prefix" ];
rule = "PathPrefix(`/gitea`)";
service = "gitea";
};
};
services.gitea.loadBalancer.servers = [
{ url = "http://localhost:${toString config.services.gitea.settings.server.HTTP_PORT}"; }
];
# Gitea freaks out if you don't remove the subpath it's being proxied from
middlewares.gitea-strip-prefix.stripprefix.prefixes = "/gitea";
};
};
}; };
} }