summary refs log tree commit diff stats
path: root/system/services/keycloak
diff options
context:
space:
mode:
authorsils <sils@sils.li>2023-06-06 13:46:21 +0200
committersils <sils@sils.li>2023-06-06 13:46:21 +0200
commit97baac0506a80db98de37a0f5c22560fcfea4e50 (patch)
tree7563097d4d93837856d50403daaf90f2ac424c00 /system/services/keycloak
parentFeat(system/file_system_layout): Add bindmount for postgresql (diff)
downloadnixos-server-97baac0506a80db98de37a0f5c22560fcfea4e50.tar.gz
nixos-server-97baac0506a80db98de37a0f5c22560fcfea4e50.zip
Feat(system/services/keycloak): Add keycloak
Diffstat (limited to 'system/services/keycloak')
-rw-r--r--system/services/keycloak/default.nix45
1 files changed, 45 insertions, 0 deletions
diff --git a/system/services/keycloak/default.nix b/system/services/keycloak/default.nix
new file mode 100644
index 0000000..837233e
--- /dev/null
+++ b/system/services/keycloak/default.nix
@@ -0,0 +1,45 @@
+{config, ...}: {
+  services.nginx = {
+    enable = true;
+
+    # enable recommended settings
+    recommendedGzipSettings = true;
+    recommendedOptimisation = true;
+    recommendedTlsSettings = true;
+    recommendedProxySettings = true;
+
+    virtualHosts = {
+      "auth.vhack.eu" = {
+        forceSSL = true;
+        enableACME = true;
+        locations = {
+          "/" = {
+            proxyPass = "http://localhost:${toString config.services.keycloak.settings.http-port}/";
+          };
+        };
+      };
+    };
+  };
+
+  services.postgresql.enable = true;
+
+  services.keycloak = {
+    enable = true;
+
+    database = {
+      type = "postgresql";
+      createLocally = true;
+
+      username = "keycloak";
+      passwordFile = builtins.readFile /srv/password;
+    };
+
+    settings = {
+      hostname = "auth.vhack.eu";
+      http-relative-path = "/";
+      http-port = 38080;
+      proxy = "passthrough";
+      http-enabled = true;
+    };
+  };
+}