This project contains sample code that demonstrates how to get started with cloud-native applications and microservice based architectures. To get a fast overview of this project use our Cloud Native Starter landing page.
The project has three parts:
- Basic concepts: The documentation of this part is below. Cloud Native Starter demonstrates how to develop complete enterprise applications with Java and MicroProfile and how to operate them with Kubernetes, OpenShift and Istio. To get a fast overview of the basic-concepts part, use the basic-concepts landing page.
- Reactive: The reactive part explains how to use reactive programming and event based messaging in Quarkus applications and how to run them on Kubernetes and OpenShift. For more open the reactive folder and that part can be used completely separately or to get a fast overview of the reactive part, use the reactive landing page.
- Security: The security part explains how to do authentication and authorization in Quarkus applications with Keycloak and how to do network encryption with Istio. For more open the security folder and that part can be used completely separately. For a fast overview of the security part, use the security landing page.
The first part of the project focusses on how to build microservices with Java EE and the open source technologies Eclipse MicroProfile, Eclipse OpenJ9, AdoptOpenJDK and Open Liberty.
The microservices can easily be deployed on Kubernetes environments running Istio like Minikube, IBM Cloud Kubernetes Service, Red Hat OpenShift in CodeReady Containers or OpenShift on the IBM Cloud.
The project showcases the following functionality:
- Containerized Java EE Microservices
- Exposing REST APIs
- Consuming REST APIs
- Traffic Routing
- Resiliency
- Authentication and Authorization
- Metrics
- Health Checks
- Configuration
- Distributed Logging and Monitoring
- Persistence with Java Persistence API (JPA)
This diagram shows the key components:
The next screenshot shows the web application. More screenshots are in the images folder.
The sample application can be run in four different environments:
- Minikube (locally): See instructions below
- IBM Cloud Kubernetes Service - see instructions
- CodeReady Containers (Red Hat OpenShift locally) - see instructions
- Red Hat OpenShift on the IBM Cloud - see instructions
The following instructions describe how to install everything locally on Minikube.
Important: Before the microservices can be installed, make sure you've set up Minikube and Istio correctly or follow these instructions to set up Minikube and Istio from scratch. This should not take longer than 30 minutes.
Before deploying the application, get the code:
$ git clone https://github.com/IBM/cloud-native-starter.git
$ cd cloud-native-starter
$ ROOT_FOLDER=$(pwd)
The microservices can be installed via scripts. In addition to Minikube and Istio you need the following tools to be available.
Prerequisites:
Docker always needs to be installed locally. The tools git, curl and kubectl (and ibmcloud) can be installed locally or you can use a Docker image that comes with these tools.
$ cd ${ROOT_FOLDER}
$ docker run -v $ROOT_FOLDER/:/cloud-native-starter -it --rm ibmcom/ibm-cloud-developer-tools-amd64
Deploy (and redeploy):
$ cd ${ROOT_FOLDER}
$ scripts/check-prerequisites.sh
$ scripts/deploy-articles-java-jee.sh
$ scripts/deploy-web-api-java-jee.sh
$ scripts/deploy-authors-nodejs.sh
$ scripts/deploy-istio-ingress-v1.sh
$ scripts/deploy-web-app-vuejs.sh
$ scripts/show-urls.sh
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
At this point you have seen the "base line" of our Cloud Native Starter. The following documents describe how to implement additional functionality:
- Containerized Java EE Microservices
- Exposing REST APIs
- Consuming REST APIs
- Traffic Routing
- Resiliency
- Authentication and Authorization
- Metrics
- Health Checks
- Configuration
- Distributed Logging and Monitoring
- Persistence with Java Persistence API (JPA)
Run the following command to delete all cloud-native-starter components from Istio.
$ scripts/delete-all.sh
You can also delete single components:
$ scripts/delete-articles-java-jee.sh
$ scripts/delete-articles-java-jee-quarkus.sh
$ scripts/delete-web-api-java-jee.sh
$ scripts/delete-authors-nodejs.sh
$ scripts/delete-web-app-vuejs.sh
$ scripts/delete-istio-ingress.sh
The following slides summarize this repo:
- Project Description and Design Principles
- Presentation at We Are Developers (30 mins): How to develop your first cloud-native Applications with Java
- Recording of Jakarta Tech Talk (45 mins): How to develop your first cloud-native Applications with Java
- Recording of code.talks session in German: Wie entwickle ich meine ersten Cloud-nativen Applikationen mit Java?
- Hands-on workshop with MicroProfile, Kubernetes and Istio (three hours)
- Hands-on workshop YouTube playlist(6 * 3 min)
- Hands-on workshop build and deploy one microservice using Java, MicroProfile and Kubernetes (one hour)
- How to build and run a Hello World Java Microservice
- Dockerizing Java MicroProfile Applications
- Developing resilient Microservices with Istio and MicroProfile
- Managing Microservices Traffic with Istio
- Web Application to demo Traffic Management with Istio
- Implementing and documenting REST APIs with JavaEE
- Invoking REST APIs from Java Microservices
- Prometheus Metrics for MicroProfile Microservices in Istio
- Distributed logging with LogDNA and Monitoring with Sysdig
- Implementing Health Checks with MicroProfile and Istio
- Configuring Microservices with MicroProfile and Kubernetes
- Authenticating Web Users with OpenID and JWT
- Authorization in Cloud-Native Applications via OpenID and Istio
- Authorization in Microservices with MicroProfile
- Persistence for Java Microservices in Kubernetes via JPA
- Setup of a Local Kubernetes and Istio Dev Environment
- Moving from Minikube to IBM Cloud Kubernetes Service
- Recorded demos: Traffic management, resiliency, authorization, logging
- Using Quarkus to run Java Apps on Kubernetes
- Debugging Microservices running in Kubernetes
- Deploying MicroProfile Microservices with Tekton
- Setting up a cloud-native Sample App on Minishift in an Hour
- Deploying the Cloud Native Starter microservices on Minishift
- Deploying the Cloud Native Starter example on Red Hat OpenShift on the IBM Cloud
- Source to Image Builder for Open Liberty Apps on OpenShift
- How to develop Open Liberty Microservices on OpenShift
- Deploying Open Liberty Microservices to OpenShift
- Accessing private GitLab Repositories from OpenShift