Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to edit standalone.xml file dynamically in keycloak

I am trying to edit the standalone.xml through docker and trying to add but the keycloak is taking its standalone.xml . But I am able to see the changes inside the standalone.xml file. I need to add this line in standalone.xml file

 <provider>module:org.keycloak.examples.event-sysout</provider>

Also tried hot deployement but then can't fetch third party libraries code

like image 615
Tanmay Naik Avatar asked Aug 13 '19 08:08

Tanmay Naik


People also ask

Where is standalone XML in Keycloak?

xml is used. You can find this in /opt/jboss/tools/docker-entrypoint.sh.

What ports does Keycloak use?

By default, Keycloak is available on http://127.0.0.1:8080/ and https://127.0.0.1:8443/.


2 Answers

First, it seems in a docker container by default standalone-ha.xml is used. You can find this in /opt/jboss/tools/docker-entrypoint.sh. Second, I think after changing configuration file you'll have to restart keycloak server (container).

Not sure what do you mean by "dynamically". But it will be easier to modify the file locally and build a custom docker image. Dockerfile may look like:

FROM jboss/keycloak:6.0.1
ADD <path on your system>/standalone-ha.xml /opt/jboss/keycloak/standalone/configuration/standalone-ha.xml
like image 145
Yuriy P Avatar answered Oct 28 '22 17:10

Yuriy P


You can not replace or overwrite standalone-ha.xml/standalone.xml without jboss-cli on docker image. Only need to create a sh file and put inside startup-script folder. During initializing it will start and configure your file.

keycloak-cli

embed-server --server-config=standalone-ha.xml --std-out=echo 
batch

/subsystem=keycloak-server:list-add(name=providers, value=module:org.keycloak.examples.event-sysout)

run-batch 
stop-embedded-server

Dockerfile

FROM jboss/keycloak:latest

COPY keycloak.cli /opt/jboss/startup-scripts/keycloak.cli
like image 22
Mustafa Güler Avatar answered Oct 28 '22 16:10

Mustafa Güler