mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 14:01:34 +01:00
caddy: Configure virtual hosts inside each web-service's module instead of in the host configs
This commit is contained in:
parent
dfeb11dfbd
commit
c9f05a040e
23 changed files with 130 additions and 170 deletions
|
|
@ -103,37 +103,6 @@ in
|
|||
RemoveIPC = true;
|
||||
};
|
||||
|
||||
custom.services.gatus.endpoints =
|
||||
let
|
||||
defaultEndpoints =
|
||||
self.nixosConfigurations
|
||||
|> lib.mapAttrs (_: value: value.config.meta.domains.list)
|
||||
|> lib.concatMapAttrs (
|
||||
hostName: domains:
|
||||
domains
|
||||
|> lib.filter (domain: domain != cfg.domain)
|
||||
|> lib.map (
|
||||
domain:
|
||||
lib.nameValuePair (lib'.subdomainOf domain) {
|
||||
inherit domain;
|
||||
group = hostName;
|
||||
}
|
||||
)
|
||||
|> lib.listToAttrs
|
||||
);
|
||||
in
|
||||
lib.mkIf cfg.generateDefaultEndpoints (
|
||||
defaultEndpoints
|
||||
// {
|
||||
"healthchecks.io" = {
|
||||
group = "external";
|
||||
domain = "hc-ping.com";
|
||||
path = "/\${HEALTHCHECKS_PING_KEY}/${config.networking.hostName}-gatus-uptime?create=1";
|
||||
interval = "2h";
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
services.gatus = {
|
||||
enable = true;
|
||||
package = pkgs-unstable.gatus; # Unstable for the new UI
|
||||
|
|
@ -206,6 +175,43 @@ in
|
|||
|
||||
systemd.services.gatus.environment.GATUS_DELAY_START_SECONDS = "5";
|
||||
|
||||
custom.persist.directories = [ dataDir ];
|
||||
custom = {
|
||||
services = {
|
||||
gatus.endpoints =
|
||||
let
|
||||
defaultEndpoints =
|
||||
self.nixosConfigurations
|
||||
|> lib.mapAttrs (_: value: value.config.meta.domains.list)
|
||||
|> lib.concatMapAttrs (
|
||||
hostName: domains:
|
||||
domains
|
||||
|> lib.filter (domain: domain != cfg.domain)
|
||||
|> lib.map (
|
||||
domain:
|
||||
lib.nameValuePair (lib'.subdomainOf domain) {
|
||||
inherit domain;
|
||||
group = hostName;
|
||||
}
|
||||
)
|
||||
|> lib.listToAttrs
|
||||
);
|
||||
in
|
||||
lib.mkIf cfg.generateDefaultEndpoints (
|
||||
defaultEndpoints
|
||||
// {
|
||||
"healthchecks.io" = {
|
||||
group = "external";
|
||||
domain = "hc-ping.com";
|
||||
path = "/\${HEALTHCHECKS_PING_KEY}/${config.networking.hostName}-gatus-uptime?create=1";
|
||||
interval = "2h";
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
caddy.virtualHosts.${cfg.domain}.port = cfg.port;
|
||||
};
|
||||
|
||||
persist.directories = [ dataDir ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue