[keycloak-user] Hotdeploy theme module

Marko Strukelj mstrukel at redhat.com
Mon Jan 18 05:48:31 EST 2016


On Mon, Jan 18, 2016 at 11:01 AM, Stian Thorgersen <sthorger at redhat.com> wrote:
>
>
> On 18 January 2016 at 10:46, Marko Strukelj <mstrukel at redhat.com> wrote:
>>
>> 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.
>
>
> Sure, but it's still nice to have if we could support it
>
>>
>>
>> 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.
>
>
> Actually that won't work, because the two nodes would have different themes
> for a period. Domain mode in WildFly supports deployments to a cluster,
> which would be much nicer if we supported that.

Wildfly cluster deployment would indeed be nice. But would it really
update all instances at the same time rather than do a rolling
deployment? Updating all at once would be a stop-the-world situation
putting everyone on hold while it's going on. As long as you have a
front-end proxy that you can control in some way to redirect traffic
away from one node, then upgrade and restart the node, and repeat for
the other node, you can manually achieve the same - but possibly with
more work, and more error prone, if you don't use good tools to do it
with.

>
>>
>>
>> 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
>>
>
> I don't see the need for all those steps. All you need to do is change the
> dir property for the themes. Default built-in themes would then be loaded
> from the jars and your custom themes directly from the source.
>
>>
>> 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