[keycloak-dev] jarless Keycloak distro

Stan Silvert ssilvert at redhat.com
Mon Aug 21 08:36:16 EDT 2017


I've been using a jarless distro since I first started working on 
Keycloak.   I like working with a "real" WF server instead of embedded 
undertow.  The tradeoff is that I do need to do step 1 (build the module).

The only thing you really need to change in server-provisioning.xml is 
the copy-module-artifacts param.  Just change it from true to false.

I have a have a bat file that builds jarless server, adds admin user, 
and points the theme stuff to my dev directory:

cd c:\GitHub\keycloak\distribution\server-dist
call mvn clean
sed -i 's/copy-module-artifacts="true"/copy-module-artifacts="false"/' 
/cygdrive/c/GitHub/keycloak/distribution/server-provisioning.xml
call mvn compile -DskipTests
sed -i 's/copy-module-artifacts="false"/copy-module-artifacts="true"/' 
/cygdrive/c/GitHub/keycloak/distribution/server-provisioning.xml

cd c:\GitHub\keycloak\distribution\server-dist\target\keycloak*\modules
copy 
c:\GitHub\keycloak\distribution\server-dist\src\main\modules\layers.conf

set NOPAUSE=true
cd c:\GitHub\keycloak\distribution\server-dist\target\keycloak*\bin
call add-user-keycloak -u admin -p admin
call jboss-cli --file=/bat/write-theme-dir.cli

The write-theme-dir.cli script is handy on its own:
embed-server --server-config=standalone.xml
/subsystem=keycloak-server/theme=defaults/:write-attribute(name=dir,value=/GitHub/keycloak/themes/src/main/resources/theme)
/subsystem=keycloak-server/theme=defaults/:write-attribute(name=cacheTemplates,value=false)
/subsystem=keycloak-server/theme=defaults/:write-attribute(name=cacheThemes,value=false)

On 8/21/2017 4:49 AM, Marek Posolda wrote:
> Thanks for the tip!
>
> I see the benefit just during development. Or is it some other?
>
> Usually when I do changes in Keycloak sources in some module (eg. in
> keycloak-model-jpa module) I need to:
>
> 1) Build the module with "mvn clean install"
> 2) Copy the keycloak-model-jpa.jar to the modules in my Wildfly server.
> Or rebuild whole distro.
> 3) Restart the Wildfly
>
> With this, you don't need step 2.
>
> Still embedded undertow is best as you don't even need step 1 when
> running KeycloakServer from Idea ;) And for UI only changes, even server
> restart is not needed with embedded undertow and -Dresources option.
>
> Marek
>
>
> On 21/08/17 06:56, Stian Thorgersen wrote:
>> I knew, but are there any benefits?
>>
>> On 18 August 2017 at 20:51, Bill Burke <bburke at redhat.com> wrote:
>>
>>> Did you know with a flip of a switch that a jarless Keycloak distro can
>>> be created?  Just edit <root>/distribution/server-provisioning.xml and
>>> remove extraction params:
>>>
>>> <server-provisioning xmlns="urn:wildfly:server-provisioning:1.2"
>>> extract-schemas="true">
>>>        <feature-packs>
>>>            <feature-pack groupId="org.keycloak"
>>> artifactId="keycloak-server-feature-pack" version="${project.version}"/>
>>>        </feature-packs>
>>> </server-provisioning>
>>>
>>> All the module.xml reference maven artifacts and when you boot the
>>> distro it tries by default to resolve them in ~/.m2, you can even point
>>> it to a remote distro and it will download the jars.
>>>
>>>
>>> _______________________________________________
>>> keycloak-dev mailing list
>>> keycloak-dev at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/keycloak-dev
>>>
>> _______________________________________________
>> keycloak-dev mailing list
>> keycloak-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/keycloak-dev
>
> _______________________________________________
> keycloak-dev mailing list
> keycloak-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-dev



More information about the keycloak-dev mailing list