Cloud Native Starter for Java and Node.js
This project contains sample code that shows how to build cloud-native applications with JavaEE and Node.js and deploy them to Kubernetes and Istio.
The project showcases the following functionality:
- JavaEE (with MicroProfile) and Node.js microservices
- Distributed tracing
- Traffic management
- Resiliency via fallbacks and circuit breakers
- REST APIs implementations incl. documentation
- REST API invocations
- Distributed logging
- Authentication and authorization
This diagram shows the key components:
The next screenshot shows the web application. More screenshots are in the images folder.
Local Environment Setup
Follow these instructions to set up the local environment with Minikube and Istio. This should not take longer than 30 minutes.
Deploy (and redeploy):
$ git clone https://github.com/nheidloff/cloud-native-starter.git $ cd cloud-native-starter $ scripts/check-prerequisites.sh $ scripts/deploy-articles-java-jee.sh $ scripts/deploy-web-api-java-jee.sh $ scripts/deploy-authors-nodejs.sh $ scripts/deploy-web-app-vuejs.sh $ scripts/deploy-istio-ingress-v1.sh $ scripts/show-urls.sh
Run the Demo
After running the scripts above, you will get a list of all URLs in the terminal.
Example URL to open the web app: http://192.168.99.100:31380
Example API endpoint: http://192.168.99.100:31380/web-api/v1/getmultiple
In order to demonstrate traffic routing you can run the following commands. 20 % of the web-api API request to read articles will now return 10 instead of 5 articles which is version 2. 80 % of the requests are still showing only 5 articles which is version 1. This distribution is set in
istio/istio-ingress-service-web-api-v1-v2-80-20.yaml (weight: 80 vs. weight: 20).
$ scripts/deploy-web-api-java-jee-v2.sh $ scripts/deploy-istio-ingress-v1-v2.sh
In order to demonstrate resiliency you can run the following command to delete the authors service:
In the next step delete the articles service:
Run these commands to delete the cloud native starter components:
$ scripts/delete-articles-java-jee.sh $ scripts/delete-web-api-java-jee.sh $ scripts/delete-authors-nodejs.sh $ scripts/delete-web-app-vuejs.sh $ scripts/delete-istio-ingress.sh
Here is a series of blog entries about this project:
- Setup of a Local Kubernetes and Istio Dev Environment
- Debugging Microservices running in Kubernetes
- Dockerizing Java MicroProfile Applications
- Developing resilient Microservices with Istio and MicroProfile
- Using Quarkus to run Java Apps on Kubernetes
- Managing Microservices Traffic with Istio
- Implementing and documenting REST APIs with JavaEE
- Invoking REST APIs from Java Microservices
- Distributed logging (functionality: almost done / blog: to be done)
- Monitoring and metrics (functionality: to be done / blog: to be done)
- Authentication and authorization (functionality: to be done / blog: to be done)
- Configuration (functionality: almost done / blog: to be done)
- Deployment to IBM Cloud
Here is more information about Microservices, MicroProfile and Istio:
- MicroProfile, the microservice programming model made for Istio
- Migrating Java Microservices to MicroProfile – Epilogue
- Video: Istio Platform vs Spring and MicroProfile frameworks
- Video: Java EE, Jakarta EE, MicroProfile, Or Maybe All Of Them?
- Video: Istio: Canaries and Kubernetes, Microservices and Service Mesh