diff --git a/quarkus/README.md b/quarkus/README.md index 9a3e90127515..62e2bb261dc3 100644 --- a/quarkus/README.md +++ b/quarkus/README.md @@ -1,17 +1,56 @@ -# Keycloak Quarkus Distribution +# Keycloak on Quarkus -Keycloak on Quarkus is a work in progress. +The module holds the codebase to run Keycloak on top of [Quarkus](https://quarkus.io/): + +├── deployment +│   ├── Build-time codebase with all the necessary steps to build and configure the server +│ +├── runtime +│   ├── Runtime codebase with all the runtime code +│ +└── server + ├── The server itself, only responsible for generating the server artifacts + + +## Activating the Module + +The module isn't enabled by default. To enable it please activate the `quarkus` profile. ## Building +To build the module and produce the artifacts to run a server: + mvn -f ../pom.xml clean install -DskipTestsuite -DskipExamples -DskipTests -Pquarkus +### Building the Distribution + +To build the module as well as the distribution packages: + + mvn -f ../pom.xml clean install -DskipTestsuite -DskipExamples -DskipTests -Pquarkus,distribution + +The distribution packages (ZIP and TAR) should be available at [../distribution/server-x](../distribution/server-x/target). + ## Running - java -jar server/target/keycloak-runner.jar + java -jar server/target/lib/quarkus-run.jar -## Running in dev mode +## Contributing + +### Development Mode + +To run the server in development mode: cd server mvn compile quarkus:dev + +You should be able to attach your debugger to port `5005`. + +Changes to files such as `server/src/main/resources` or `server/src/main/resources/META-INF/keycloak.properties` should +be recognized automatically when running in development mode. + +However, considering that there is no real code in the `server` module (but from `runtime` and its dependencies), changes you make to +dependencies (e.g: services, model, etc) won't be reflected into the running server. However, you can still leverage the +hot reload capabilities from your IDE to make changes at runtime. +NOTE: We need to improve DevX and figure out why changes to dependencies are not being recognized when running tests or running +Quarkus Dev Mode. \ No newline at end of file diff --git a/quarkus/deployment/pom.xml b/quarkus/deployment/pom.xml index 4493cb801c14..83a7b710968b 100644 --- a/quarkus/deployment/pom.xml +++ b/quarkus/deployment/pom.xml @@ -14,70 +14,58 @@ keycloak-quarkus-server-deployment + + org.keycloak + keycloak-quarkus-server + ${project.version} + io.quarkus quarkus-core-deployment - ${quarkus.version} io.quarkus quarkus-arc-deployment - ${quarkus.version} io.quarkus quarkus-vertx-web-deployment - ${quarkus.version} - - - org.keycloak - keycloak-quarkus-server - ${project.version} io.quarkus quarkus-resteasy-deployment - ${quarkus.version} io.quarkus quarkus-resteasy-jackson-deployment - ${quarkus.version} io.quarkus quarkus-hibernate-orm-deployment - ${quarkus.version} io.quarkus quarkus-jdbc-h2-deployment - ${quarkus.version} io.quarkus quarkus-jdbc-postgresql-deployment - ${quarkus.version} io.quarkus quarkus-jdbc-mariadb-deployment - ${quarkus.version} io.quarkus quarkus-vertx-web-deployment - ${quarkus.version} io.quarkus quarkus-bootstrap-core - ${quarkus.version} io.quarkus quarkus-junit5-internal - ${quarkus.version} test @@ -146,7 +134,6 @@ - maven-resources-plugin diff --git a/quarkus/deployment/src/main/java/org/keycloak/quarkus/deployment/KeycloakProcessor.java b/quarkus/deployment/src/main/java/org/keycloak/quarkus/deployment/KeycloakProcessor.java index 53b77c58151b..9e0f0f1c43ec 100644 --- a/quarkus/deployment/src/main/java/org/keycloak/quarkus/deployment/KeycloakProcessor.java +++ b/quarkus/deployment/src/main/java/org/keycloak/quarkus/deployment/KeycloakProcessor.java @@ -8,6 +8,8 @@ import java.util.Map; import java.util.Set; +import io.quarkus.deployment.IsDevelopment; +import io.quarkus.deployment.builditem.HotDeploymentWatchedFileBuildItem; import io.quarkus.hibernate.orm.deployment.HibernateOrmConfig; import org.hibernate.cfg.AvailableSettings; import org.hibernate.jpa.boot.spi.PersistenceUnitDescriptor; @@ -80,6 +82,11 @@ void initializeRouter(BuildProducer routes) { routes.produce(new FilterBuildItem(new QuarkusRequestFilter(), FilterBuildItem.AUTHORIZATION - 10)); } + @BuildStep(onlyIf = IsDevelopment.class) + void configureDevMode(BuildProducer hotFiles) { + hotFiles.produce(new HotDeploymentWatchedFileBuildItem("META-INF/keycloak.properties")); + } + private Map>> loadFactories() { ProviderManager pm = new ProviderManager( KeycloakDeploymentInfo.create().services(), new BuildClassLoader(), diff --git a/quarkus/pom.xml b/quarkus/pom.xml index f3e555e85b19..2bf32805ff3a 100755 --- a/quarkus/pom.xml +++ b/quarkus/pom.xml @@ -37,9 +37,7 @@ ${jackson.version} 5.4.18.Final 1.20 - - 2.22.0 - + 3.0.0-M5 1.5.0.Final-format-001 1.8 UTF-8 @@ -51,21 +49,11 @@ io.quarkus - quarkus-bom-deployment + quarkus-bom ${quarkus.version} pom import - - org.keycloak - keycloak-quarkus-server - ${project.version} - - - org.keycloak - keycloak-quarkus-server-deployment - ${project.version} - org.hibernate hibernate-core diff --git a/quarkus/runtime/pom.xml b/quarkus/runtime/pom.xml index 7e23ca311e1f..de3f8d55a8cc 100644 --- a/quarkus/runtime/pom.xml +++ b/quarkus/runtime/pom.xml @@ -15,6 +15,18 @@ + + io.quarkus + quarkus-vertx-http + + + io.quarkus + quarkus-vertx + + + io.quarkus + quarkus-vertx-web + io.quarkus quarkus-resteasy diff --git a/quarkus/server/pom.xml b/quarkus/server/pom.xml index 5e298a9bf830..5cc5acfe55ce 100644 --- a/quarkus/server/pom.xml +++ b/quarkus/server/pom.xml @@ -14,35 +14,26 @@ Keycloak Quarkus Server App keycloak-quarkus-server-app - - quarkus-bom - io.quarkus - 2.22.1 - UTF-8 - 1.8 - 1.8 - - - - - - ${quarkus.platform.group-id} - ${quarkus.platform.artifact-id} - ${quarkus.version} - pom - import - - - - org.keycloak keycloak-quarkus-server + ${project.version} + + org.keycloak keycloak-quarkus-server-deployment + ${project.version} + compile + + + * + * + +