nix-config/hosts/containers/keycloak/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

59 lines
1.6 KiB
Nix
Raw Normal View History

2022-01-16 13:26:37 +01:00
{ zentralwerk, config, pkgs, ... }:
2021-10-15 23:11:54 +02:00
let
frontendDomain = "keycloak.c3d2.de";
in
2021-10-02 19:59:31 +02:00
{
2021-10-16 19:04:16 +02:00
networking = {
hostName = "keycloak";
useDHCP = false;
useNetworkd = true;
interfaces.eth0 = {
useDHCP = false;
ipv4.addresses = [{
2022-01-16 13:26:37 +01:00
address = config.c3d2.hosts."${config.networking.hostName}".ip4;
prefixLength = zentralwerk.lib.config.site.net.serv.subnet4Len;
2021-10-16 19:31:35 +02:00
}
2021-10-16 19:04:16 +02:00
];
};
defaultGateway = "172.20.73.1";
nameservers = [ "172.20.73.8" "9.9.9.9" ];
};
2021-10-15 23:11:54 +02:00
# http https
2021-10-16 20:43:43 +02:00
networking.firewall.allowedTCPPorts = [ 80 443 ];
2021-10-15 23:11:54 +02:00
services.nginx = {
enable = true;
virtualHosts."keycloak.c3d2.de" = {
default = true;
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://127.0.0.1:8080";
2021-10-16 18:24:54 +02:00
# proxyWebsockets = true;
};
locations."/auth" = {
proxyPass = "http://127.0.0.1:8080/auth";
2021-10-15 23:11:54 +02:00
# proxyWebsockets = true;
};
};
};
# noXlibs breaks cairo:
environment.noXlibs = false;
services.keycloak = let
inherit (pkgs.keycloak-secrets) dbPassword;
in {
enable = true;
inherit (pkgs.keycloak-secrets) initialAdminPassword;
frontendUrl = "https://${frontendDomain}/auth";
forceBackendUrlToFrontendUrl = true;
httpPort = "\${jboss.http.port:8080}";
bindAddress = "\${jboss.bind.address:127.0.0.1}";
2021-10-15 23:11:54 +02:00
# sslCertificate = "/var/lib/acme/${frontendDomain}/fullchain.pem";
# sslCertificateKey = "/var/lib/acme/${frontendDomain}/key.pem";
database.passwordFile = builtins.toFile "db_password" dbPassword;
};
systemd.services.keycloak.requires = [ "acme-${frontendDomain}.service" ];
2021-10-02 19:59:31 +02:00
}