keycloak
Keycloak + Coöp Cloud.
- Category: Apps
- Status: 2, beta
- Image:
jboss/keycloak, 4, upstream - Healthcheck: Yes
- Backups: ?
- Email: 1
- Tests: 2
- SSO: N/A
Basic usage
- Set up Docker Swarm and
abra - Deploy
coop-cloud/traefik abra app new keycloak --secrets(optionally with--passif you'd like to save secrets inpass). Make sure to note theadmin_passwordabra app config YOURAPPDOMAIN- be sure to change$DOMAINto something that resolves to your Docker swarm boxabra app deploy YOURAPPDOMAIN- Proceed with replacing the temporary admin user
Replacing the temporary admin user
The inital user created by Keycloak, is a bootstrap user whose password is stored in plain text on the server. This recipe assigns that user the name "admin_bootstrap" and the password $BOOTSTRAP_PASSWORD set by abra app config YOURAPDOMAIN
Running abra app command YOURAPPDOMAIN app init_kc replaces this bootstrap admin with a permanent admin user whose username is $ADMIN_USERNAME and whose password is the secret generated in step 3 above. This will also delete the temporary admin user.
It is recommended to also set up MFA for this account from the web admin panel. Log in to the account, select manage account, select account security/signing in, and enable two factor authentication.
Running Commands in Keycloak's Admin CLI
To authenticate a session to Keycloak's admin API run:
abra app command YOURAPPDOMAIN app login_kcadm
After this you can run any Admin CLI command via the run_kcadm command. An example, which creates a "sandbox" realm:
abra app command YOURAPPDOMAIN app run_kcadm "'create realms -s realm=sandbox -s displayName=sandbox -s enabled=true'"
Keycloak Admin CLI documentation has more info on running kcadm commands
How do I setup a custom theme?
Check this approach.
How do I create another admin user?
- Under the
Masterrealm >Users>Add user - Create the user and set a temporary password
- Under the
Role Mappingstab, moveadminfromAvailable RolesintoAssigned Roles
What do I do if I lost my admin account credentials?
You can create a new admin account like this:
abra app run <domain> app -- bash -c '/opt/keycloak/bin/kc.sh bootstrap-admin user --db-password $(cat /run/secrets/db_password)'
Make sure to delete the temp-admin user after you finish recovering.