Paco Abato
Paco Abato

Reputation: 4065

Keycloak configuration on startup cli script

I'm trying to configure a dockerized Keycloak server from a startup script I put on:

/opt/jboss/startup-scripts

I found the CLI commands description to add properties as well as some other examples but don't know which properties must I add/modify in order to, for example, add a realm to Keycloak.

Is there a complete listing of Keycloak configurable properties anywhere?

Upvotes: 2

Views: 6538

Answers (2)

  1. Write service script

This is my keycloak.sh

#!/bin/sh
kcuser=keycloak
case "$1" in
    start)
            echo Starting keycloak
            su $kcuser -c /usr/local/bin/keycloak-start.sh

            ;;

    stop)
            echo Stopping keycloak
            su $kcuser -c /usr/local/bin/keycloak-stop.sh

            ;;

    *)
            echo "Usage: $0 {start|stop}"
            exit 1
            ;;

You can add more commands such as restart, etc.

  1. Copy: keycloak.sh to /etc/init.d

  2. Run (as root)

    update-rc.d keycloak.sh

  3. Develop the start script

(e.g. set JAVA_HOME, cd keycloak-.../bin, nohup kc.sh ...)

  1. Develop the stop script

(e.g. ps -ef |grep keycloak... )

  1. Test: service keycloak start

Upvotes: 1

SebastianP
SebastianP

Reputation: 51

The Keycloak Docker image supports execution of two types of scripts mouted to /opt/jboss/startup-scripts:

  • WildFly .cli scripts.
  • Any executable (chmod +x) script

Due to your links I assume you are interrested in the WildFly scripts. I do not think that there is a complete listing of configurable properties for the WildFly application server used by the Keycloak Docker image. But you can Get all configuration and runtime details from CLI.

If you want to add a realm to Keycloak you can use the KEYCLOAK_IMPORT environment variable as described on the Keycloak Docker image page at "Importing a realm".

Upvotes: 3

Related Questions