This project demonstrates the migration of the JBoss EAP Kitchensink quickstart application to Quarkus with MongoDB as the database.
- Updated the
pom.xmlto use Quarkus dependencies and build plugins - Replaced XML configuration files with Quarkus
application.properties - Updated CDI components to use Quarkus-compatible annotations
- Migrated from JPA/Hibernate to MongoDB with Panache
- Replaced JSF web interface with Quarkus Qute templates
- Created new Quarkus-compatible tests using REST Assured
- Added embedded MongoDB support for development and testing
- Added Kubernetes deployment support with dev mode capabilities
prompts.txtincludes some of the original prompts I used for various migrationsanalyze-project.ps1is a PowerShell script that analyzes the project and outputs guidance into theanalysisfolder
src/main/java/model- MongoDB entity classessrc/main/java/data- MongoDB repository classessrc/main/java/service- Service classessrc/main/java/rest- REST endpointssrc/main/java/config- Configuration classes including MongoDB lifecycle managementsrc/main/resources/templates- Qute templates for the web interfacesrc/main/resources/META-INF/resources- Static resources (CSS, images)
./mvnw quarkus:devThis command:
- Starts the application in development mode with live coding enabled
- Automatically starts an embedded MongoDB instance on port 27017
- Initializes the database with sample data
- No external MongoDB installation is required
The embedded MongoDB is managed by the MongoConfig class, which starts MongoDB when the application starts and stops it when the application stops.
To run the application in development mode on Kubernetes:
./mvnw quarkus:dev -Dquarkus.profile=kube-devThis command:
- Starts the application in development mode with the
kube-devprofile - Automatically starts an embedded MongoDB instance on port 27017 (same as local dev mode)
- Enables live coding while running in a Kubernetes environment
- No external MongoDB instance is required
./mvnw package
java -jar target/quarkus-app/quarkus-run.jarFor native executable:
./mvnw package -Dnative
./target/modernized-kitchensink-1.0.0-SNAPSHOT-runnerTo deploy the application to Kubernetes:
-
Build the application and container image:
./mvnw clean package -DskipTests ./mvnw quarkus:container-image-build
-
Apply the Kubernetes manifests:
kubectl apply -k kubernetes/
Alternatively, use the provided deployment script:
- On Windows:
.\deploy-to-kubernetes.ps1 - On Linux/macOS:
./deploy-to-kubernetes.sh
The script will:
- Build the application
- Create a container image
- Create the necessary Kubernetes resources
- Wait for the deployments to be ready
./mvnw test- Access the web interface at http://localhost:8080/kitchensink/
- Register a new member using the form
- View the list of members
- Access the REST API at http://localhost:8080/kitchensink/rest/members
-
Development Mode: Uses embedded MongoDB
%dev.quarkus.mongodb.devservices.enabled=true %dev.quarkus.mongodb.database=kitchensink-dev -
Kubernetes Development Mode: Uses embedded MongoDB (same as local dev mode)
%kube-dev.quarkus.mongodb.devservices.enabled=true %kube-dev.quarkus.mongodb.devservices.port=27017 %kube-dev.quarkus.mongodb.database=kitchensink-dev -
Production Mode: Uses an external MongoDB instance
%prod.quarkus.mongodb.connection-string=mongodb://localhost:27017 %prod.quarkus.mongodb.database=kitchensink
For more details, see the application.properties file.
The application includes the following Kubernetes resources:
- Deployment: Manages the application pods
- Service: Exposes the application within the cluster
- ConfigMap: Stores configuration values (including the profile setting)
- Ingress: Exposes the application externally
All resources are defined in the kubernetes/ directory and can be applied using kubectl apply -k kubernetes/.
Note: Unlike the production deployment, the Kubernetes dev mode uses embedded MongoDB just like local development, so no separate MongoDB deployment is needed.
- Database: Uses MongoDB instead of a relational database
- Startup Time: Quarkus offers significantly faster startup times
- Memory Usage: Lower memory footprint compared to JBoss EAP
- Development Experience: Live coding with near-instant feedback and embedded MongoDB
- Native Compilation: Option to compile to native code for even better performance
- Configuration: Simplified configuration with
application.propertiesinstead of XML files - Web Interface: Uses Qute templates instead of JSF
- Kubernetes Support: Built-in support for Kubernetes deployment and development