[keycloak-dev] Hacking Tips
Marek Posolda
mposolda at redhat.com
Tue Oct 6 15:36:32 EDT 2015
Thanks for sharing.
Some of my tips: Whenever possible, I am using KeycloakServer from
testsuite for development. This uses Keycloak on embedded Undertow
instead of Wildfly/EAP. This is not possible just when I need to
develop/test something, which really requires "real" Wildfly/EAP6
environment (examples, subsystems, doublecheck that modules.xml are not
broken etc)
In addition, when I add system property "-Dresources", the UI
development is super-easy because:
- Caching headers are disabled on server side for theme files, so
browser caching is effectively disabled
- Themes use local filesystem
In other words, when I do some change in HTML or JS file, there is no
need to restart server. It's sufficient to logout/login to see all your
changes
Also I am using Mongo for development when possible. This has advantage
that data are persistent among restarts and KeycloakServer restart took
me around 2 seconds.
Marek
On 06/10/15 20:47, Stan Silvert wrote:
> In talking with Marko, I shared some of my hacking tips to aid with
> i18n/l10n development. But they are generally handy for easing all
> Keycloak development. Others might have other ways to improve on this
> stuff and make our lives easier?
>
> Here are mine:
>
> *Build server-dist without artifacts
> *I think Bill gets the credit for making this possible in WildFly.
> You can build it such that jars are not copied to the server.
> Instead, they are retrieved from your local maven repo. For Keycloak,
> you go to /distribution/server-dist/server-provisioning.xml and set
> copy-module-artifacts="false".
>
> Now when you compile any of Keycloak's java modules you just restart
> the server and see your changes.
>
> It would be nice if we could use a system property for this, but it
> looks like server-provisioning.xml doesn't support props for that
> attribute. Some day I'll fix it and submit a patch.
>
> Anyway, doing that and running mvn compile instead of mvn install
> brings the build time from 3 minutes to about 6 seconds. Only 6
> seconds to build the whole server!
>
> I use Windows and Cygwin to do this automatically in a batch file:
>
> cd c:\GitHub\keycloak\distribution\server-dist
> call mvn clean
> sed -i 's/copy-module-artifacts="true"/copy-module-artifacts="false"/'
> server-provisioning.xml
> call mvn compile
> sed -i 's/copy-module-artifacts="false"/copy-module-artifacts="true"/'
> server-provisioning.xml
>
> *Let the the default theme point to your maven clone instead of
> /standalone/configuration/themes
> *You can tell Keycloak to load the default theme from your development
> environment. This is especially handy when you are working on HTML or
> JS files for Keycloak Admin Console. To do this, edit
> keycloak-server.json. Here is the batch file code I use to automate it:
>
> cd
> c:\GitHub\keycloak\distribution\server-dist\target\keycloak*\standalone\configuration
> sed -i 's,"dir": "${jboss.server.config.dir}/themes","dir":
> "/GitHub/keycloak/forms/common-themes/src/main/resources/theme",'
> keycloak-server.json
>
> Note: I had to use a comma for my sed delimiter instead of forward slash /
>
> *Turn off caching in your browser.
> *You need to turn off caching to see your HTML and JS changes as soon
> as you edit them. But it can be a pain to turn caching on and off. I
> found a nifty FireFox extension called "Cache Disabler" that puts a
> little button in my toolbar to enable/disable all caching.
>
>
>
> _______________________________________________
> keycloak-dev mailing list
> keycloak-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-dev/attachments/20151006/e082a07e/attachment-0001.html
More information about the keycloak-dev
mailing list