Keycloak: Difference between revisions

Onny (talk | contribs)
Add simple setup instruction
Onny (talk | contribs)
Fix for running http only
 
(2 intermediate revisions by the same user not shown)
Line 4: Line 4:


== Setup ==
== Setup ==
Following configuration will enable a minimal Keycloak instance for testing purpose<syntaxhighlight lang="nix">
Following configuration will enable a minimal and insecure Keycloak instance for '''testing purpose'''.<syntaxhighlight lang="nix">
environment.etc."keycloak-database-pass".text = "PWD";
environment.etc."keycloak-database-pass".text = "PWD";
services.keycloak = {
services.keycloak = {
Line 11: Line 11:
     hostname = "localhost";
     hostname = "localhost";
     http-enabled = true;
     http-enabled = true;
    hostname-strict-https = false;
   };
   };
   database.passwordFile = "/etc/keycloak-database-pass";
   database.passwordFile = "/etc/keycloak-database-pass";
};
};
</syntaxhighlight>
</syntaxhighlight>After applying the configuration the Keycloak management interface will be available at http://localhost. Login with username <code>admin</code> and password <code>changeme</code>.
 
== Troubleshooting ==
 
=== Installing on system without X11 ===
 
If, when you perform:
 
<syntaxhighlight lang="bash">
nixos-rebuild switch
</syntaxhighlight>
 
... you encounter errors like:
 
<syntaxhighlight lang="bash">
building Nix...
 
...
 
checking for CAIRO_BACKEND... no
configure: error: Package requirements (cairo-xlib >= 1.6) were not met:
 
No package 'cairo-xlib' found
 
...
 
error: build of '/nix/store/vfz...2a0-nixos-system-nixos-21.11pre322478.e4ef597edfd.drv' failed
</syntaxhighlight>
 
... it would be because the package expects X11 to be installed. The [https://nixos.org/manual/nixos/unstable/options.html#opt-environment.noXlibs environment.noXlibs] NixOS option will specify to not require the X11 libraries:
 
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
{ config, pkgs, ... }:
 
{
  environment.noXlibs = false;
}
</nowiki>}}


== Tips and tricks ==
== Tips and tricks ==