[keycloak-user] Hotdeploy theme module

Marko Strukelj mstrukel at redhat.com
Mon Jan 18 04:46:12 EST 2016


Hot deployment is a tricky business always fraught with danger of
leaving garbage behind, leading to difficult-to-explain slowdowns and
eventually to out of memory, or to buggy behavior by not properly
refreshing resources in all the places. By not using it we can save
ourselves one possible cause for any such symptoms.

For production the proper way is to put it in a clustered setup of at
least two instances. You can then restart one at a time. At least
that's the idea.

For development there is a way to configure Keycloak to load themes
from your source directory, you can then just refresh your browser to
see changes.


You can set that up like this:

Build the project
  mvn clean install -DskipTests

Open and edit distribution/server-dist/server-provisioning.xml
Find copy-module-artifacts="true" and change it to copy-module-artifacts="false"

I use:
  sed -i '' 's/copy-module-artifacts="true"/copy-module-artifacts="false"/'
distribution/server-dist/server-provisioning.xml

Then only build the server distribution module
  mvn clean install -Pdistribution -pl distribution/server-dist

Finally instruct Keycloak to load themes from source directory. Open
and edit distribution/server-dist/target/keycloak*/standalone/configuration/keycloak-server.json

Find "dir": "${jboss.server.config.dir}/themes" and change it to
"dir": "PATH_TO_YOUR_KEYCLOAK_GIT_HOME/forms/common-themes/src/main/resources/theme"

I use:
  sed -i '' 's,"dir": "${jboss.server.config.dir}/themes","dir":
"/Users/marko/devel/keycloak/keycloak/forms/common-themes/src/main/resources/theme",'
distribution/server-dist/target/keycloak*/standalone/configuration/keycloak-server.json

On Mon, Jan 18, 2016 at 9:46 AM, Travis De Silva <traviskds at gmail.com> wrote:
> I think the jar is a good idea. I have hocked it up with our Jenkins CI
> process.
>
> As you mentioned, since the themes are cached, we have no option but to
> restart KeyCloak. This might go well in a non-clustered production
> environment.
>
> I don't think wildfly modules are reloadable. But wildfly allows you to
> deploy a jar just like a war. Wondering why you guys didn't take that route
> and went with the module route.
>
> Also if there is anyway to clear the theme cache when we deploy a new change
> without having to restart KeyCloak would be great. I don't want to disable
> the cache settings in keycloak-server.json as cache is important for
> performance but just want a way to reload it when we deploy new changes/new
> themes via the jar file.
>
>
> On Mon, 18 Jan 2016 at 19:25 Stian Thorgersen <sthorger at redhat.com> wrote:
>>
>> You can chuck it into standalone/configuration/themes for production as
>> well. The docs suggest to not do that as in production you want a stable set
>> of files and make sure all nodes in a cluster has the same versions. Themes
>> are also by default cached, both on the server side and in the browser.
>>
>> On 18 January 2016 at 08:59, Juraci Paixão Kröhling <juraci at kroehling.de>
>> wrote:
>>>
>>> On 16.01.2016 23:29, Travis De Silva wrote:
>>> > I don't think wildfly does hot deployment for modules.
>>>
>>> How about adding/removing the module via the Wildfly CLI?
>>>
>>> module add --name=the.theme... --resources=...jar
>>>
>>> - Juca.
>>> _______________________________________________
>>> keycloak-user mailing list
>>> keycloak-user at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/keycloak-user
>>
>>
>> _______________________________________________
>> keycloak-user mailing list
>> keycloak-user at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/keycloak-user
>
>
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user



More information about the keycloak-user mailing list