simplify caddy vhosts

This commit is contained in:
Pablo Ovelleiro Corral 2024-04-27 01:47:47 +02:00
parent d58209ef93
commit 3102053611
Signed by: pinpox
GPG key ID: 29E9A6ED72CCB334

View file

@ -9,59 +9,39 @@
"d '/data/srv/www/os/download/' 0750 hakkonaut hakkonaut - -" "d '/data/srv/www/os/download/' 0750 hakkonaut hakkonaut - -"
]; ];
services.caddy = { services.caddy =
enable = lib.mkForce true; let
group = "hakkonaut"; mkRevProxyVhost = addr: {
email = "admins@pub.solar"; logFormat = lib.mkForce "output discard";
enableReload = true; extraConfig = "reverse_proxy ${addr}";
globalConfig = lib.mkForce ''
grace_period 60s
'';
virtualHosts = {
"ci.pub.solar" = {
logFormat = lib.mkForce ''
output discard
'';
extraConfig = ''
reverse_proxy :4000
'';
}; };
"flora-6.pub.solar" = { in
logFormat = lib.mkForce '' {
output discard enable = lib.mkForce true;
''; group = "hakkonaut";
extraConfig = '' email = "admins@pub.solar";
basicauth * { enableReload = true;
hakkonaut $2a$14$mmIAy/Ezm6YGohUtXa2mWeW6Bcw1MQXPhrRbz14jAD2iUu3oob/t.
} globalConfig = lib.mkForce ''
reverse_proxy :${toString config.services.loki.configuration.server.http_listen_port} grace_period 60s
''; '';
};
"alerts.pub.solar" = { virtualHosts = {
logFormat = lib.mkForce '' "ci.pub.solar" = mkRevProxyVhost ":4000";
output discard "alerts.pub.solar" = mkRevProxyVhost "10.7.6.2:${toString config.services.prometheus.alertmanager.port}";
''; "grafana.pub.solar" = mkRevProxyVhost ":${toString config.services.grafana.settings.server.http_port}";
extraConfig = '' "obs-portal.pub.solar" = mkRevProxyVhost "obs-portal.svc.e5756d08-36fd-424b-f8bc-acdb92ca7b82.lev-1.int.greenbaum.zone:3000";
reverse_proxy 10.7.6.2:${toString config.services.prometheus.alertmanager.port} "flora-6.pub.solar" = {
''; logFormat = lib.mkForce "output discard";
}; extraConfig = ''
"grafana.pub.solar" = { basicauth * {
logFormat = lib.mkForce '' hakkonaut $2a$14$mmIAy/Ezm6YGohUtXa2mWeW6Bcw1MQXPhrRbz14jAD2iUu3oob/t.
output discard }
''; reverse_proxy :${toString config.services.loki.configuration.server.http_listen_port}
extraConfig = '' '';
reverse_proxy :${toString config.services.grafana.settings.server.http_port} };
'';
};
"obs-portal.pub.solar" = {
logFormat = lib.mkForce ''
output discard
'';
extraConfig = ''
reverse_proxy obs-portal.svc.e5756d08-36fd-424b-f8bc-acdb92ca7b82.lev-1.int.greenbaum.zone:3000
'';
}; };
}; };
};
networking.firewall.allowedTCPPorts = [ 80 443 ]; networking.firewall.allowedTCPPorts = [ 80 443 ];
} }